Linux环境下rman备份的实例脚本

背景:
目标数据库10.20.5.18 Centos Linux  Oracle 9.2.0.6
恢复目录数据库 10.20.5.39 WindowsXP Oracle 9.2.0.1 rman/rman

1、配置catalog恢复目录
create tablespace ts_rman datafile='d:oratestrman.dbf' size=100M;
create user rman identified by rman default tablespace ts_rman;
grant connect ,resource , RECOVERY_CATALOG_OWNER to rman;
连接到目标数据库和CATALOG数据库
rman target / catalog rman/rman@244
创建CATALOG用户的表,登记目标数据库
rman> create catalog
rman> register database
配置参数
rman> configure controlfile autobackup on;
rman> configure backup optimization on;
2、rman备份方案
每周日晚做一次零级备份,周一到周六做一次一级备份
************************************************************************
*** rman_bk_L0.sh ***
************************************************************************
#!/bin/sh
source /home/oracle/.bash_profile
cd $ORACLE_HOME/bin
./rman target / catalog rman/rman@244 msglog=/home/oracle/work/log/rman_bk_L0_`date '+%Y%m%d%H%M%S'`.log <
run {
allocate channel c1 type disk;
backup incremental level 0 filesperset 5 tag 'dbL0' format '/mnt/raid/rman_bk/ora_o_%d_%t%s%p%u' database skip readonly;
sql 'alter system archive log current' ;
backup(archivelog all format '/mnt/raid/rman_bk/ora_a_%d_%t%s%p%u');
release channel c1;
}
list backup;
exit;
EOF
************************************************************************
*** rman_bk_L1.sh ***
************************************************************************
#!/bin/sh
source /home/oracle/.bash_profile
cd $ORACLE_HOME/bin
./rman target / catalog rman/rman@244 msglog=/home/oracle/work/log/rman_bk_L1_`date '+%Y%m%d%H%M%S'`.log <
run {
allocate channel c1 type disk;
backup incremental level 1 filesperset 5 tag 'dbL1' format '/mnt/raid/rman_bk/ora_o_%d_%t%s%p%u' database skip readonly;
sql 'alter system archive log current' ;
backup(archivelog all format '/mnt/raid/rman_bk/ora_a_%d_%t%s%p%u');
release channel c1;
}
list backup;
exit;
EOF
然后使用crontab命令在linux上安排job如下:
00 02 * * 0 /home/oracle/work/bin/rman_bk_L0.sh
00 02 * * 1,2,3,4,5,6 /home/oracle/work/bin/rman_bk_L1.sh
注意:每周一要将冗余的备份手工清除掉
rman> report obsolete;
rman> delete obsolete;

来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/14136468/viewspace-528641/,如需转载,请注明出处,否则将追究法律责任。

转载于:http://blog.itpub.net/14136468/viewspace-528641/

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值