Wednesday, February 21, 2007

Block change tracking in Oracle10

The time needed to create a RMAN incremental backup can be decreased by using the Block Change Tracking (BCT). When BCT is activated, Oracle doesn't have to scan all blocks in datafiles to determine whether a datablock has been changed. Information about changed datablocks are written to an external file.

To activate the recording of Block change tracking, execute the following command:

alter database enable block change tracking
using file ‘/u01/oradata/orcl/change_tracking.f’;

Is the file already exists, the REUSE-clause can be added to the command.

When the OMF-option is used, Oracle will automatically create and name the BCT-file:

alter database enable block change tracking;

The BCT-mode can be disabled by:

alter database disable block change tracking;

The BCT-file will also be deleted by this command.

Information about the BCT-mode can be found in the view

desc v$block_change_tracking
Name Null? Type
------------------- -------------- ------------------
STATUS VARCHAR2(10)
FILENAME VARCHAR2(513)
BYTES NUMBER

The percentage of blocks read for an incremental backup can be determined by issuing the following query:

select file#,
avg(datafile_blocks),
avg(blocks_read),
avg(blocks_read/datafile_blocks) * 100 as “% read for backup”
from v$backup_datafile
where incremental_level > 0
and used_change_tracking = ‘YES’
group by file#
order by file#;

When the BCT-mode is activated or deactivated, a message is written to the alert.log file. The tracking file can be renamed by 'alter database rename file'-command. The BCT-file cannot be backuped by using RMAN.

No comments: