Block Change Tracking特性

在制定RMAN备份策略是学习到此特性,特此记录。

“Block chage tracking是Oracle10g的一个新特性,Block change tracking进程记录自从上一次备份以来数据块的变化,并把这些信息记录在跟踪文件中。RMAN使用这个文件判断增量备份中需要备份的变更数据。这极大的促进了备份性能,RMAN可以不再扫描整个文件以查找变更数据。”摘自Eygle博客

究竟Block Change Tracking特性能带来多少效率上的提高呢?通过测试来说明。

启用Block Change Tracking:

 

SQL> alter database enable block change tracking using file '/home/oracle/marshall/rman/rman_bct.trk';
 
Database altered.
 
SQL> select status from v$block_change_tracking;
 
STATUS   
----------    
ENABLED

 

执行增量备份(level 0)

 

RMAN> backup incremental level=0 database;
 
Starting backup at 05-JUL-11   
using channel ORA_DISK_1    
channel ORA_DISK_1: starting incremental level 0 datafile backupset    
channel ORA_DISK_1: specifying datafile(s) in backupset    
input datafile fno=00006 name=/opt/oracle/oradata/perfstat.dbf    
input datafile fno=00001 name=+ASMDG1/john/datafile/system.264.751305067    
input datafile fno=00004 name=+ASMDG1/john/datafile/users.268.751305125    
input datafile fno=00005 name=+ASMDG1/john/datafile/johntest.dbf    
channel ORA_DISK_1: starting piece 1 at 05-JUL-11    
channel ORA_DISK_1: finished piece 1 at 05-JUL-11    
piece handle=+ASMDG1/john/backupset/2011_07_05/nnndn0_tag20110705t155811_0.316.755711893 tag=TAG20110705T155811 comment=NONE    
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:25    
channel ORA_DISK_1: starting incremental level 0 datafile backupset    
channel ORA_DISK_1: specifying datafile(s) in backupset    
input datafile fno=00002 name=+ASMDG1/john/datafile/undotbs1.265.751305089    
channel ORA_DISK_1: starting piece 1 at 05-JUL-11    
channel ORA_DISK_1: finished piece 1 at 05-JUL-11    
piece handle=+ASMDG1/john/backupset/2011_07_05/nnndn0_tag20110705t155811_0.315.755711919 tag=TAG20110705T155811 comment=NONE    
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:55    
channel ORA_DISK_1: starting incremental level 0 datafile backupset    
channel ORA_DISK_1: specifying datafile(s) in backupset    
input datafile fno=00003 name=+ASMDG1/john/datafile/sysaux.266.751305105    
channel ORA_DISK_1: starting piece 1 at 05-JUL-11    
channel ORA_DISK_1: finished piece 1 at 05-JUL-11    
piece handle=+ASMDG1/john/backupset/2011_07_05/nnndn0_tag20110705t155811_0.314.755711973 tag=TAG20110705T155811 comment=NONE    
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:25    
channel ORA_DISK_1: starting incremental level 0 datafile backupset    
channel ORA_DISK_1: specifying datafile(s) in backupset    
including current control file in backupset    
channel ORA_DISK_1: starting piece 1 at 05-JUL-11    
channel ORA_DISK_1: finished piece 1 at 05-JUL-11    
piece handle=+ASMDG1/john/backupset/2011_07_05/ncnnn0_tag20110705t155811_0.313.755711999 tag=TAG20110705T155811 comment=NONE    
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:04    
Finished backup at 05-JUL-11

 

执行增量备份(level 1,Block Change Tracking = enabled),共耗时25秒左右。

 

RMAN> backup incremental level=1 database;
 
Starting backup at 05-JUL-11   
using channel ORA_DISK_1    
channel ORA_DISK_1: starting incremental level 1 datafile backupset    
channel ORA_DISK_1: specifying datafile(s) in backupset    
input datafile fno=00006 name=/opt/oracle/oradata/perfstat.dbf    
input datafile fno=00001 name=+ASMDG1/john/datafile/system.264.751305067    
input datafile fno=00004 name=+ASMDG1/john/datafile/users.268.751305125    
input datafile fno=00005 name=+ASMDG1/john/datafile/johntest.dbf    
channel ORA_DISK_1: starting piece 1 at 05-JUL-11    
channel ORA_DISK_1: finished piece 1 at 05-JUL-11    
piece handle=+ASMDG1/john/backupset/2011_07_05/nnndn1_tag20110705t160120_0.312.755712083 tag=TAG20110705T160120 comment=NONE    
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:07    
channel ORA_DISK_1: starting incremental level 1 datafile backupset    
channel ORA_DISK_1: specifying datafile(s) in backupset    
input datafile fno=00002 name=+ASMDG1/john/datafile/undotbs1.265.751305089    
channel ORA_DISK_1: starting piece 1 at 05-JUL-11    
channel ORA_DISK_1: finished piece 1 at 05-JUL-11    
piece handle=+ASMDG1/john/backupset/2011_07_05/nnndn1_tag20110705t160120_0.311.755712089 tag=TAG20110705T160120 comment=NONE    
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:07    
channel ORA_DISK_1: starting incremental level 1 datafile backupset    
channel ORA_DISK_1: specifying datafile(s) in backupset    
input datafile fno=00003 name=+ASMDG1/john/datafile/sysaux.266.751305105    
channel ORA_DISK_1: starting piece 1 at 05-JUL-11    
channel ORA_DISK_1: finished piece 1 at 05-JUL-11    
piece handle=+ASMDG1/john/backupset/2011_07_05/nnndn1_tag20110705t160120_0.310.755712097 tag=TAG20110705T160120 comment=NONE    
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:07    
channel ORA_DISK_1: starting incremental level 1 datafile backupset    
channel ORA_DISK_1: specifying datafile(s) in backupset    
including current control file in backupset    
channel ORA_DISK_1: starting piece 1 at 05-JUL-11    
channel ORA_DISK_1: finished piece 1 at 05-JUL-11    
piece handle=+ASMDG1/john/backupset/2011_07_05/ncnnn1_tag20110705t160120_0.309.755712105 tag=TAG20110705T160120 comment=NONE    
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:04    
Finished backup at 05-JUL-11

 

关闭Block Change Tracking:

 

SQL> alter database disable block change tracking;
 
Database altered.
 
SQL> select status from v$block_change_tracking;
 
STATUS   
----------    
DISABLED

 

执行增量备份(level 1,Block Change Tracking = disabled),共耗时69秒左右。

 

RMAN> backup incremental level=1 database;
 
Starting backup at 05-JUL-11   
using channel ORA_DISK_1    
channel ORA_DISK_1: starting incremental level 1 datafile backupset    
channel ORA_DISK_1: specifying datafile(s) in backupset    
input datafile fno=00006 name=/opt/oracle/oradata/perfstat.dbf    
input datafile fno=00001 name=+ASMDG1/john/datafile/system.264.751305067    
input datafile fno=00004 name=+ASMDG1/john/datafile/users.268.751305125    
input datafile fno=00005 name=+ASMDG1/john/datafile/johntest.dbf    
channel ORA_DISK_1: starting piece 1 at 05-JUL-11    
channel ORA_DISK_1: finished piece 1 at 05-JUL-11    
piece handle=+ASMDG1/john/backupset/2011_07_05/nnndn1_tag20110705t160253_0.308.755712175 tag=TAG20110705T160253 comment=NONE    
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:25    
channel ORA_DISK_1: starting incremental level 1 datafile backupset    
channel ORA_DISK_1: specifying datafile(s) in backupset    
input datafile fno=00002 name=+ASMDG1/john/datafile/undotbs1.265.751305089    
channel ORA_DISK_1: starting piece 1 at 05-JUL-11    
channel ORA_DISK_1: finished piece 1 at 05-JUL-11    
piece handle=+ASMDG1/john/backupset/2011_07_05/nnndn1_tag20110705t160253_0.307.755712199 tag=TAG20110705T160253 comment=NONE    
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:25    
channel ORA_DISK_1: starting incremental level 1 datafile backupset    
channel ORA_DISK_1: specifying datafile(s) in backupset    
input datafile fno=00003 name=+ASMDG1/john/datafile/sysaux.266.751305105    
channel ORA_DISK_1: starting piece 1 at 05-JUL-11    
channel ORA_DISK_1: finished piece 1 at 05-JUL-11    
piece handle=+ASMDG1/john/backupset/2011_07_05/nnndn1_tag20110705t160253_0.306.755712225 tag=TAG20110705T160253 comment=NONE    
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:15    
channel ORA_DISK_1: starting incremental level 1 datafile backupset    
channel ORA_DISK_1: specifying datafile(s) in backupset    
including current control file in backupset    
channel ORA_DISK_1: starting piece 1 at 05-JUL-11    
channel ORA_DISK_1: finished piece 1 at 05-JUL-11    
piece handle=+ASMDG1/john/backupset/2011_07_05/ncnnn1_tag20110705t160253_0.305.755712241 tag=TAG20110705T160253 comment=NONE    
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:04    
Finished backup at 05-JUL-11

 

由上面统计来看,在开启Block Change Tracking特性后,执行Level=1的增量备份时间更短。

需要记住的几个命令:

开启Block Change Tracking:(在使用OMF特性的情况下不用指定跟踪文件)

alter database enable block change tracking using file '/home/oracle/marshall/rman/rman_bct.trk';

关闭:Block Change Tracking:

alter database disable block change tracking;

查看Block Change Tracking是否开启:

select status from v$block_change_tracking;

参考文献:

盖国强(eygle):启用Block Change Tracking-10g新特性

三思:10g中的块修改跟踪特性(Block Change Tracking)

  1. 两次level 1备份时,改变的block数无法保证相等,所以测试结果可能不准确。不过我想这样的测试数据也基本可以说明问题。

  2. 在使用OMF特性的情况下,跟踪文件保存在哪里?在RAC环境下跟踪文件的管理与archivelog一样?

普人特福的博客cnzz&51la for wordpress,cnzz for wordpress,51la for wordpress