Thursday, June 12, 2008

Shell script to switch redo log manually to sync the standby database

#!/bin/ksh
################################################
### Run this shell script to switch redo log manually
###to sync the standby database.
###Author: Anbu Subramanian
###Date :04/21/2005
### $1----Instance.
###############################################
mailto:dba_team=
. /oracle/.102boraenv
dtstamp=`date +%m%d%Y%H%M%S`
outputdir=$HOME/standby
opwd=`cat $outputdir/.infodb.$1`
export opwd
sqlplus -s > /dev/null <$opwd@$1
set feedback on
set echo on
spool $outputdir/switch_log_$1.log
Alter system switch logfile;
spool off
END1
/usr/bin/cat $outputdir/switch_log_$1.log grep ORA- > $outputdir/switch_log_$1.new
if [ $? = 0 ] then
mailx -s " ERROR IN $1 REDO LOG SWITCH on $dtstamp. " $dba_team <Read $outputdir/switch_log_$1.new for details
EOMAIL
fi
rm $outputdir/switch_log_$1.log
rm $outputdir/switch_log_$1.new
exit

No comments: