关于v$backup_redolog中next_change#列
next_change#列实际上就是下一个日志序列号的first_change#。
在rac环境(假设是两个节点的rac)中进行recover时,
需要在每个thread中选择出日志序列号最大的那个日志序列号,
然后在这两个日志序列号之间进行比较,比较的依据是next_change#,选择较小的那个next_change#作为recover的终点,比如如下的例子:
SQL> select max(sequence#) from v$archived_log L, v$database D
where L.resetlogs_change# = D.resetlogs_change# and thread#=1;
MAX(SEQUENCE#)
--------------
25 ----------->thread# 1的已经归档的最大日志序列号是25
SQL> select max(sequence#) from v$archived_log L, v$database D
where L.resetlogs_change# = D.resetlogs_change# and thread#=2;
MAX(SEQUENCE#)
--------------
13 ----------->thread# 2的已经归档的最大日志序列号是13
SQL> select sequence#, thread#, first_change#, next_change#
from v$archived_log L, v$database D
where L.resetlogs_change# = D.resetlogs_change# and
sequence# in (13,25);
SEQUENCE# THREAD# FIRST_CHANGE# NEXT_CHANGE#
-------------------- -------------- ------------------------- -------------------------
25 1 1744432 1744802
13 2 1744429 1744805
SQL> select sequence#, thread#, first_change#, next_change#
from v$backup_redolog
where sequence# in (13,25);
SEQUENCE# THREAD# FIRST_CHANGE# NEXT_CHANGE#
-------------------- -------------- ------------------------- -------------------------
25 1 1744432 1744802
13 2 1744429 1744805
由于1744802<1744805,因此 recover的终点是thread# 1的最大日志序列号25,也就是:
SET UNTIL SEQUENCE 26 THREAD 1;
如上摘自:
HowTo Restore RMAN Disk backups of RAC Database to Single Instance On Another Node (文档 ID 415579.1)