块跟踪简要操作

文章目录

  • 概述
  • 1.查询状态
  • 2.开启
  • 3.更改路径
    • 3.1 mount状态下rename
    • 3.2 open状态下重新开启

概述

块跟踪默认是禁用的,如果启用了增量备份,建议开启块跟踪。
块跟踪文件的大小与数据文件的数量有关,但是都比较小。

1.查询状态

SYS@regan> select * from v$block_change_tracking;

STATUS     FILENAME                                      BYTES     CON_ID
---------- ---------------------------------------- ---------- ----------
DISABLED

2.开启

SYS@regan> alter database enable block change tracking using file '/u01/rman/track.log';

Database altered.

SYS@regan> select * from v$block_change_tracking;

STATUS     FILENAME                                      BYTES     CON_ID
---------- ---------------------------------------- ---------- ----------
ENABLED    /u01/rman/track.log                        11599872          0

SYS@regan> !ls -l /u01/rman/track.log
-rw-r-----. 1 oracle oinstall 11600384 Aug  7 14:02 /u01/rman/track.log

3.更改路径

3.1 mount状态下rename

SYS@regan> shutdown immediate
Database closed.
Database dismounted.
ORACLE instance shut down.

SYS@regan> !mv /u01/rman/track.log /u01/rman/trc.log

SYS@regan> !ls -l /u01/rman/
total 11332
-rw-r-----. 1 oracle oinstall 11600384 Aug  7 14:10 trc.log

SYS@regan> startup mount
ORA-32004: obsolete or deprecated parameter(s) specified for RDBMS instance
ORACLE instance started.

Total System Global Area 2483025656 bytes
Fixed Size                  8660728 bytes
Variable Size             671088640 bytes
Database Buffers         1795162112 bytes
Redo Buffers                8114176 bytes
Database mounted.
SYS@regan> select * from v$block_change_tracking;
select * from v$block_change_tracking
              *
ERROR at line 1:
ORA-19755: could not open change tracking file
ORA-19750: change tracking file: '/u01/rman/track.log'
ORA-27037: unable to obtain file status
Linux-x86_64 Error: 2: No such file or directory
Additional information: 7

SYS@regan> alter database open;
--这种情况下虽然文件不存在,但是如果相关目录有权限,就能打开数据库。但是会新建一个跟踪文件。如果这个目录缺少权限,则会报错而无法启动数据库。
Database altered.

SYS@regan> select * from v$block_change_tracking;

STATUS     FILENAME                                      BYTES     CON_ID
---------- ---------------------------------------- ---------- ----------
ENABLED    /u01/rman/track.log                        11599872          0

SYS@regan> !ls -l /u01/rman/
total 22664
-rw-r-----. 1 oracle oinstall 11600384 Aug  7 14:12 track.log
-rw-r-----. 1 oracle oinstall 11600384 Aug  7 14:10 trc.log

SYS@regan> shutdown immediate
Database closed.
Database dismounted.
ORACLE instance shut down.
SYS@regan> startup mount
ORA-32004: obsolete or deprecated parameter(s) specified for RDBMS instance
ORACLE instance started.

Total System Global Area 2483025656 bytes
Fixed Size                  8660728 bytes
Variable Size             671088640 bytes
Database Buffers         1795162112 bytes
Redo Buffers                8114176 bytes
Database mounted.
SYS@regan> !rm /u01/rman/trc.log

以下重新开始更改路径操作

SYS@regan> !mv /u01/rman/track.log /u01/rman/trc.log

SYS@regan> alter database rename file '/u01/rman/track.log' to '/u01/rman/trc.log';

Database altered.

SYS@regan> select * from v$block_change_tracking;

STATUS     FILENAME                                      BYTES     CON_ID
---------- ---------------------------------------- ---------- ----------
ENABLED    /u01/rman/trc.log                          11599872          0

SYS@regan> alter database open;

Database altered.

SYS@regan> !ls -l /u01/rman
total 11332
-rw-r-----. 1 oracle oinstall 11600384 Aug  7 14:15 trc.log

3.2 open状态下重新开启

SYS@regan> alter database disable block change tracking;

Database altered.

SYS@regan> alter database enable block change tracking using file '/u01/rman/track.log';

Database altered.

SYS@regan> select * from v$block_change_tracking;

STATUS     FILENAME                                      BYTES     CON_ID
---------- ---------------------------------------- ---------- ----------
ENABLED    /u01/rman/track.log                        11599872          0

SYS@regan> !ls -l /u01/rman
total 11332
-rw-r-----. 1 oracle oinstall 11600384 Aug  7 14:21 track.log

你可能感兴趣的:(oracle)