oracle日誌檔案頭轉儲說明

selectshen發表於2016-02-25
#環境
os:centos 6.6 x64
db version:11.2.0.4.0

#轉儲日誌檔案頭
[oracle@ct6605 trace]$ sqlplus / as sysdba

#可以使用alter session set events 'immediate trace name redohdr level 3';或oradebug dump redohdr 3
SQL> oradebug setmypid
SQL> oradebug dump redohdr 3

#顯示日誌檔案1的轉儲內容
[oracle@ct6605 ~]$ cd /u01/app/oracle/diag/rdbms/ct66/ct66/trace
#可以透過上面sqlplus中的spid或ll -rth排序來確定是那個檔案
[oracle@ct6605 trace]$ vi ct66_ora_11961.trc
#以下只顯示日誌檔案1的dump內容
*** 2016-02-19 17:20:11.713
Processing Oradebug command 'dump redohdr 3'
DUMP OF LOG FILES: 3 logs in database
LOG FILE #1:
  name #3: /u02/oradata/ct66/redo01.log
 Thread 1 redo log links: forward: 2 backward: 0
 siz: 0x19000 seq: 0x00000073 hws: 0x2 bsz: 512 nab: 0x1475b flg: 0x1 dup: 1
 Archive links: fwrd: 0 back: 0 Prev scn: 0x0000.001bb2c2
 Low scn: 0x0000.001c3a88 02/17/2016 17:00:02
 Next scn: 0x0000.001cabb9 02/18/2016 08:00:41
 FILE HEADER:
        Compatibility Vsn = 186647552=0xb200400
        Db ID=665652355=0x27ad0c83, Db Name='CT66'
        Activation ID=665633411=0x27acc283
        Control Seq=12547=0x3103, File size=102400=0x19000
        File Number=1, Blksiz=512, File Type=2 LOG
 Format ID is 2
 redo log key is 7351dbeee7c4147ec4b415531765bd
 redo log key flag is 5
 descrip:"Thread 0001, Seq# 0000000115, SCN 0x0000001c3a88-0x0000001cabb9"
 thread: 1 nab: 0x1475b seq: 0x00000073 hws: 0x2 eot: 0 dis: 0
 reset logs count: 0x35a3af03 scn: 0x0000.000e2006
 Low scn: 0x0000.001c3a88 02/17/2016 17:00:02
 Next scn: 0x0000.001cabb9 02/18/2016 08:00:41
 Enabled scn: 0x0000.000e2006 12/31/2015 17:40:19
 Thread closed scn: 0x0000.001c3a88 02/17/2016 17:00:02
 Disk cksum: 0x568e Calc cksum: 0x568e
 Terminal Recovery Stop scn: 0x0000.00000000
 Terminal Recovery Stamp  01/01/1988 00:00:00
 Most recent redo scn: 0x0000.00000000
 Largest LWN: 1728 blocks
 Miscellaneous flags: 0x800000
 Thread internal enable indicator: thr: 0, seq: 0 scn: 0x0000.00000000
 Zero blocks: 8
 Enabled redo threads: 1

#解釋:
*** 2016-02-19 17:20:11.713
Processing Oradebug command 'dump redohdr 3'
DUMP OF LOG FILES: 3 logs in database

#來自於控制檔案
 #LOG FILE #1是日誌檔案組號
 LOG FILE #1:
 #name #是redo log檔案位置
  name #3: /u02/oradata/ct66/redo01.log
 #Thread 1是日誌組所屬的執行緒號
 #links:forward,backward是下一個和上一個日誌檔案組
 Thread 1 redo log links: forward: 2 backward: 0
 #siz是0x19000=102400是日誌檔案的大小,單位是塊,單位塊大小是512
 #seq是日誌檔案的順序號
 #hws是The header write sequence number. The header write sequence number is advanced when rewriting the file header to aid in discovering inappropriately restored backups of online log files.
 #bsz是單位塊大小
 #nab是下一個有效的塊next available block
 #flg標識:
    KCCLESPL 0x0001 set if log file spooled
    KCCLENAL 0x0002 set if no more allocation may be done in log
    KCCLEUSM 0x0004 if set use me as the next log to make current
    KCCLECUR 0x0008 set if this is the current log
    KCCLECLR 0x0010 set if log is being cleared by clear command
    KCCLESLF 0x0020 special standby logfile
    KCCLEAD1 0x0040 Archive Dest1 completion bit
    KCCLEAD2 0x0080 Archive Dest2 completion bit
    ...
    KCCLEAD9 0x4000 Archive Dest9 completion bit
    KCCLEAD10 0x8000 Archive Dest10 completion bit
 #dup是日誌組的成員號
 siz: 0x19000 seq: 0x00000073 hws: 0x2 bsz: 512 nab: 0x1475b flg: 0x1 dup: 1
 #Archive links,fwrd,back是A linked list of which groups need archiving, in the order they need archiving. This should agree with the flag bit saying the group has not been spooled.Pointers are zero for archived.
 #Prev scn是上一個redo log的low scn
 Archive links: fwrd: 0 back: 0 Prev scn: 0x0000.001bb2c2
 #Low scn是此日誌檔案的low scn
 Low scn: 0x0000.001c3a88 02/17/2016 17:00:02
 #Next scn是此日誌檔案的next scn
 Next scn: 0x0000.001cabb9 02/18/2016 08:00:41

#通用檔案頭
 #第一個資料庫檔案(control,redo,archive,data,temp file)都有相同的檔案頭.也可能透過x$kcvfh或x$kcvfhall檢視.
 FILE HEADER:
        Compatibility Vsn = 186647552=0xb200400
        #db id,db name
        Db ID=665652355=0x27ad0c83, Db Name='CT66'
        Activation ID=665633411=0x27acc283
        #Control Seq是記錄控制檔案最後一次更新的順序號,用以和控制檔案中這個順序號做對比來確定控制檔案的新舊.
        #File size是記錄在快取層的當前檔案的大小,單位是塊,單位塊大小是512
        Control Seq=12547=0x3103, File size=102400=0x19000
        #File Number此日誌檔案的絕對檔案號.
        #Blksiz此日誌檔案的塊大小.
        #File Type檔案型別:
            KCCTYPCF 1 control file
            KCCTYPRL 2 redo log file
            KCCTYPDF 3 vanilla db file; that is,normal data, index, and undo blocks
            KCCTYPBC 4 backup control file
            KCCTYPBP 5 backup piece
            KCCTYPTF 6 temporary db file
        File Number=1, Blksiz=512, File Type=2 LOG

#日誌檔案資訊
 Format ID is 2
 redo log key is 7351dbeee7c4147ec4b415531765bd
 redo log key flag is 5
 #Thread是日誌組所屬的執行緒號
 #Seq#是日誌檔案的順序號(十進位制)
 #SCN是Low scn~Next scn
 descrip:"Thread 0001, Seq# 0000000115, SCN 0x0000001c3a88-0x0000001cabb9"
 #thread是日誌組所屬的執行緒號
 #nab是日誌檔案中下一個有效的塊
 #seq是日誌檔案的順序號
 #hws是Header write sequence number within log init seq#
 #eot是Flags, indicate how end-of-thread this log stream is
    KCRFHENOT 0 NOT end of thread
    KCRFHEPUB 1 End of thread for PUBLIC thread
    KCRFHEPVT 2 End of thread for PRIVATE thread
    KCRFHELSR 3 End of thread due to log archive current
 #dis是true (nonzero) if thread disabled at end of this log
 thread: 1 nab: 0x1475b seq: 0x00000073 hws: 0x2 eot: 0 dis: 0
 #reset logs count,scn是當最後日誌切換完成時從控制檔案中copy過來的
 reset logs count: 0x35a3af03 scn: 0x0000.000e2006
 #Low scn是此日誌檔案的low scn
 Low scn: 0x0000.001c3a88 02/17/2016 17:00:02
 #Next scn是此日誌檔案的next scn
 Next scn: 0x0000.001cabb9 02/18/2016 08:00:41
 #Enabled scn: The SCN that was current when this thread was last enabled, that is, the start SCN of the thread.
 Enabled scn: 0x0000.000e2006 12/31/2015 17:40:19
 #Thread closed scn: The close of thread. Only valid if the NAB and EOT values above indicate a proper close.
 Thread closed scn: 0x0000.001c3a88 02/17/2016 17:00:02
 Disk cksum: 0x568e Calc cksum: 0x568e
 #Terminal Recovery Stop scn,Stamp 是完成介質恢復時的scn.所有日誌檔案必須是相同的值
 Terminal Recovery Stop scn: 0x0000.00000000
 Terminal Recovery Stamp  01/01/1988 00:00:00
 Most recent redo scn: 0x0000.00000000
 Largest LWN: 1728 blocks
 #Miscellaneous flags
    KCRFHARC 0x00001 File was produced by the archiver
    KCRFHLDB 0x00002 Logminer Dictionary Begin
    KCRFHLDE 0x00004 Logminer Dictionary End
    KCRFHEOR 0x00008 End-of-Redo generation
    KCRFHARCH 0x00010 ARCH process
    KCRFHFGRD 0x00020 Foreground process
    KCRFHLGWR 0x00040 LGWR process
    KCRFHRFS 0x00080 RFS process
    KCRFHASYC 0x00100 Async archival
 Miscellaneous flags: 0x800000
 Thread internal enable indicator: thr: 0, seq: 0 scn: 0x0000.00000000
 Zero blocks: 8
 Enabled redo threads: 1


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

相關文章