AIX/Linux生產環境下crontab自動排程RMAN物理備份例子

尛樣兒發表於2010-01-09

rmanBackupL0(rman 0級增量備份執行指令碼):
run{
backup as compressed backupset incremental level 0 database plus archivelog delete all input;
crosscheck backup;
delete noprompt expired backup;
delete noprompt obsolete;
delete noprompt backup of archivelog all;
backup current controlfile;
sql 'alter database backup controlfile to trace';
}

rmanBackupL1(rman 1級增量備份執行指令碼):
run{
backup as compressed backupset incremental level 1 database plus archivelog delete input;
}

rmanL0Call.sh(Linux系統執行rman 0級備份shell指令碼):
#! /bin/sh
export ORACLE_HOME=/u01/app/oracle/db_1
export ORACLE_SID=test
/u01/app/oracle/db_1/bin/rman target / nocatalog cmdfile=/u01/app/oracle/scripts/rmanBackupL0 log=/u01/app/oracle/scripts/logs/rmanBackupL0.log append

rmanL1Call.sh(Linux系統執行rman 1級備份shell指令碼):
#! /bin/sh
export ORACLE_HOME=/u01/app/oracle/db_1
export ORACLE_SID=test
/u01/app/oracle/db_1/bin/rman target / nocatalog cmdfile=/u01/app/oracle/scripts/rmanBackupL1 log=/u01/app/oracle/scripts/logs/rmanBackupL1.log append

cron_rmanL0(crontab自動排程rman 0級備份指令碼):
0,10,20,30,40,50 * * * * /u01/app/oracle/scripts/rmanL0Call.sh

cron_rmanL1(crontab自動排程rman 1級備份指令碼):
6,15,17,24,27,34,37,44,47,54,57 * * * * /u01/app/oracle/scripts/rmanL1Call.sh

注意:
我們一般在oracle使用者下透過crontab同時呼叫0級備份和1級備份,那麼我們可以執行crontab -e命令,
加入:
0,10,20,30,40,50 * * * * /u01/app/oracle/scripts/rmanL0Call.sh
6,15,17,24,27,34,37,44,47,54,57 * * * * /u01/app/oracle/scripts/rmanL1Call.sh
儲存退出,就可以執行2個指令碼同時排程了。

 

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

相關文章