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 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

 

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

相關文章