RMAN 備份策略 scripts

beatony發表於2013-02-16
szjsdbsvr1:11g:jingsuan > more rman_jingsuan.rcv
crosscheck archivelog all;
delete noprompt expired archivelog all;
crosscheck backup;
delete noprompt obsolete; 
delete expired copy;
run{
allocate channel c1 type disk;
allocate channel c2 type disk;
allocate channel c3 type disk;
allocate channel c4 type disk;
allocate channel c5 type disk;
allocate channel c6 type disk;
allocate channel c7 type disk;
allocate channel c8 type disk;
backup as compressed backupset database format '/bea/rman/jingsuan_full_%U'
plus archivelog skip inaccessible delete all input format '/bea/rman/jingsuan_ARC_%U';
backup current controlfile format '/bea/rman/jingsuan_control_bak_%T';
backup spfile format '/bea/rman/jingsuan_spfile_bak_%T';
release channel c1;
release channel c2;
release channel c3;
release channel c4;
release channel c5;
release channel c6;
release channel c7;
release channel c8;
}

szjsdbsvr1:11g:jingsuan > more backup_db.sh
PATH=$PATH:$HOME/bin
export PATH
export ORACLE_BASE=/bea/app/oracle
export ORACLE_SID=jingsuan
export ORACLE_HOME=$ORACLE_BASE/product/11.2.0
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$ORACLE_HOME/lib
export PATH=$ORACLE_HOME/bin:$PATH
export EDITOR=vi
export NLS_LANG='AMERICAN_AMERICA.ZHS16GBK'
mv /bea/rman/jingsuan_* /bea/rmanbak/
logName=jingsuan_rman_`date +'%Y%m%d%H%M%S'`_full.log
find /bea/rmanbak/ -name "jingsuan_*" -mtime +1 -exec rm -rf {} \;
cd /bea/rman
rman target / CMDFILE rman_jingsuan.rcv >> $logName

szjsdbsvr1:11g:jingsuan > crontab -l
00 02 * * * sh /bea/rman/backup_db.sh
 

來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/22578826/viewspace-754139/,如需轉載,請註明出處,否則將追究法律責任。

相關文章