--零级备份RMAN脚本rman_level0.dcv
connect catalog rman/rman_#_01
connect target sys/t_#_sys@new
run {
allocate channel d1 type disk;
allocate channel d2 type disk;
backup incremental level 0 database format '/back/rman_bak/rman_level0/level0_%d_%s_%p_%u.bak'
tag='level 0' include current controlfile;
sql 'alter system archive log current';
backup archivelog all format '/back/rman_bak/rman_level0/log_%d_%s_%p_%u.bak' delete all input;
release channel d2;
release channel d1;
}
crosscheck backup;
delete noprompt expired backup;
delete noprompt obsolete;
resync catalog;
--零级备份SHELL脚本的rman_level0.sh
#!/bin/bash
cd
#..bash_profile
cd /data/oracle/rman_bak
rman cmdfile=rman_level0.dcv msglog=/back/rman_bak/rman_level0/level0_backup.log
run {
allocate channel d1 type disk;
backup incremental level 1 format '/back/rman_bak/rman_level1/level1_%d_%s_%p_%u.bak' tag = 'level 1' database;
sql 'alter system archive log current';
backup archivelog all format '/back/rman_bak/rman_level1/log_%d_%s_%p_%u.bak' delete all input;
release channel d1;
}
crosscheck backup;
delete noprompt expired backup;
delete noprompt obsolete;
resync catalog;
--一级差异增量备份SHELL脚本rman_level1.sh
#!/bin/bash
cd
#..bash_profile
cd /data/oracle/rman_bak
rman cmdfile=rman_level0.dcv msglog=/back/rman_bak/rman_level1/level1_backup.log
run {
allocate channel d1 type disk;
backup incremental level 2 format '/back/rman_bak/rman_level2/level2_%d_%s_%p_%u.bak' tag = 'level 2' database;
sql 'alter system archive log current';
backup archivelog all format '/back/rman_bak/rman_level2/log_%d_%s_%p_%u.bak' delete all input;
release channel d1;
}
crosscheck backup;
delete noprompt expired backup;
delete noprompt obsolete;
resync catalog;
--二级差异增量备份SHELL脚本rman_level2.sh
#!/bin/bash
cd
#..bash_profile
cd /data/oracle/rman_bak
rman cmdfile=rman_level0.dcv msglog=/back/rman_bak/rman_level2/level2_backup.log
自动执行
[oracle@jwdb oracle]$ crontab -l
######### RMAN AUTO BACKUP ##########