#环境
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 file_hdrs level 3';或oradebug dump file_hdrs 3
SQL> oradebug setmypid
SQL> oradebug dump file_hdrs 3
#显示数据文件1的转储内容
#可以通过上面sqlplus中的spid或ll -rth排序来确定是那个文件
[oracle@ct6605 ~]$ cd /u01/app/oracle/diag/rdbms/ct66/ct66/trace
[oracle@ct6605 trace]$ vi ct66_ora_11955.trc
#以下只显示数据文件1的转储内容
*** 2016-02-19 17:03:06.403
Processing Oradebug command 'dump file_hdrs 3'
DUMP OF DATA FILES: 9 files in database
DATA FILE #1:
name #7: /u02/oradata/ct66/system01.dbf
creation size=0 block size=8192 status=0xe head=7 tail=7 dup=1
tablespace 0, index=1 krfil=1 prev_file=0
unrecoverable scn: 0x0000.00000000 01/01/1988 00:00:00
Checkpoint cnt:243 scn: 0x0000.001d1426 02/18/2016 22:00:37
Stop scn: 0xffff.ffffffff 02/01/2016 21:08:19
Creation Checkpointed at scn: 0x0000.00000007 08/24/2013 11:37:33
thread:0 rba:(0x0.0.0)
enabled threads: 00000000 00000000 00000000 00000000 00000000 00000000
...
Offline scn: 0x0000.000e2005 prev_range: 0
Online Checkpointed at scn: 0x0000.000e2006 12/31/2015 17:40:19
thread:1 rba:(0x1.2.0)
enabled threads: 01000000 00000000 00000000 00000000 00000000 00000000
...
Hot Backup end marker scn: 0x0000.00000000
aux_file is NOT DEFINED
Plugged readony: NO
Plugin scnscn: 0x0000.00000000
Plugin resetlogs scn/timescn: 0x0000.00000000 01/01/1988 00:00:00
Foreign creation scn/timescn: 0x0000.00000000 01/01/1988 00:00:00
Foreign checkpoint scn/timescn: 0x0000.00000000 01/01/1988 00:00:00
Online move state: 0
V10 STYLE FILE HEADER:
Compatibility Vsn = 186647552=0xb200400
Db ID=665652355=0x27ad0c83, Db Name='CT66'
Activation ID=0=0x0
Control Seq=12845=0x322d, File size=98560=0x18100
File Number=1, Blksiz=8192, File Type=3 DATA
Tablespace #0 - SYSTEM rel_fn:1
Creation at scn: 0x0000.00000007 08/24/2013 11:37:33
Backup taken at scn: 0x0000.00000000 01/01/1988 00:00:00 thread:0
reset logs count:0x35a3af03 scn: 0x0000.000e2006
prev reset logs count:0x3121c97a scn: 0x0000.00000001
recovered at 02/01/2016 21:11:05
status:0x2004 root dba:0x00400208 chkpt cnt: 243 ctl cnt:242
begin-hot-backup file size: 0
Checkpointed at scn: 0x0000.001d1426 02/18/2016 22:00:37
thread:1 rba:(0x75.2.10)
enabled threads: 01000000 00000000 00000000 00000000 00000000 00000000
...
Backup Checkpointed at scn: 0x0000.00000000
thread:0 rba:(0x0.0.0)
enabled threads: 00000000 00000000 00000000 00000000 00000000 00000000
...
External cache id: 0x0 0x0 0x0 0x0
Absolute fuzzy scn: 0x0000.00000000
Recovery fuzzy scn: 0x0000.00000000 01/01/1988 00:00:00
Terminal Recovery Stamp 01/01/1988 00:00:00
Platform Information: Creation Platform ID: 13
Current Platform ID: 13 Last Platform ID: 13
解释:
*** 2016-02-19 17:03:06.403
Processing Oradebug command 'dump file_hdrs 3'
DUMP OF DATA FILES: 9 files in database
#来自于控制文件
#DATA FILE #1必须是system所属的表空间文件.
DATA FILE #1:
#name #7是数据文件的位置
name #7: /u02/oradata/ct66/system01.dbf
#creation size数据文件此值始终为0
#block size单位块大小
#status状态:
KCCFEFDB 0x0001 file read-only, plugged from foreign DB(in Oracle7: File belongs to SYSTEM)
KCCFEONL 0x0002 File is online
KCCFERDE 0x0004 Reading is enabled
KCCFECGE 0x0008 Changing is enabled
KCCFEMRR 0x0010 Media recovery required
KCCFEGEM 0x0020 Generate end hot backup marker at next open
KCCFECKD 0x0040 File record generated by check dictionary(backup controlfile)
KCCFESOR 0x0080 Save offline scn range at next checkpoint
KCCFERMF 0x0100 Renamed missing file
KCCFEGOI 0x0200 Generate off-line immediate marker
KCCFECUV 0x0400 Checkpoint by instance where unverified
KCCFEDRP 0x0800 Offline to be dropped
KCCFEWCC 0x1000 Was at clean chkpt: clean up to ctrlfile chkpt
KCCFEODC 0x2000 Online at dictionary check if read/only tablespace
KCCFEDBR 0x4000 Entry created by DBMS_BACKUP_RESTORE
KCCFETRO 0x8000 Transition read only
#head,tail,dup是Pointers to the linked list of file names in the name section
creation size=0 block size=8192 status=0xe head=7 tail=7 dup=1
#tablespace表空间号,
#index是数据文件在表空间的记录号
#prev_file是相同表空间下前一个文件号
tablespace 0, index=1 krfil=1 prev_file=0
unrecoverable scn: 0x0000.00000000 01/01/1988 00:00:00
#Checkpoint cnt是数据文件头scn,对应v$datafile.checkpoint_change#,如果此数据文件没有offline或begin backup,此scn将和v$database.checkpoint_change#也相同
Checkpoint cnt:243 scn: 0x0000.001d1426 02/18/2016 22:00:37
#Stop scn对应v$datafile.last_change#,正常关闭和Checkpoint cnt值相同,打开或异常关闭时为无穷大0xffff.ffffffff
Stop scn: 0xffff.ffffffff 02/01/2016 21:08:19
#Creation Checkpointed at scn是数据文件创建时的scn,对应v$datafile.creation_change#
Creation Checkpointed at scn: 0x0000.00000007 08/24/2013 11:37:33
thread:0 rba:(0x0.0.0)
enabled threads: 00000000 00000000 00000000 00000000 00000000 00000000
...
#Offline scn,Online Checkpointed at scn是数据文件离线和上线时的scn
Offline scn: 0x0000.000e2005 prev_range: 0
Online Checkpointed at scn: 0x0000.000e2006 12/31/2015 17:40:19
thread:1 rba:(0x1.2.0)
enabled threads: 01000000 00000000 00000000 00000000 00000000 00000000
...
#Hot Backup end marker scn是执行begin backup在此表空间时更新此值,rman操作不更新
Hot Backup end marker scn: 0x0000.00000000
aux_file is NOT DEFINED
Plugged readony: NO
Plugin scnscn: 0x0000.00000000
Plugin resetlogs scn/timescn: 0x0000.00000000 01/01/1988 00:00:00
Foreign creation scn/timescn: 0x0000.00000000 01/01/1988 00:00:00
Foreign checkpoint scn/timescn: 0x0000.00000000 01/01/1988 00:00:00
Online move state: 0
#通用文件头
#第一个数据库文件(control,redo,archive,data,temp file)都有相同的文件头.也可能通过x$kcvfh或x$kcvfhall查看.
V10 STYLE FILE HEADER:
Compatibility Vsn = 186647552=0xb200400
#db id,db name
Db ID=665652355=0x27ad0c83, Db Name='CT66'
Activation ID=0=0x0
#Control Seq是记录控制文件最后一次更新的顺序号,用以和控制文件中这个顺序号做对比来确定控制文件的新旧.
#File size是记录在缓存层的当前文件的大小,单位是块.
Control Seq=12845=0x322d, File size=98560=0x18100
#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=8192, File Type=3 DATA
#数据文件信息
#Tablespace #0 - SYSTEM中#0对应v$tablespace中的ts#,SYSTEM是所属表空间名称
#rel_fn:1是相对文件号relative file number
Tablespace #0 - SYSTEM rel_fn:1
#Creation at scn是文件建立时的scn
Creation at scn: 0x0000.00000007 08/24/2013 11:37:33
#Backup taken at scn执行begin backup在此表空间时更新此值,rman操作不更新
Backup taken at scn: 0x0000.00000000 01/01/1988 00:00:00 thread:0
#reset logs count与此scn作为resetlogs的唯一标识
reset logs count:0x35a3af03 scn: 0x0000.000e2006
#prev reset logs count与此scn作为上一次resetlogs的唯一标识
prev reset logs count:0x3121c97a scn: 0x0000.00000001
#recovered at用于确定是否有多个进程在对其进行rercovery
recovered at 02/01/2016 21:11:05
#status状态:
KCVFHHBP 001 Hot backup-in-progress on file (fuzzy file)
KCVFHHBM 002 End hot backup marker seen (Bit only valid or set in Oracle7)
KCVFHOFZ 004 Online fuzzy because it was online and db open
KCVFHCRM 008 Crash Recovery Media marker seen (Bit only valid or set in Oracle7)
KCVFHMFZ 010 Media recovery fuzzy - file in media recovery
KCVFHCMF 020 Clear media recovery (Bit only valid or set in Oracle7)
KCVFHAFZ 040 Absolutely fuzzy - fuzziness from file scan
KCVFHBCP 100 Bad Checkpoint - no enabled thread bitvec(In Oracle7 this flag means: File belongs to SYSTEM tablespace)
KCVFHFMH 200 Freshly munged header. Resetlogs are not finished.Bit is cleared at next checkpoint. A set bit allows an OPEN RESETLOGS to be repeated (for example, file headers were updated(this bit was set) but control file record not updated)
KCVFHXCH 400 Externally cached by operating system. If the server is aware of an OS cache that delays writes to media, then this bit gets set,and the server will force a media recovery when file is reopened.
KCVFHZBA 800 Zeroed blocks allowed. File may contain Oracle7 unused blocks,which are all zero. Oracle8 blocks have a nonzero initial value with SEQ and TAIL.
KCVFHPCP 1000 Proxy copy in progress
#root dba此字段只有在数据文件1上有,用于请求引导bootstrap$时的块定位
#chkpt cnt是Checkpoint Count,用于检测是否restore完成
#ctl cnt是Controlfile Checkpoint Count,用于检测控制文件的新旧
status:0x2004 root dba:0x00400208 chkpt cnt: 243 ctl cnt:242
#begin-hot-backup file size是当执行begin bakcup时,Backup scn更新后会更新文件尺寸
begin-hot-backup file size: 0
#Checkpointed at scn是每一次checkpoint会更新此scn,除了在begin backup时
Checkpointed at scn: 0x0000.001d1426 02/18/2016 22:00:37
thread:1 rba:(0x75.2.10)
enabled threads: 01000000 00000000 00000000 00000000 00000000 00000000
...
#Backup Checkpointed at scn是执行begin backup在此文件上时checkpoint会更新此scn
Backup Checkpointed at scn: 0x0000.00000000
thread:0 rba:(0x0.0.0)
enabled threads: 00000000 00000000 00000000 00000000 00000000 00000000
...
#External cache id是用来确定并发实例通过一致性外部缓存访问数据
External cache id: 0x0 0x0 0x0 0x0
#Absolute fuzzy scn是说明此文件是一个备份copy并且是fuzzy状态
Absolute fuzzy scn: 0x0000.00000000
#Recovery fuzzy scn是此文件recovery将完成时记录的scn
Recovery fuzzy scn: 0x0000.00000000 01/01/1988 00:00:00
Terminal Recovery Stamp 01/01/1988 00:00:00
#Creation Platform ID是数据库建立时的平台ID,对应v$transportable_platform的platform_id
#Current Platform ID是数据库当前的平台ID
#Last Platform ID是上一次迁移之前的数据库平台ID
Platform Information: Creation Platform ID: 13
Current Platform ID: 13 Last Platform ID: 13