#!/bin/ksh # oracle_backup.sh # # This script does the following: # 1. Backup the oracle files identified from oracle_shut.sh script # # The database should be shutdown using oracle_shut.sh script # # Author : Biju Thomas # Date : 08/21/97 # # Variables wdt=`date '+%m%d'` export DSMC=<<<<<<< your backup copy command here >>>>>>> # # Define variables # if test $# -ne 1 then echo "ORACLE_SID should be passed in as a parameter" return 1 fi export ORACLE_SID=$1 export wlogfile=oback_log.$ORACLE_SID export werrfile=oback_err.$ORACLE_SID export wbackupfiles=dbfiles.$ORACLE_SID # #Save Date and time of backup for restore mv datetime.${ORACLE_SID} datetime.${ORACLE_SID}.old 2>/dev/null echo `date '+%m/%d/%Y %X'` > datetime.${ORACLE_SID} # # Initialize log and err files # echo "**********************************************************************" > $werrfile echo "**********************************************************************" > $wlogfile # # Cold Backup Begin Date and Time. # echo Cold Backup Begin Time `date '+%m/%d/%y %X %A'` >> $wlogfile # # Read file names from $wbackupfiles and back up to ADSM # cat $wbackupfiles | while read FILENAME do $DSMC $FILENAME >> $wlogfile 2>>$werrfile STATUS=$? if test $STATUS -ne 0 then # Try one more time...!! # $DSMC $FILENAME >> $wlogfile 2>>$werrfile STATUS=$? fi if test $STATUS -ne 0 then echo "Backup returned ERROR $STATUS" >> $werrfile break fi done # # If there are errors during the above steps, inform dbaoc # if test `cat $werrfile | wc -l` -ne 1 then echo "**********************************************************************" >> $werrfile echo "Verify $wlogfile for more details" >> $werrfile echo "Date : "`date '+%m/%d/%y %X %A '` >> $werrfile echo "Database : "$ORACLE_SID >> $werrfile echo "Server : "`uname -n` >> $werrfile echo "**********************************************************************" >> $werrfile mailx -s "Errors in cold backup copy - $ORACLE_SID" "tbiju@hotmail.com" > /dev/null < $werrfile else echo "Successful completion of backup file copy $ORACLE_SID" >> $wlogfile echo "No Errors / Alerts Encountered" >> $wlogfile echo "**********************************************************************" >> $wlogfile fi # # Cold Backup End Date and Time. # echo Cold Backup End Time `date '+%m/%d/%y %X %A'` >> $wlogfile # # end of script ##