Search This Blog

Thursday, May 13, 2021

Block Change Tracking

To check the current status of block change tracking:

set linesize 200
col filename for a50
select * from v$block_change_tracking;

select filename from v$block_change_tracking;

To check the same at OS level:

CTWR = Change Track Writer

is the background process responsible for tracking the blocks.

ps -eaf|grep ctwr

[oracle@m1 bkptrc]$ ps -eaf|grep ctwr
oracle    7809     1  0 11:57 ?        00:00:00 ora_ctwr_prod
oracle    8396  5621  0 11:59 pts/1    00:00:00 grep ctwr

(block change tracking will start a process called ctwr)

To enable the block change tracking file in our selected location:

$mkdir /u01/prod/bkptrc

alter database enable block change tracking using file '/u01/prod/bkptrc/bkptrc.trc';

To enable the block change tracking in database area:

set  this parameter to database area: DB_CREATE_FILE_DEST
then issue the following SQL statement to enable change tracking:

alter database enable block change tracking;

To confirm the change

$ll /u01/prod/bkptrc

select * from v$block_change_tracking;

If the same name old file exists and we want to overight it, add reuse in the end:

alter database enable block change tracking using file '/u01/prod/bkptrc/bkptrc.trc' reuse;

To disable block change tracking:

alter database disable block change tracking;

(the file will be deleted and also the ctwr process will be gone)

Moving or relocating the file if we can bounce back the database:

select filename from v$block_change_tracking;

shutdown immediate;

at OS level move the tracking file to new location.

startup mount;

alter database rename file '/u01/prod/bkptrc/bkptrc.trc' to '/u01/new/bkptrc.trc';

alter database open;

Moving or relocating the file if we can't restart the database:

In this case we can disable current file and re-enable with new location.

alter database disable block change tracking;
alter database enable block change tracking using file '/u01/new/bkptrc.trc';


No comments:

Post a Comment