日期:2014-05-16 浏览次数:20794 次
-- *1). 完整备份 + 压缩备份 脚本: #!/bin/bash # incremental level 0 backup script source /home/oracle/.bash_profile current_day=`date +%Y%m%d` current_day=12_$current_day mkdir /data/obase/ora_backup/$current_day echo '-------------------------------------' echo "-- Begin Backup of DB 10.4.1.12 DateTime: `date` --" echo '-------------------------------------' rman target / <<EOF run { CONFIGURE RETENTION POLICY TO RECOVERY WINDOW OF 14 DAYS; CONFIGURE BACKUP OPTIMIZATION ON; CONFIGURE CONTROLFILE AUTOBACKUP ON; CONFIGURE CONTROLFILE AUTOBACKUP FORMAT FOR DEVICE TYPE DISK TO '/data/obase/ora_backup/$current_day/PID-%F'; CONFIGURE DEVICE TYPE DISK PARALLELISM 4; crosscheck backup; delete noprompt obsolete; delete noprompt expired backup; allocate channel dev1 type disk; allocate channel dev2 type disk; allocate channel dev3 type disk; allocate channel dev4 type disk; backup as compressed backupset incremental level 0 tag='db0' format '/data/obase/ora_backup/$current_day/%n_%T_%U' database; sql 'alter system archive log current'; backup archivelog all format '/data/obase/ora_backup/$current_day/arc_%n_%T_%U' delete all input; release channel dev1; release channel dev2; release channel dev3; release channel dev4; } EOF echo '------------------------------------' echo "-- End Backup of DB 10.4.1.12 DateTime: `date` --" echo '------------------------------------' scp -l 81920 -r /data/obase/ora_backup/$current_day oracle@10.4.1.13:/data/obase/ora_backup12 & wait echo '------------------------------------' echo "-- End of Send file to 10.4.1.13 DateTime: `date` --" echo '------------------------------------' -- *2) 增量备份 + 压缩备份脚本: #!/bin/bash # incremental level 1 backup script source /home/oracle/.bash_profile current_day=`date +%Y%m%d` incr_day=12_incr$current_day mkdir /data/obase/ora_backup/$incr_day echo '-------------------------------------' echo "-- Begin Backup of DB 10.4.1.12 DateTime: `date` --" echo '-------------------------------------' rman target / <<EOF run { CONFIGURE RETENTION POLICY TO RECOVERY WINDOW OF 14 DAYS; CONFIGURE BACKUP OPTIMIZATION ON; CONFIGURE CONTROLFILE AUTOBACKUP ON; CONFIGURE CONTROLFILE AUTOBACKUP FORMAT FOR DEVICE TYPE DISK TO '/data/obase/ora_backup/$incr_day/PID-%F'; CONFIGURE DEVICE TYPE DISK PARALLELISM 4; delete noprompt obsolete; crosscheck backup; delete noprompt expired backup; allocate channel dev1 type disk; allocate channel dev2 type disk; allocate channel dev3 type disk; allocate channel dev4 type disk; backup as compressed backupset incremental level 1 cumulative tag='db1' format '/data/obase/ora_backup/$incr_day/%n_%T_%U' database; sql 'alter system archive log current'; backup archivelog all format '/data/obase/ora_backup/$incr_day/arc_%n_%T_%U' delete all input; release channel dev1; release channel dev2; release channel dev3; release channel dev4; } EOF echo '------------------------------------' echo "-- End Backup of DB 10.4.1.12 DateTime: `date` --" echo '------------------------------------' scp -l 81920 -r /data/obase/ora_backup/$incr_day oracle@10.4.1.13:/data/obase/ora_backup12 & wait echo '------------------------------------' echo "-- End of Send file to 10.4.1.13 DateTime: `date` --" echo '------------------------------------'
------解决方案--------------------
-- 然后,我的crontab 如下: [oracle@localhost bk_script]$ crontab -l 05 18 * * 6 /data/obase/ora_backup/bk_script/bk_script_level0.sh >> /data/obase/ora_backup/12_bk_level0.log 05 18 * * 0-5 /data/obase/ora_backup/bk_script/bk_script_level1.sh >> /data/obase/ora_backup/12_bk_level1.log