Enabling and Disabling Block Change Tracking

posted Sep 17, 2010, 7:54 AM by Sachchida Ojha
ou can enable block change tracking when the database is either open or mounted. This section assumes that you intend to create the block change tracking file as an Oracle Managed File in the database area, which is where the database maintains active database files such as datafiles, control files, and online redo log files. See "Overview of the Fast Recovery Area" to learn about the database area and fast recovery area.

To enable block change tracking:

   1.  Start SQL*Plus and connect to a target database with administrator privileges.
   2.  Ensure that the DB_CREATE_FILE_DEST initialization parameter is set.

      SHOW PARAMETER DB_CREATE_FILE_DEST

      If the parameter is not set, and if the database is open, then you can set the parameter with the following form of the ALTER SYSTEM statement:

      ALTER SYSTEM SET
        DB_CREATE_FILE_DEST = '/disk1/bct/'
        SCOPE=BOTH SID='*';

   3.  Enable block change tracking.

      Execute the following ALTER DATABASE statement:

      ALTER DATABASE ENABLE BLOCK CHANGE TRACKING;

      You can also create the change tracking file in a location that you choose yourself by using the following form of SQL statement:

      ALTER DATABASE ENABLE BLOCK CHANGE TRACKING
        USING FILE '/mydir/rman_change_track.f' REUSE;

      The REUSE option tells Oracle Database to overwrite any existing block change tracking file with the specified name.

Disabling Block Change Tracking

This section assumes that the block change tracking feature is currently enabled. When you disable block change tracking, the database removes the block change tracking file from the operating system.

To disable block change tracking:

   1.  Start SQL*Plus and connect to a target database with administrator privileges.
   2.  Ensure that the target database is mounted or open.
   3.  Disable block change tracking.

      Execute the following ALTER DATABASE statement:

      ALTER DATABASE DISABLE BLOCK CHANGE TRACKING;

Checking Whether Change Tracking is Enabled

You can query the V$BLOCK_CHANGE_TRACKING view to determine whether change tracking is enabled, and if it is, the filename of the block change tracking file.

To determine whether change tracking is enabled:

Enter the following query in SQL*Plus (sample output included):

COL STATUS   FORMAT A8
COL FILENAME FORMAT A60
 
SELECT STATUS, FILENAME
FROM   V$BLOCK_CHANGE_TRACKING;

STATUS   FILENAME
-------- ------------------------------------------------------------
ENABLED  /disk1/bct/RDBMS/changetracking/o1_mf_2f71np5j_.chg

Changing the Location of the Block Change Tracking File

To move the change tracking file, use the ALTER DATABASE RENAME FILE statement. The database must be mounted. The statement updates the control file to refer to the new location and preserves the contents of the change tracking file. If you cannot shut down the database, then you can disable and enable block change tracking. In this case, you lose the contents of the existing block change tracking file.

To change the location of the change tracking file:

   1.  Start SQL*Plus and connect to a target database.
   2.  If necessary, determine the current name of the change tracking file:

      SQL> SELECT FILENAME FROM V$BLOCK_CHANGE_TRACKING;

   3.   If possible, shut down the database. For example:

      SQL> SHUTDOWN IMMEDIATE

      If you shut down the database, then skip to the next step. If you choose not to shut down the database, then execute the following SQL statements and skip all remaining steps:

      SQL> ALTER DATABASE DISABLE BLOCK CHANGE TRACKING;
      SQL> ALTER DATABASE ENABLE BLOCK CHANGE TRACKING USING FILE 'new_location';

      In this case you lose the contents of the block change tracking file. Until the next time you complete a level 0 incremental backup, RMAN must scan the entire file.
   4.  Using host operating system commands, move the change tracking file to its new location.
   5.  Mount the database and move the change tracking file to a location that has more space. For example:

      ALTER DATABASE RENAME FILE
         '/disk1/bct/RDBMS/changetracking/o1_mf_2f71np5j_.chg' TO
         '/disk2/bct/RDBMS/changetracking/o1_mf_2f71np5j_.chg';

      This statement changes the location of the change tracking file while preserving its contents.
   6.    Open the database:

      SQL> ALTER DATABASE OPEN;
Comments