RMAN 增量备份shell脚本
2014-01-24 11:26
447 查看
前2天给公司的测试库写了个shell备份脚本,复杂的不会写,只能先从简单的入手,现贴出脚本文件供大家学习参考,有不对的地方也请大家多多指出!#”————————sunday———————————-”source /home/oracle/.bash_profile$ORACLE_HOME/bin/rman <<EOFconnect target /run{allocate channel d1 type disk;allocate channel d2 type disk;backup incremental level 0 database format ‘/u02/rman/full_0_%u.bak’;backup archivelog all format ‘/u02/rman/arch_%u.bak’;backup current controlfile format ‘/u02/rman/control_%u.bak’;release channel d1;release channel d2;}list backup;crosscheck backup;delete noprompt expired backup;delete noprompt obsolete;exit;EOFecho “————————-end——————————”;date#”————————monday———————————-”source /home/oracle/.bash_profile$ORACLE_HOME/bin/rman <<EOFconnect target /run{allocate channel d1 type disk;allocate channel d2 type disk;backup incremental level 1 database format ‘/u02/rman/bp_1_%u.bak’;backup archivelog all format ‘/u02/rman/arch_%u.bak’;backup current controlfile format ‘/u02/rman/control_%u.bak’;release channel d1;release channel d2;}crosscheck backup;delete noprompt expired backup;delete noprompt obsolete;exit;EOFecho “————————-end——————————”;date#”————————tuesday———————————-”source /home/oracle/.bash_profile$ORACLE_HOME/bin/rman <<EOFconnect target /run{allocate channel d1 type disk;allocate channel d2 type disk;backup incremental level 1 database format ‘/u02/rman/bp_1_%u.bak’;backup archivelog all format ‘/u02/rman/arch_%u.bak’;backup current controlfile format ‘/u02/rman/control_%u.bak’;release channel d1;release channel d2;}crosscheck backup;delete noprompt expired backup;delete noprompt obsolete;exit;EOFecho “————————-end——————————”;date#”————————wendesday———————————-”source /home/oracle/.bash_profile$ORACLE_HOME/bin/rman <<EOFconnect target /run{allocate channel d1 type disk;allocate channel d2 type disk;backup incremental level 2 database format ‘/u02/rman/bp_2_%u.bak’;backup archivelog all format ‘/u02/rman/arch_%u.bak’;backup current controlfile format ‘/u02/rman/control_%u.bak’;release channel d1;release channel d2;}crosscheck backup;delete noprompt expired backup;delete noprompt obsolete;exit;EOFecho “————————-end——————————”;date#”————————thursday———————————-”source /home/oracle/.bash_profile$ORACLE_HOME/bin/rman <<EOFconnect target /run{allocate channel d1 type disk;allocate channel d2 type disk;backup incremental level 1 database format ‘/u02/rman/bp_1_%u.bak’;backup archivelog all format ‘/u02/rman/arch_%u.bak’;backup current controlfile format ‘/u02/rman/control_%u.bak’;release channel d1;release channel d2;}crosscheck backup;delete noprompt expired backup;delete noprompt obsolete;exit;EOFecho “————————-end——————————”;date#”————————Friday———————————-”source /home/oracle/.bash_profile$ORACLE_HOME/bin/rman <<EOFconnect target /run{allocate channel d1 type disk;allocate channel d2 type disk;backup incremental level 2 database format ‘/u02/rman/bp_2_%u.bak’;backup archivelog all format ‘/u02/rman/arch_%u.bak’;backup current controlfile format ‘/u02/rman/control_%u.bak’;release channel d1;release channel d2;}crosscheck backup;delete noprompt expired backup;delete noprompt obsolete;exit;EOFecho “————————-end——————————”;date#”————————saturday———————————-”source /home/oracle/.bash_profile$ORACLE_HOME/bin/rman <<EOFconnect target /run{allocate channel d1 type disk;allocate channel d2 type disk;backup incremental level 1 database format ‘/u02/rman/bp_1_%u.bak’;backup archivelog all format ‘/u02/rman/arch_%u.bak’;backup current controlfile format ‘/u02/rman/control_%u.bak’;release channel d1;release channel d2;}crosscheck backup;delete noprompt expired backup;delete noprompt obsolete;exit;EOFecho “————————-end——————————”;date把每天的脚本代码写进一个sh文件然后设置crontabcrontab如下10 1 * * 0 /u01/crontab_bp_shell/sunday_bp.sh10 1 * * 1 /u01/crontab_bp_shell/monday_bp.sh10 1 * * 2 /u01/crontab_bp_shell/tuesday_bp.sh10 1 * * 3 /u01/crontab_bp_shell/wendesday_bp.sh10 1 * * 4 /u01/crontab_bp_shell/thursday_bp.sh10 1 * * 5 /u01/crontab_bp_shell/friday_bp.sh10 1 * * 6 /u01/crontab_bp_shell/saturday_bp.sh好了,一个简单的备份策略就这样出来了!
相关文章推荐
- Oracle DB 使用RMAN恢复目录
- RMAN 各种情况下恢复
- 使用RMAN恢复Oracle 10g RAC库至异机
- 不同配置决定不同的复制的流程
- rman技术速查手册
- RMAN的基本配置
- RMAN 备份详解
- RMAN 还原与恢复
- Oracle数据库rman自动备份的常见报错
- rman 备份原理
- Oracle9i Recovery Manager (RMAN)
- Oracle9i rman备份恢复总结
- 121231异机恢复oracle数据库
- rman备份后为什么要同时备份归档日志
- dataguard 备库重做记录
- oralce RAC 归档日志的方式及RMAN备份方法
- Flash Recovery Area空间不足导致数据库不能打开或hang住
- 用RMAN 备份异机完全恢复 迁移数据
- RMAN备份异机恢复并创建新DBID
- Rman备份中常见的问题