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个脚本同时调度了。