当前位置: 代码迷 >> Oracle技术 >> 求oracle增量备份的方法解决办法
  详细解决方案

求oracle增量备份的方法解决办法

热度:31   发布时间:2016-04-24 08:33:38.0
求oracle增量备份的方法
如何实现oracle增量备份?

------解决方案--------------------
SQL code
-- *1). 完整备份 + 压缩备份 脚本:#!/bin/bash# incremental level 0 backup scriptsource /home/oracle/.bash_profilecurrent_day=`date +%Y%m%d`current_day=12_$current_daymkdir /data/obase/ora_backup/$current_dayecho '-------------------------------------'echo "-- Begin Backup of DB 10.4.1.12 DateTime: `date` --"echo '-------------------------------------'rman target  / <<EOFrun{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;}EOFecho '------------------------------------'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 &waitecho '------------------------------------'echo "-- End of Send file to 10.4.1.13 DateTime: `date` --"echo '------------------------------------'-- *2) 增量备份 + 压缩备份脚本:#!/bin/bash# incremental level 1 backup scriptsource /home/oracle/.bash_profilecurrent_day=`date +%Y%m%d`incr_day=12_incr$current_daymkdir /data/obase/ora_backup/$incr_dayecho '-------------------------------------'echo "-- Begin Backup of DB 10.4.1.12 DateTime: `date` --"echo '-------------------------------------'rman target  / <<EOFrun{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;}EOFecho '------------------------------------'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 &waitecho '------------------------------------'echo "-- End of Send file to 10.4.1.13 DateTime: `date` --"echo '------------------------------------'
------解决方案--------------------
SQL code
-- 然后,我的crontab 如下:[oracle@localhost bk_script]$ crontab -l05 18 * * 6 /data/obase/ora_backup/bk_script/bk_script_level0.sh >> /data/obase/ora_backup/12_bk_level0.log05 18 * * 0-5 /data/obase/ora_backup/bk_script/bk_script_level1.sh >> /data/obase/ora_backup/12_bk_level1.log
  相关解决方案