Block Change Tracking

Block changing tracking improves the performance of incremental backups by recording changed blocks in the block change tracking file. During an incremental backup, instead of scanning all data blocks to identify which blocks have changed, RMAN uses this file to identify the changed blocks that need to be backed up.

Block change tracking can be enabled being the database open or mounted. To check if is already enabled.

SQL> select status, filename from V$BLOCK_CHANGE_TRACKING

STATUS     FILENAME
---------- --------------------------------------------------
DISABLED

SQL>

To enable it, first we have to determine the current location of the database datafiles (recommended use OMF)

[IMPRDB2@labo1234 ~]$ rman

Recovery Manager: Release 12.2.0.1.0 - Production on Mon Apr 22 10:16:27 2019

Copyright (c) 1982, 2017, Oracle and/or its affiliates.  All rights reserved.

RMAN> connect target /

connected to target database: IMPRDB (DBID=1068866193)

RMAN> select name from v$datafile;

using target database control file instead of recovery catalog

NAME
--------------------------------------------------------------------------------
+DGDATA/IMPRDB/datafile/system.259.947046933
+DGDATA/IMPRDB/datafile/sysaux.260.947046935
+DGDATA/IMPRDB/datafile/undotbs1.261.947046935
+DGDATA/IMPRDB/datafile/undotbs2.263.947046939
+DGDATA/IMPRDB/datafile/users.264.947046939
+DGDATA/IMPRDB/datafile/audit_tbs.268.947049349
+DGDATA/IMPRDB/datafile/comun.269.947049349
+DGDATA/IMPRDB/datafile/comun.270.947049365
+DGDATA/IMPRDB/datafile/dbspiocr_dat.271.947049379
+DGDATA/IMPRDB/datafile/lbj.272.947049379
+DGDATA/IMPRDB/datafile/lbj.273.947049397
...

Enable BCT

SQL> alter database enable block change tracking  using file '+DGDATA/IMPRDB/datafile/bct.dbf';

Database altered.

SQL>

Estimating the size of the change tracking file

SQL> SELECT FILE#, INCREMENTAL_LEVEL, COMPLETION_TIME, BLOCKS, DATAFILE_BLOCKS FROM V$BACKUP_DATAFILE WHERE INCREMENTAL_LEVEL > 0 AND BLOCKS / DATAFILE_BLOCKS > .5 ORDER BY COMPLETION_TIME;

     FILE# INCREMENTAL_LEVEL COMPLETIO     BLOCKS DATAFILE_BLOCKS
---------- ----------------- --------- ---------- ---------------
       147                 1 12-APR-19      90007          131072
       147                 1 15-APR-19     113872          131072
       194                 1 15-APR-19     771200         1310720
       147                 1 16-APR-19      92063          131072
       147                 1 17-APR-19      91556          131072
       282                 1 17-APR-19       8319           12800
       147                 1 18-APR-19      90355          131072
       147                 1 19-APR-19      89833          131072

8 rows selected.

SQL>

Note that when you enable this feature you could check there is a new oracle process called “ora_ctwr_mydbname”. In this example:

[IMPRDB2@labo1234 ~]$ ps -ef | grep ctwr
oracle    4796     1  0 16:07 ?        00:00:00 ora_ctwr_IMPRDB

Note also that if you enable the block change tracking feature, RMAN can refer to the change tracking file to identify changed blocks in datafiles without scanning the full contents of the datafile. Once enabled, block change tracking does not alter how you take or use incremental backups, other than offering increased performance.

A level 1 incremental backup can be either of the following types:

A differential backup, which backs up all blocks changed after the most recent incremental backup at level 1 or 0
A cumulative backup, which backs up all blocks changed after the most recent incremental backup at level 0

Incremental backups are differential by default.

Cumulative backups are preferable to differential backups when recovery time is more important than disk space, because during recovery each differential backup must be applied in succession. Use cumulative incremental backups instead of differential, if enough disk space is available to store cumulative incremental backups.