重做日誌檔案中的SCN

passion_of_data發表於2011-07-13

            重做日誌檔案中的SCN

日誌檔案頭中包含LOW SCNNEXT SCN

LOW SCNNEXT SCN表示改日誌檔案中包含在LOW SCNNEXT SCN之間的重做資訊。對於當前重做日誌來說,NEXT SCN為無窮大,即ffffffff,因為最終的SCN是個未知數。

下面就看一下日誌檔案中的SCN

SQL> select * from v$log;

    GROUP#    THREAD#  SEQUENCE#      BYTES    MEMBERS ARC STATUS
---------- ---------- ---------- ---------- ---------- --- ----------------
FIRST_CHANGE# FIRST_TIME
------------- --------------
         1          1        141   52428800          1 YES INACTIVE
      6043116 13-7
-11

         2          1        142   52428800          1 NO  CURRENT
      6043132 13-7
-11

         3          1        139   52428800          1 YES INACTIVE
      6022046 12-7
-11


    GROUP#    THREAD#  SEQUENCE#      BYTES    MEMBERS ARC STATUS
---------- ---------- ---------- ---------- ---------- --- ----------------
FIRST_CHANGE# FIRST_TIME
------------- --------------
         4          1        140   52428800          1 YES INACTIVE
      6042663 13-7
-11


SQL> select dbms_flashback.get_system_change_number from dual;

GET_SYSTEM_CHANGE_NUMBER
------------------------
                 6057820

由上可以看出當前日誌組2LOW SCN6043132DUMP當前日誌檔案,然後在檢視TRC如下:

SQL> select member from v$logfile where group# = 2;

 

MEMBER

--------------------------------------------------------------------------------

D:\ORACLE\PRODUCT\10.2.0\ORADATA\WEIBIN\REDO02.LOG

 

SQL> alter system dump logfile 'D:\ORACLE\PRODUCT\10.2.0\ORADATA\WEIBIN\REDO02.LOG';

 

系統已更改。

 

檢視TRC:

DUMP OF REDO FROM FILE 'D:\ORACLE\PRODUCT\10.2.0\ORADATA\WEIBIN\REDO02.LOG'

 Opcodes *.*

 RBAs: 0x000000.00000000.0000 thru 0xffffffff.ffffffff.ffff

 SCNs: scn: 0x0000.00000000 thru scn: 0xffff.ffffffff

 Times: creation thru eternity

 FILE HEADER:

         Compatibility Vsn = 169870080=0xa200300

         Db ID=4184897545=0xf9707809, Db Name='WEIBIN'

         Activation ID=4203641025=0xfa8e78c1

         Control Seq=7208=0x1c28, File size=102400=0x19000

         File Number=2, Blksiz=512, File Type=2 LOG

 descrip:"Thread 0001, Seq# 0000000142, SCN 0x0000005c35fc-0xffffffffffff"

 thread: 1 nab: 0xffffffff seq: 0x0000008e hws: 0x1 eot: 1 dis: 0

 resetlogs count: 0x2cad510c scn: 0x0000.001489a6 (1345958)

 resetlogs terminal rcv count: 0x0 scn: 0x0000.00000000

 prev resetlogs count: 0x2b8f370b scn: 0x0000.00089c75 (564341)

 prev resetlogs terminal rcv count: 0x0 scn: 0x0000.00000000

 Low  scn: 0x0000.005c35fc (6043132) 07/13/2011 08:39:53

 Next scn: 0xffff.ffffffff 01/01/1988 00:00:00

 Enabled scn: 0x0000.001489a6 (1345958) 04/27/2011 09:59:40

 

SQL> alter system switch logfile;

 

系統已更改。

 

SQL> select * from v$log;

 

    GROUP#    THREAD#  SEQUENCE#      BYTES    MEMBERS ARC STATUS

---------- ---------- ---------- ---------- ---------- --- ----------------

FIRST_CHANGE# FIRST_TIME

------------- --------------

         1          1        141   52428800          1 YES INACTIVE

      6043116 13-7 -11

 

         2          1        142   52428800          1 YES ACTIVE

      6043132 13-7 -11

 

         3          1        143   52428800          1 NO  CURRENT

      6058893 13-7 -11

 

 

    GROUP#    THREAD#  SEQUENCE#      BYTES    MEMBERS ARC STATUS

---------- ---------- ---------- ---------- ---------- --- ----------------

FIRST_CHANGE# FIRST_TIME

------------- --------------

         4          1        140   52428800          1 YES INACTIVE

      6042663 13-7 -11

 

SQL> alter system dump logfile 'D:\ORACLE\PRODUCT\10.2.0\ORADATA\WEIBIN\REDO02.LOG';

 

系統已更改。

 

 

檢視TRC:

DUMP OF REDO FROM FILE 'D:\ORACLE\PRODUCT\10.2.0\ORADATA\WEIBIN\REDO02.LOG'

 Opcodes *.*

 RBAs: 0x000000.00000000.0000 thru 0xffffffff.ffffffff.ffff

 SCNs: scn: 0x0000.00000000 thru scn: 0xffff.ffffffff

 Times: creation thru eternity

 FILE HEADER:

         Compatibility Vsn = 169870080=0xa200300

         Db ID=4184897545=0xf9707809, Db Name='WEIBIN'

         Activation ID=4203641025=0xfa8e78c1

         Control Seq=7293=0x1c7d, File size=102400=0x19000

         File Number=2, Blksiz=512, File Type=2 LOG

 descrip:"Thread 0001, Seq# 0000000142, SCN 0x0000005c35fc-0x0000005c738d"

 thread: 1 nab: 0x639b seq: 0x0000008e hws: 0x2 eot: 0 dis: 0

 resetlogs count: 0x2cad510c scn: 0x0000.001489a6 (1345958)

 resetlogs terminal rcv count: 0x0 scn: 0x0000.00000000

 prev resetlogs count: 0x2b8f370b scn: 0x0000.00089c75 (564341)

 prev resetlogs terminal rcv count: 0x0 scn: 0x0000.00000000

 Low  scn: 0x0000.005c35fc (6043132) 07/13/2011 08:39:53

 Next scn: 0x0000.005c738d (6058893) 07/13/2011 15:19:39

 

從以上紅色部分我們可以注意到LOG FILE2LOW SCN6043132NEXT SCN6058893我們可以知道LOGFILE2包含SCN介於60431326058893之間的重做資訊。我們之前查出的當前SCN(6057820)也包括在LOGFILE2中。

來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/25964700/viewspace-702117/,如需轉載,請註明出處,否則將追究法律責任。

相關文章