Saturday 20 August 2016

Server Maintenance Tasks for a DBA





To delete files older than 60 days
$  find . -name "*.gz" -depth -mtime +60 -exec rm {} \;


To list files dated May 18
ls -lrt | grep 'May 18' | awk -F' ' '{print$9}'


To delete files dated May 18
rm -rf `ls -lrt | grep ‘May 18' | awk -F' ' '{print$9}'`


To list files of Month May
$  ls -lrt | grep 'May' | awk -F' ' '{print$9}'
$  ls -lrt *.trc|grep 'May'|xargs rm -rf  {}\;

Things need to check during - - Server reboot

Suppose you are working on Dataguard setup or normal Stand-Alone Database,
Following steps mandatory just take backup of following three steps and store it in separate notepad.
Once the server reboot activity completed.. then cross check once which was taken before server reboot.


$  ps -ef|grep pmon

$  ps -ef|grep pmon|wc -l

$  ps -ef|grep inh (OR) ps -ef|grep tns

$  ps -ef|grep inh|wc -l

$  ps -ef |grep d.bin

$  hostname

$  date

$  uname -a

$  cat /etc/oratab  /  cat /var/opt/oracle/oratab

$  uptime

$  who -b

$  df -h  / df –gt



Data Guard Database  Shutdown Procedure

Login as oracle

source the environment

$  sqlplus “/ as sysdba”

SQL >alter database recover managed standby database cancel;
                                                                                ------> to cancel MRM mode

SQL> shutdown immediate;

SQL> exit


Data Guard Db Startup Procedure

$  Sqlplus “/ as sysdba”

SQL> startup nomount;

SQL> alter database mount standby database;

SQL>  recover managed standby database disconnect from session;
                                                                ----------->To put it in MRM MODE

No comments:

Post a Comment