RMAN多种备份脚本分享(二)

2014-11-24 14:50:23 · 作者: · 浏览: 1
01arch_%d_%t_%s"
delete all input;
}
exit
5.cumulative累积增量备份--有0、1、2三级
0级累积增量备份脚本
#!/bin/sh
source /home/oracle/.bash_profile
#########rman-back level 0 ---cumulative
rman log /home/oracle/back0-`date +%Y%m%d-%H%M`.log <
connect target /;
run {
backup incremental level=0 cumulative tag 'bys001-0' database
format "/backup/full/bys001full_%d_%t_%s"
plus archivelog
format "/backup/full/bys001arch_%d_%t_%s"
delete all input;
}
exit
1级累积增量备份脚本
#!/bin/sh
source /home/oracle/.bash_profile
#########rman-back level 1 --cumulative
rman log /home/oracle/back1-`date +%Y%m%d-%H%M`.log <
connect target /;
run {
backup incremental level=1 cumulative tag 'bys001-1' database
format "/backup/full/bys001full_%d_%t_%s"
plus archivelog
format "/backup/full/bys001arch_%d_%t_%s"
delete all input;
}
exit
2级累积增量备份脚本
这个脚本里使用了服务名来登陆RMAN。最好先在RMAN中使用connect target sys/sys@192.168.1.212:1521/bys001;确认登陆正常再写入脚本。
当然也可以使用 rman target sys/sys@bys001
#!/bin/sh
source /home/oracle/.bash_profile
#########rman-back level 2 ---cumulative
rman log /home/oracle/back2-`date +%Y%m%d-%H%M`.log <
connect target sys/sys@192.168.1.212:1521/bys001;
run {
backup incremental level=2 cumulative tag 'bys001-2' database
format "/backup/full/bys001full_%d_%t_%s"
plus archivelog
format "/backup/full/bys001arch_%d_%t_%s"
delete all input;
}
exit