备份策略:
星期天 0 级
星期一,二,四,五六 2 级
星期三 1 级
--零级备份RMAN脚本level_0.rman
connect catalog rman/rman@rman
connect target sys/sys@sqlee
CONFIGURE RETENTION POLICY TO RECOVERY WINDOW OF 7 DAYS;
CONFIGURE CONTROLFILE AUTOBACKUP Off;
run {
allocate channel ch1 type disk;
allocate channel ch2 type disk;
backup incremental level 0 database filesperset 3 format 'E:\oracle\product\10.2.0\oradata\rmanbk\level0_%d_%s_%p_%u.bak' tag='level0' include current controlfile;
sql 'alter system archive log current';
backup archivelog all filesperset 20 format 'E:\oracle\product\10.2.0\oradata\rmanbk\arch_%d_%s_%p_%u.bak' delete all input;
release channel ch2;
release channel ch1;
}
list backup;
report obsolete;
crosscheck backup;
delete noprompt expired backup;
delete noprompt obsolete;
resync catalog;
--零级备份批处理脚本的level_0.bat
rman cmdfile='e:\rman\level_0.rman' msglog= 'E:\oracle\product\10.2.0\oradata\rmanbk\level_0_%date:~0,10%.log'
exit
--一级差异增量备份RMAN脚本level_1.rman
connect catalog rman/rman@rman
connect target sys/sys@sqlee
run {
allocate channel ch1 type disk;
backup incremental level 1 database filesperset 3 format 'E:\oracle\product\10.2.0\oradata\rmanbk\level1_%d_%s_%p_%u.bak' tag = 'level 1';
sql 'alter system archive log current';
backup archivelog all filesperset 20 format 'E:\oracle\product\10.2.0\oradata\rmanbk\arch_%d_%s_%p_%u.bak' delete all input;
release channel ch1;
}
crosscheck backup;
delete noprompt expired backup;
delete noprompt obsolete;
resync catalog;
--一级差异增量备份批处理脚本level_1.bat
rman cmdfile='e:\rman\level_1.rman' msglog= 'E:\oracle\product\10.2.0\oradata\rmanbk\level_1_%date:~0,10%.log'
exit
--二级差异增量备份RMAN脚本level_2.rman
connect catalog rman/rman@rman
connect target sys/sys@sqlee
run {
allocate channel ch1 type disk;
backup incremental level 2 database filesperset 3 format 'E:\oracle\product\10.2.0\oradata\rmanbk\level2_%d_%s_%p_%u.bak' tag = 'level 2';
sql 'alter system archive log current';
backup archivelog all filesperset 20 format 'E:\oracle\product\10.2.0\oradata\rmanbk\arch_%d_%s_%p_%u.bak' delete all input;
release channel ch1;
}
crosscheck backup;
delete noprompt expired backup;
delete noprompt obsolete;
resync catalog;
--二级差异增量备份批处理脚本level_2.bat
rman cmdfile='e:\rman\level_2.rman' msglog= 'E:\oracle\product\10.2.0\oradata\rmanbk\level_2_%date:~0,10%.log'
exit
--为了提高增量备份性能,还可以..
alter database enable block change tracking using file 'E:\oracle\product\10.2.0\admin\sqlee\tracking\tracking.log';
假如想取消tracking,可以alter database disable block change tracking
desc v$block_change_tracking;
来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/12158104/viewspace-440468/,如需转载,请注明出处,否则将追究法律责任。
转载于:http://blog.itpub.net/12158104/viewspace-440468/