ITPub博客

首页 > Linux操作系统 > Linux操作系统 > AIX/Linux生产环境下crontab自动调度RMAN物理备份例子

AIX/Linux生产环境下crontab自动调度RMAN物理备份例子

原创 Linux操作系统 作者:尛样儿 时间:2010-01-09 20:48:27 0 删除 编辑

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博客 ” ,链接:https://blog.itpub.net/23135684/viewspace-624737/ ,如需转载,请注明出处,否则将追究法律责任。

请登录后发表评论 登录
全部评论
Oracle数据库管理员,Oracle数据库系统构架员;2012年7月出版《构建最高可用Oracle数据库系统:Oracle 11gR2 RAC管理、维护与性能优化》一书;Oracle 10g OCM。

注册时间:2010-01-05

  • 博文量
    483
  • 访问量
    5651513