Saturday, April 26, 2008

How to Move the Change Tracking File

A)Losing Contents of the file
-------------------------------------

If you don't bother about the contents of the change tracking file then it is simple to move the change tracking file. If fact if you don't want to shut down your database and yet want to move the change tracking file you will loss the contents of the file.

In this situation just do the following, Disable and Enable change tracking with new file location.

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


B)You do want to loss the contents of the file.
-------------------------------------------------------


1) Find the current name of the change tracking file.

SQL> SELECT filename FROM V$BLOCK_CHANGE_TRACKING;
FILENAME
--------------------------------------------------------------------------------
/oradata2/change_tracking.f

2)Shutdown the Database.

SQL> shutdown immediate;

3)Using OS move the file to new location.

SQL> !mv /oradata2/change_tracking.f /oradata1/moved.f

4)Mount the database and reflect new location in database.

SQL>STARTUP MOUNT;
SQL> alter database rename file '/oradata2/change_tracking.f' to '/oradata1/moved.f';
Database altered.

5)Open the database and Check the location.

SQL> ALTER DATABASE OPEN;
Database altered.
SQL> SELECT filename FROM V$BLOCK_CHANGE_TRACKING;
FILENAME
--------------------------------------------------------------------------------
/oradata1/moved.f

No comments:

Post a Comment