![]() |
|
Shell ScriptRMAN Full Backup |
|
This script assumes that you have the rmanfull script and have renamed it {ORACLE_SID}_full.rman
It also uses the oemevent command to send an alert to OEM.
REM Copyright (C) Think Forward.com 1998- 2005. All rights reserved.
#!/usr/bin/ksh if [ -z "${1}" ]; then echo echo Usage: backup_full.ksh \$ORACLE_SID echo echo \$ORACLE_SID must be supplied echo exit 1 fi export ORACLE_SID=$1 export PATH=/usr/local/bin:$PATH ##################################################################################### # Use Variables instead of Hard Coding. This should be the only section # to change if the environment changes # BACKUP_DATE=`date +%b_%d_%Y_%H_%M_%S` # Date of backup BACKUP_LOG_DIR=/home/oracle/logs/$ORACLE_SID # Backup log directory BACKUP_LOG_FILE=${BACKUP_LOG_DIR}/${BACKUP_DATE}_full # Log file of backup SCRIPTNAME=`basename $0` # name of this script RMAN_CONNECT_STR=rman/manager@rman # OEM Variables TARGET=orcl.world EVENTNAME="/myevent/rdbms/rman/status" # ##################################################################################### echo "\n${SCRIPTNAME}: Start of Full Oracle On-Line backup of $ORACLE_SID on `date +%b_%d_%Y` at `date +%H_%M_%S` \n" > ${BACKUP_LOG_FILE} 2>&1 # Set up the environment export ORAENV_ASK="NO" export ORACLE_SID=$ORACLE_SID . oraenv rman target/ catalog $RMAN_CONNECT_STR cmdfile /home/oracle/${ORACLE_SID}_full.rman >> ${BACKUP_LOG_FILE} 2>&1 STATUS=$? if [ "$STATUS" -ne "0" ] then # If you have OEM monitoring, then send an OEM Alert ERRTXT="\n${SCRIPTNAME}: \n******* ERROR: RMAN Backup Job Failed for $TARGET ! ******\n" echo $ERRTXT >> ${BACKUP_LOG_FILE} 2>&1 SEV=alert oemevent $EVENTNAME $TARGET $SEV "$ERRTXT" fi echo "\n${SCRIPTNAME}: End of Full Oracle On-Line backup of $ORACLE_SID on `date +%b_%d_%Y` at `date +%H_%M_%S` \n" >> ${BACKUP_LOG_FILE} 2>&1 echo $BACKUP_DATE "Full Backup of ${ORACLE_SID} Exited with Code: " $STATUS #Clean 'DELETED' records from recovery catalog sqlplus -s $RMAN_CONNECT_STR <Related Links
Oracle 8i: (RMAN Script) RMAN Full Backup
Return to Index of SQL Scripts
Site Map
General Information : Home | Company Profile | Contact Us | Legal
Database Support : Proactive Support | Pay Per Incident Support
Expert Services : High Availability | Creative Solutions | Training
Build Services : Oracle Installations | Revive your Oracle Setup | Low Cost Development
Free Oracle Resources: DBA Scripts | Oracle Links