RMAN BACKUP
Examples on this page assume that all pre-requiste and configuration steps are complete.
Simple Backup
rman target /@${ORACLE_SID}
backup database plus archivelog;
delete obsolete;
Incremental Backup to TSM
Assumes TSM/RMAN integration is configuredLevel 0
run {
allocate channel t1 type 'SBT_TAPE' parms 'ENV=(TDPO_OPTFILE=/usr/tivoli/tsm/client/oracle/bin64/tdpo.opt)';
delete obsolete;
delete archivelog all backed up 1 times to device type 'SBT_TAPE';
backup incremental level 0 database plus archivelog;
release channel t1;
}
Level 1
run {
allocate channel t1 type 'SBT_TAPE' parms 'ENV=(TDPO_OPTFILE=/usr/tivoli/tsm/client/oracle/bin64/tdpo.opt)';
delete obsolete;
delete archivelog all backed up 1 times to device type 'SBT_TAPE';
backup incremental level 1 database plus archivelog;
release channel t1;
}
ARCHIVELOG Backup Examples
backup archivelog all;
backup archivelog time between 'sysdate-12/24' and 'sysdate-11/24';
run {
allocate channel t1 type 'SBT_TAPE' parms 'ENV=(TDPO_OPTFILE=/usr/tivoli/tsm/client/oracle/bin64/tdpo.opt)';
backup archivelog time between 'sysdate-12/24' and 'sysdate-11/24';
delete noprompt obsolete;
release channel t1;
}
Monitoring Backup Progress
Automated Backup Example
This example peforms a weekly full and daily incremental backup to "tape" (TSM) and retains 30 days worth of logs.
This is only an example. Make sure you understand what the scripts are doing, and modify them to meet your own specific needs.rmantsm.ksh
Create this in /u01/dba/rman...
# ............................................................................
#
# Name /u01/dba/rman/rmantsm.ksh
# Purpose Run standard RMAN backup to TSM/TDP
# Usage Usually scheduled via 'oracle' crontab
# Return 0 = Success, 1 = Fail
# Parameters 0 = Level 0, 1 = Level 1, A - Archivelog
#
# ............................................................................
if [ $1 ]
then
LEVEL=$1
else
LEVEL=0
fi
function oradbenv
{
. /etc/profile
if [ -a ~/.profile ]
then
. ~/.profile
fi
if [ -a ~/.bash_profile]
then
. ~/.bash_profile
fi
}
oradbenv
case ${LEVEL}
in
0) rman target / cmdfile /u01/dba/rman/simpletsm0.txt
;;
1) rman target / cmdfile /u01/dba/rman/simpletsm1.txt
;;
A) rman target / cmdfile /u01/dba/rman/archivetsm.txt
;;
*) echo "ERROR: Supported levels are 0 or 1 or A"
exit 1
;;
esac
# EOF
simpletsm0.txt
Create this in /u01/dba/rman...
run
{
allocate channel t1 type 'SBT_TAPE' parms 'ENV=(TDPO_OPTFILE=/usr/tivoli/tsm/client/oracle/bin64/tdpo.opt)';
delete obsolete;
delete archivelog all backed up 1 times to device type 'SBT_TAPE';
backup incremental level 0 database plus archivelog;
release channel t1;
}
show all;
report unrecoverable;
report need backup;
list backup summary;
simpletsm1.txt
Create this in /u01/dba/rman...
run
{
allocate channel t1 type 'SBT_TAPE' parms 'ENV=(TDPO_OPTFILE=/usr/tivoli/tsm/client/oracle/bin64/tdpo.opt)';
delete obsolete;
delete archivelog all backed up 1 times to device type 'SBT_TAPE';
backup incremental level 1 database plus archivelog;
release channel t1;
}
show all;
report unrecoverable;
report need backup;
list backup summary;
archivetsm.txt
Create this in /u01/dba/rman...
run
{
allocate channel t1 type 'SBT_TAPE' parms 'ENV=(TDPO_OPTFILE=/usr/tivoli/tsm/client/oracle/bin64/tdpo.opt)';
backup archivelog all;
delete obsolete;
delete archivelog all backed up 1 times to device type 'SBT_TAPE';
release channel t1;
}
show all;
report unrecoverable;
report need backup;
list backup summary;
Cron Schedule
10 22 * * 6 /u01/dba/rman/rmantsm.ksh 0 >/u01/dba/rman/logs/rman.$(date +""\%d"").log 2>&1
10 02 * * 0,1,2,3,4,5 /u01/dba/rman/rmantsm.ksh 1 >/u01/dba/rman/logs/rman.$(date +""\%d"").log 2>&1
Check Logs
This finds all lines with an RMAN or ORA error, or an OS/MML level error whilst excluding information messages...
cd /u01/dba/rman/logs
grep -E 'RMAN-|ORA-|^ ' * | grep -v RMAN-08138 | grep -v RMAN-08120
RMAN-08138: WARNING: archived log not deleted - must create more backupsRMAN-08120: WARNING: archived log not deleted, not yet applied by standby