本文共 5486 字,大约阅读时间需要 18 分钟。
rac上开启block change tracking功能
首先在测试库测试一下开启block change tracking增量备份的速度这个server配置很低,做一次全备份要很长时间,总共有60G数据先做一个level 0的全备份
RMAN> backup incremental level 0 as compressed backupset database format '/data/oracle/backup/justin/justin_%U.bak';Starting backup at 08-AUG-11
using target database control file instead of recovery catalogallocated channel: ORA_DISK_1channel ORA_DISK_1: sid=1077 devtype=DISKchannel ORA_DISK_1: starting compressed incremental level 0 datafile backupsetchannel ORA_DISK_1: specifying datafile(s) in backupset******channel ORA_DISK_1: starting piece 1 at 08-AUG-11channel ORA_DISK_1: finished piece 1 at 08-AUG-11piece handle=/data/oracle/backup/justin/justin_01mjfu2v_1_1.bak tag=TAG20110808T140622 comment=NONEchannel ORA_DISK_1: backup set complete, elapsed time: 00:59:06channel ORA_DISK_1: starting compressed incremental level 0 datafile backupsetchannel ORA_DISK_1: specifying datafile(s) in backupsetincluding current control file in backupsetchannel ORA_DISK_1: starting piece 1 at 08-AUG-11channel ORA_DISK_1: finished piece 1 at 08-AUG-11piece handle=/data/oracle/backup/justin/justin_02mjg1hq_1_1.bak tag=TAG20110808T140622 comment=NONEchannel ORA_DISK_1: backup set complete, elapsed time: 00:00:01Finished backup at 08-AUG-11此次level 0备份消耗将近1个小时,在数据库中新建一个表空间SQL> create tablespace test datafile '/data/oracle/oradata/justin/test.dbf' size 8g;Tablespace created.
SQL> create table test tablespace test as select * from dba_objects;
Table created.
运行增量备份
RMAN> backup incremental level 1 as compressed backupset database;Starting backup at 08-AUG-11using channel ORA_DISK_1channel ORA_DISK_1: starting compressed incremental level 1 datafile backupsetchannel ORA_DISK_1: specifying datafile(s) in backupset********channel ORA_DISK_1: starting piece 1 at 08-AUG-11channel ORA_DISK_1: finished piece 1 at 08-AUG-11piece handle=/data/oracle/product/10.2/db1/dbs/03mjg62v_1_1 tag=TAG20110808T162255 comment=NONEchannel ORA_DISK_1: backup set complete, elapsed time: 00:17:06channel ORA_DISK_1: starting compressed incremental level 1 datafile backupsetchannel ORA_DISK_1: specifying datafile(s) in backupsetincluding current control file in backupsetchannel ORA_DISK_1: starting piece 1 at 08-AUG-11channel ORA_DISK_1: finished piece 1 at 08-AUG-11piece handle=/data/oracle/product/10.2/db1/dbs/04mjg731_1_1 tag=TAG20110808T162255 comment=NONEchannel ORA_DISK_1: backup set complete, elapsed time: 00:00:01Finished backup at 08-AUG-11新建的表只有2M,但是增量备份仍要17分钟
此时再创建一个表,然后开启block change trackingSQL> create table test2 tablespace test as select * from dba_objects;Table created.
SQL> alter database enable block change tracking using file '/data/oracle/backup/justin/block_track.log';
Database altered.
此时再来一个增量备份RMAN> backup incremental level 1 as compressed backupset database;Starting backup at 08-AUG-11
using channel ORA_DISK_1channel ORA_DISK_1: starting compressed incremental level 1 datafile backupsetchannel ORA_DISK_1: specifying datafile(s) in backupset********channel ORA_DISK_1: starting piece 1 at 08-AUG-11channel ORA_DISK_1: finished piece 1 at 08-AUG-11piece handle=/data/oracle/product/10.2/db1/dbs/05mjg7i1_1_1 tag=TAG20110808T164800 comment=NONEchannel ORA_DISK_1: backup set complete, elapsed time: 00:00:03channel ORA_DISK_1: starting compressed incremental level 1 datafile backupsetchannel ORA_DISK_1: specifying datafile(s) in backupsetincluding current control file in backupsetchannel ORA_DISK_1: starting piece 1 at 08-AUG-11channel ORA_DISK_1: finished piece 1 at 08-AUG-11piece handle=/data/oracle/product/10.2/db1/dbs/06mjg7i4_1_1 tag=TAG20110808T164800 comment=NONEchannel ORA_DISK_1: backup set complete, elapsed time: 00:00:01Finished backup at 08-AUG-11这次相当之快,只需要3秒RAC库开启block change tracking,需要把文件放到共享目录下,否则会创建不成功
SQL> alter database enable block change tracking using file '+DATA/JUSTIN/block_change_tracking.log';Database altered.
接下来部署脚本,每周3做全备,其余时间做增量差异备份
0 03 * * 3 sh /home/oracle/justinscript/rman_level0.sh >> /home/oracle/justinscript/rman_level0.log0 03 * * 0,1,2,4,5,6 sh /home/oracle/justinscript/rman_level1.sh >> /home/oracle/justinscript/rman_level1.log具体脚本如下[oracle@justin ~]$ more /home/oracle/monitor/script/rman_level0.sh . /home/oracle/.bash_profilerman target / @/home/oracle/monitor/script/rman_level0[oracle@justin ~]$ more /home/oracle/monitor/script/rman_level0crosscheck backup; delete obsolete;run{allocate channel d1 type disk maxpiecesize=3g;allocate channel d2 type disk;allocate channel d3 type disk;allocate channel d4 type disk;backup incremental level=0 as compressed backupset database format '/data/oracle/backup/rman/Lv0_%d_%T_%U.bak';release channel d1;release channel d2;release channel d3;release channel d4;}[oracle@justin ~]$ more /home/oracle/monitor/script/rman_level1.sh. /home/oracle/.bash_profilerman target / @/home/oracle/monitor/script/rman_level1[oracle@justin ~]$ more /home/oracle/monitor/script/rman_level1run{allocate channel d1 type disk maxpiecesize=3g;allocate channel d2 type disk;allocate channel d3 type disk;allocate channel d4 type disk;backup incremental level=1 as compressed backupset database format '/data/oracle/backup/rman/Lv1_%d_%T_%U.bak';release channel d1;release channel d2;release channel d3;release channel d4;}来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/15480802/viewspace-704624/,如需转载,请注明出处,否则将追究法律责任。
转载于:http://blog.itpub.net/15480802/viewspace-704624/