Think Foward Logo Tested on Oracle 8i

Shell Script

RMAN Incremental Backup

Updated: 24-Nov-2004
Version: 1.0

Description

This script assumes that you have the rmanincr script and have renamed it {ORACLE_SID}_incr.rman

It also uses the oemevent command to send an alert to OEM.

Parameters


SQL Source

REM Copyright (C) Think Forward.com 1998- 2005. All rights reserved. 
#!/usr/bin/ksh if [ -z "${1}" ]; then echo echo Usage: backup_incr.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}_incr # 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 Incremental 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}_incr.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 Incremental 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 "Incremental 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 Incremental 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