All in Oracle database.

Thursday, August 6, 2009

How to enable block change tracking on Oracle 10g database?

August 6, 2009
   The space of a block change tracking file is about 1/30,000 the size of the database to be tracked.
   For a database with about 1T, the file size less than 50MB.
   This feature of your database can be enabled or disable as you database is open.
1. Enable block change tracking   
   Query the current status of block change tracking on the database.  
   SQL>SELECT STATUS, FILENAME, BYTES/1024/1024 SIZE_M FROM V$BLOCK_CHANGE_TRACKING;
   If the STATUS is DISABLE, then you can issue the following SQL to enable this feature.
   SQL>ALTER DATABASE ENABLE BLOCK CHANGE TRACKING USING FILE 'D:\ORACLE\PRODUCT\10.2.0\ORADATA\SVDB1\BCT.F' REUSE;
   Then, query the V$BLOCK_CHANGE_TRACKING view again.
  
2. Disable block change tracking
   Query the current status of block change tracking on the database.  
   SQL>SELECT STATUS, FILENAME, BYTES/1024/1024 SIZE_M FROM V$BLOCK_CHANGE_TRACKING;
   Issue the following SQL:
   SQL>ALTER DATABASE DISABLE BLOCK CHANGE TRACKING;
   Query the V$BLOCK_CHANGE_TRACKING view again.

3. Change location of block change tracking file
3.1. Change location but losing the content inside block change tracking file     
   Query the current status of block change tracking on the database.  
   SQL>SELECT STATUS, FILENAME, BYTES/1024/1024 SIZE_M FROM V$BLOCK_CHANGE_TRACKING;
   Issue the following SQL:
   SQL>ALTER DATABASE DISABLE BLOCK CHANGE TRACKING;
   SQL>ALTER DATABASE ENABLE BLOCK CHANGE TRACKING USING FILE 'D:\BCT.F' REUSE;
            
3.2. Change location without losing the original block change tracking file
   SQL>shutdown immediate;
   SQL>startup mount;
   Then use OS command, e.g. mv or cp, relocate the block change tracking file, for example,
   OS>move D:\BCT.F D:\ORACLE\PRODUCT\10.2.0\ORADATA\SVDB1\BCT.F
   SQL>alter database rename file 'D:\BCT.F' to 'D:\ORACLE\PRODUCT\10.2.0\ORADATA\SVDB1\BCT.F';
   SQL>alter database open;
   SQL>SELECT STATUS, FILENAME, BYTES/1024/1024 SIZE_M FROM V$BLOCK_CHANGE_TRACKING;
  
   Note: If you do not rename the file after you have moved the block change tracking file to another
   location, as you open the database, Oracle will automatically recreate a new file at the origional
   location, thus, you lose the content of the file.
         So, keep in mind to rename the file prior to opening the database.

No comments:

Post a Comment