#环境
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