Wednesday 27 April 2016

Oracle Block Change Tracking



RMAN block change tracking

With Oracle 10gr1 Enterprise Edition Oracle introduce Block change tracking feature which is used to Speed up RMAN Incremental Backup.


What is BLOCK CHANGE TRACKING?


RMAN's change tracking feature for incremental backups improves incremental backup performance by recording changed blocks in each datafile in a change tracking file. If change tracking is enabled, RMAN uses the change tracking file to identify changed blocks for incremental backup, thus avoiding the need to scan every block in the datafile.

After enabling change tracking, the first level 0 incremental backup still has to scan the entire datafile, as the change tracking file does not yet reflect the status of the blocks. Subsequent incremental backup that use this level 0 as parent will take advantage of the change tracking file.

Source: Oracle documentation

1) To  Enable Block Change tracking and set location

Before enabling we must to set/specify block change tracking location.There is two way to specify block change tracking location
1. using DB_CREATE_FILE_DEST parameter which use OMF file name.

SQL> alter system set db_create_file_dest='location' SCOPE=BOTH;
SQL> alter database enable block change tracking;

OR

2. Manually specify location for the block change tracking
SQL>alter database enable block change tracking using file 'location';

2) To Disable block change tracking

SQL> alter database disable block change tracking;

NOTE: BCT files deleted automatically by oracle when BCT is disabled.


3) To Reset the location of Block change tracking file

There are two options for this

1. shutdown the database and set the new location

SQL> shutdown database

--Now Move BCT file to new location using OS command ‘mv’

SQL> startup mount

SQL> alter database rename file 'old_location' TO 'new_location';

SQL> alter database open;

OR

Follow these step –
Disable the block change tracking , then set the new location, then enable BCT

SQL> alter database DISABLE block change tracking;

SQL> alter database enable block change tracking using FILE  'NEW_LOCATION';

After these,  RMAN use new location for the BCT.


4) To Check the information about block change tracking STATUS - enable or disabled

Check v$BLOCK_CHANGE_TRACKING view

5). Does BCT file is important for restore and recovery of database.. ?
Answer: No, it is doesn't require for Database Recovery of database

6). What happen if BCT file is lost or corrupted..?
Answer: That is very interesting case here, suppose oracle found if BCT file is corrupted or missing then oracle will automatically recreate new BCT file.

Let see some practical view...

Assume that, BCT file lost or missing :

SQL> shutdown immediate;

Database closed.
Database dismounted.
ORACLE instance shut down.

SQL> host rm /u01/block/bct.dbf

SQL> startup

ORACLE instance started.
Database mounted.
Database opened.

Now check the alertlog file for more information about how oracle create new BCT file when missing or lost.

Alertlog file :

Mon Feb 28 18:25:47 2016
ALTER DATABASE OPEN
CHANGE TRACKING is enabled for this database, but the
change tracking file can not be found. Recreating the file.
Change tracking file recreated.
Block change tracking file is current.

No comments:

Post a Comment