ITPub博客

首页 > 数据库 > Oracle > 重做日志文件中的SCN

重做日志文件中的SCN

原创 Oracle 作者:passion_of_data 时间:2011-07-13 17:32:33 0 删除 编辑

            重做日志文件中的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/,如需转载,请注明出处,否则将追究法律责任。

请登录后发表评论 登录
全部评论
DBA

注册时间:2011-06-20

  • 博文量
    53
  • 访问量
    308272