非正常关机后 noresetlogs重建控制文件
控制文件中scn来自 最后一次将日志写入磁盘的SCN
SQL> select checkpoint_change# from v$datafile;
CHECKPOINT_CHANGE#
------------------
928548
928548
928548
928548
SQL> select checkpoint_change# from v$datafile_header;
CHECKPOINT_CHANGE#
------------------
928541
928541
928541
928541
SQL> select first_change#,next_change# from v$log;
FIRST_CHANGE# NEXT_CHANGE#
------------- ------------
928545 928548
928541 928545
928548 2.8147E+14
非正常关机后 resetlogs重建控制文件
直接从数据文件中获取
SQL> select checkpoint_change# from v$datafile;
CHECKPOINT_CHANGE#
------------------
928541
928541
928541
928541
SQL> select checkpoint_change# from v$datafile_header;
CHECKPOINT_CHANGE#
------------------
928541
928541
928541
928541
SQL> select first_change#,next_change# from v$log;
FIRST_CHANGE# NEXT_CHANGE#
------------- ------------
0 0
0 0
0 0
、
正常关机 noresetlogs重建控制文件
控制文件中scn来自 最后一次将日志写入磁盘的SCN
SQL> select checkpoint_change# from v$datafile;
CHECKPOINT_CHANGE#
------------------
844990
844990
844990
844990
SQL> select checkpoint_change# from v$datafile_header;
CHECKPOINT_CHANGE#
------------------
844990
844990
844990
844990
SQL> select first_change#,next_change# from v$log;
FIRST_CHANGE# NEXT_CHANGE#
------------- ------------
844758 2.8147E+14 < 844990
844742 844758
844731 844742
正常关机 resetlogs重建控制文件
获取数据文件scn
SQL> select checkpoint_change# from v$datafile_header;
CHECKPOINT_CHANGE#
------------------
845326
845326
845326
845326
SQL> select checkpoint_change# from v$datafile;
CHECKPOINT_CHANGE#
------------------
845326
845326
845326
845326
SQL> select first_change#,next_change# from v$log;
FIRST_CHANGE# NEXT_CHANGE#
------------- ------------
0 0
0 0
0 0