Oracle 10g 数据文件的第一个数据块结构

时间:2022-03-08 13:23:36

一.数据文件的第一个数据块结构kcvfh

BBED> set file 1
FILE# 1 BBED> set block 1
BLOCK# 1 --查看第一个数据块的整体结构
BBED> map /v
File: /u01/app/oracle/oradata/ORCL/datafile/o1_mf_system_bc7ld3sf_.dbf (1)
Block: 1 Dba:0x00400001
------------------------------------------------------------
Data File Header struct kcvfh, 676 bytes @0
struct kcvfhbfh, 20 bytes @0
struct kcvfhhdr, 76 bytes @20
ub4 kcvfhrdb @96
struct kcvfhcrs, 8 bytes @100
ub4 kcvfhcrt @108
ub4 kcvfhrlc @112
struct kcvfhrls, 8 bytes @116
ub4 kcvfhbti @124
struct kcvfhbsc, 8 bytes @128
ub2 kcvfhbth @136
ub2 kcvfhsta @138
struct kcvfhckp, 36 bytes @484
ub4 kcvfhcpc @140
ub4 kcvfhrts @144
ub4 kcvfhccc @148
struct kcvfhbcp, 36 bytes @152
ub4 kcvfhbhz @312
struct kcvfhxcd, 16 bytes @316
word kcvfhtsn @332
ub2 kcvfhtln @336
text kcvfhtnm[30] @338
ub4 kcvfhrfn @368
struct kcvfhrfs, 8 bytes @372
ub4 kcvfhrft @380
struct kcvfhafs, 8 bytes @384
ub4 kcvfhbbc @392
ub4 kcvfhncb @396
ub4 kcvfhmcb @400
ub4 kcvfhlcb @404
ub4 kcvfhbcs @408
ub2 kcvfhofb @412
ub2 kcvfhnfb @414
ub4 kcvfhprc @416
struct kcvfhprs, 8 bytes @420
struct kcvfhprfs, 8 bytes @428
ub4 kcvfhtrt @444 ub4 tailchk @8188 BBED>
--print结构 kcvfh
BBED> print kcvfh
struct kcvfh, 676 bytes @0
struct kcvfhbfh, 20 bytes @0
ub1 type_kcbh @0 0x0b
ub1 frmt_kcbh @1 0xa2
ub1 spare1_kcbh @2 0x00
ub1 spare2_kcbh @3 0x00
ub4 rdba_kcbh @4 0x00400001
ub4 bas_kcbh @8 0x00000000
ub2 wrp_kcbh @12 0x0000
ub1 seq_kcbh @14 0x01
ub1 flg_kcbh @15 0x04 (KCBHFCKV)
ub2 chkval_kcbh @16 0xd5f6
ub2 spare3_kcbh @18 0x0000
struct kcvfhhdr, 76 bytes @20
ub4 kccfhswv @20 0x00000000
ub4 kccfhcvn @24 0x0a200100
ub4 kccfhdbi @28 0x533ddaa4
text kccfhdbn[0] @32 O
text kccfhdbn[1] @33 R
text kccfhdbn[2] @34 C
text kccfhdbn[3] @35 L
text kccfhdbn[4] @36
text kccfhdbn[5] @37
text kccfhdbn[6] @38
text kccfhdbn[7] @39
ub4 kccfhcsq @40 0x0000022d
ub4 kccfhfsz @44 0x0000f000
s_blkz kccfhbsz @48 0x00
ub2 kccfhfno @52 0x0001
ub2 kccfhtyp @54 0x0003
ub4 kccfhacid @56 0x00000000
ub4 kccfhcks @60 0x00000000
text kccfhtag[0] @64
text kccfhtag[1] @65
text kccfhtag[2] @66
text kccfhtag[3] @67
text kccfhtag[4] @68
text kccfhtag[5] @69
text kccfhtag[6] @70
text kccfhtag[7] @71
text kccfhtag[8] @72
text kccfhtag[9] @73
text kccfhtag[10] @74
text kccfhtag[11] @75
text kccfhtag[12] @76
text kccfhtag[13] @77
text kccfhtag[14] @78
text kccfhtag[15] @79
text kccfhtag[16] @80
text kccfhtag[17] @81
text kccfhtag[18] @82
text kccfhtag[19] @83
text kccfhtag[20] @84
text kccfhtag[21] @85
text kccfhtag[22] @86
text kccfhtag[23] @87
text kccfhtag[24] @88
text kccfhtag[25] @89
text kccfhtag[26] @90
text kccfhtag[27] @91
text kccfhtag[28] @92
text kccfhtag[29] @93
text kccfhtag[30] @94
text kccfhtag[31] @95
ub4 kcvfhrdb @96 0x00400179
struct kcvfhcrs, 8 bytes @100
ub4 kscnbas @100 0x00000005
ub2 kscnwrp @104 0x0000
ub4 kcvfhcrt @108 0x33c88f35
ub4 kcvfhrlc @112 0x33cecf37
struct kcvfhrls, 8 bytes @116
ub4 kscnbas @116 0x00073e32
ub2 kscnwrp @120 0x0000
ub4 kcvfhbti @124 0x00000000
struct kcvfhbsc, 8 bytes @128
ub4 kscnbas @128 0x00000000
ub2 kscnwrp @132 0x0000
ub2 kcvfhbth @136 0x0000
ub2 kcvfhsta @138 0x2004 (KCVFHOFZ)
struct kcvfhckp, 36 bytes @484
struct kcvcpscn, 8 bytes @484
ub4 kscnbas @484 0x00073e33
ub2 kscnwrp @488 0x0000
ub4 kcvcptim @492 0x33cecf3e
ub2 kcvcpthr @496 0x0001
union u, 12 bytes @500
struct kcvcprba, 12 bytes @500
ub4 kcrbaseq @500 0x00000001
ub4 kcrbabno @504 0x00000002
ub2 kcrbabof @508 0x0010
ub1 kcvcpetb[0] @512 0x02
ub1 kcvcpetb[1] @513 0x00
ub1 kcvcpetb[2] @514 0x00
ub1 kcvcpetb[3] @515 0x00
ub1 kcvcpetb[4] @516 0x00
ub1 kcvcpetb[5] @517 0x00
ub1 kcvcpetb[6] @518 0x00
ub1 kcvcpetb[7] @519 0x00
ub4 kcvfhcpc @140 0x00000043
ub4 kcvfhrts @144 0x33cecf1e
ub4 kcvfhccc @148 0x00000042
struct kcvfhbcp, 36 bytes @152
struct kcvcpscn, 8 bytes @152
ub4 kscnbas @152 0x00000000
ub2 kscnwrp @156 0x0000
ub4 kcvcptim @160 0x00000000
ub2 kcvcpthr @164 0x0000
union u, 12 bytes @168
struct kcvcprba, 12 bytes @168
ub4 kcrbaseq @168 0x00000000
ub4 kcrbabno @172 0x00000000
ub2 kcrbabof @176 0x0000
ub1 kcvcpetb[0] @180 0x00
ub1 kcvcpetb[1] @181 0x00
ub1 kcvcpetb[2] @182 0x00
ub1 kcvcpetb[3] @183 0x00
ub1 kcvcpetb[4] @184 0x00
ub1 kcvcpetb[5] @185 0x00
ub1 kcvcpetb[6] @186 0x00
ub1 kcvcpetb[7] @187 0x00
ub4 kcvfhbhz @312 0x00000000
struct kcvfhxcd, 16 bytes @316
ub4 space_kcvmxcd[0] @316 0x00000000
ub4 space_kcvmxcd[1] @320 0x00000000
ub4 space_kcvmxcd[2] @324 0x00000000
ub4 space_kcvmxcd[3] @328 0x00000000
word kcvfhtsn @332 0
ub2 kcvfhtln @336 0x0006
text kcvfhtnm[0] @338 S
text kcvfhtnm[1] @339 Y
text kcvfhtnm[2] @340 S
text kcvfhtnm[3] @341 T
text kcvfhtnm[4] @342 E
text kcvfhtnm[5] @343 M
text kcvfhtnm[6] @344
text kcvfhtnm[7] @345
text kcvfhtnm[8] @346
text kcvfhtnm[9] @347
text kcvfhtnm[10] @348
text kcvfhtnm[11] @349
text kcvfhtnm[12] @350
text kcvfhtnm[13] @351
text kcvfhtnm[14] @352
text kcvfhtnm[15] @353
text kcvfhtnm[16] @354
text kcvfhtnm[17] @355
text kcvfhtnm[18] @356
text kcvfhtnm[19] @357
text kcvfhtnm[20] @358
text kcvfhtnm[21] @359
text kcvfhtnm[22] @360
text kcvfhtnm[23] @361
text kcvfhtnm[24] @362
text kcvfhtnm[25] @363
text kcvfhtnm[26] @364
text kcvfhtnm[27] @365
text kcvfhtnm[28] @366
text kcvfhtnm[29] @367
ub4 kcvfhrfn @368 0x00000001
struct kcvfhrfs, 8 bytes @372
ub4 kscnbas @372 0x00000000
ub2 kscnwrp @376 0x0000
ub4 kcvfhrft @380 0x00000000
struct kcvfhafs, 8 bytes @384
ub4 kscnbas @384 0x00000000
ub2 kscnwrp @388 0x0000
ub4 kcvfhbbc @392 0x00000000
ub4 kcvfhncb @396 0x00000000
ub4 kcvfhmcb @400 0x00000000
ub4 kcvfhlcb @404 0x00000000
ub4 kcvfhbcs @408 0x00000000
ub2 kcvfhofb @412 0x000a
ub2 kcvfhnfb @414 0x000a
ub4 kcvfhprc @416 0x33ce5d9c
struct kcvfhprs, 8 bytes @420
ub4 kscnbas @420 0x0006ca36
ub2 kscnwrp @424 0x0000
struct kcvfhprfs, 8 bytes @428
ub4 kscnbas @428 0x00000000
ub2 kscnwrp @432 0x0000
ub4 kcvfhtrt @444 0x00000000 BBED>

注,print出的值可能是不完整的,如果想查看详细的值,最好用dump

二.数据字典X$KCVFH

  X$KCVFH(参考dbsnake博客)的值与kcvfh是相对应的

序号

Column Name

Description

1

ADDR RAW(4)

ADDRESS

2

INDX NUMBER

INDEX

3

INST_ID NUMBER

INSTANCE ID

4

HXFIL NUMBER

FILE#,Datafile number (from control file)

5

HXONS NUMBER

ONLINE | OFFLINE (from control file),HXONS为 0表示 ‘OFFLINE’,为其他值表示 ‘ONLINE’

6

HXSTS VARCHAR2(16)

 

7

HXERR NUMBER

ERROR,decode(HXERR, 0, NULL, 1,’FILE MISSING’,2,’OFFLINE NORMAL’, 3,’NOT VERIFIED’, 4,’FILE NOT FOUND’,5,’CANNOT OPEN FILE’, 6,’CANNOT READ HEADER’, 7,’CORRUPT HEADER’,8,’WRONG FILE TYPE’, 9,’WRONG DATABASE’, 10,’WRONG FILE NUMBER’,11,’WRONG FILE CREATE’, 12,’WRONG FILE CREATE’, 16,’DELAYED OPEN’,14, ‘WRONG RESETLOGS’, 15,’OLD CONTROLFILE’, ‘UNKNOWN ERROR’)

8

HXVER NUMBER

FORMAT,Indicates the format for the header block. The possible values are 6, 7, 8, or 0. 6  - indicates Oracle Version 6;7 – indicates Oracle Version 7;8 – indicates Oracle Version 8;0  - indicates the format could not be determined (for example, the header could not be read)

9

FHSWV NUMBER

 

10

FHCVN NUMBER

Compatibility Vsn

11

FHDBI NUMBER

DBID

12

FHDBN VARCHAR2(9)

DB NAME

13

FHCSQ NUMBER

controlfile sequence number

14

FHFSZ NUMBER

BLOCKS, Current datafile size in blocks

15

FHBSZ NUMBER

datafile block size

16

FHFNO NUMBER

Tablespace datafile number

17

FHTYP NUMBER

Type:

1 control file

2 redo log file

3 vanilla db file; that is, normal data, index, and undo blocks

4 backup control file

5 backup piece

6 temporary db file

18

FHRDB NUMBER

Root dba: This field only occurs in data file #1, and is the location of blocks required during bootstrapping the data dictionary (bootstrap$)

19

FHCRS VARCHAR2(16)

CREATION_CHANGE#,Datafile creation change#

20

FHCRT VARCHAR2(20)

CREATION_TIME,Datafile creation timestamp

21

FHRLC VARCHAR2(20)

RESETLOGS_TIME, Resetlogs timestamp

22

FHRLC_I NUMBER

reset logs count

23

FHRLS VARCHAR2(16)

RESETLOGS_CHANGE#, Resetlogs change#

24

FHPRC VARCHAR2(20)

prev reset logs timestamp

25

FHPRC_I NUMBER

prev reset logs count

26

FHPRS VARCHAR2(16)

prev reset logs SCN

27

FHBTI VARCHAR2(20)

Time the backup started, Updated when executing BEGIN BACKUP on the tablespace. RMAN does not update this field.

28

FHBSC VARCHAR2(16)

System change number when backup started, Updated when executing BEGIN BACKUP on the tablespace. RMAN does not update this field.

29

FHBTH NUMBER

Thread when when backup started, Updated when executing BEGIN BACKUP on the tablespace. RMAN does not update this field.

30

FHSTA NUMBER

The value for the column X$KCVFH.FHSTA (file header status) for an open database with an online datafiles in versions prior to version 10 were all 4, indicating an online fuzzy status.  With version 10 of Oracle the first system tablespace datafile will have a different status of 8196 if the datafile is online and the database is open and not in backup mode. In Oracle , the X$KCVFH.FHSTA column will show 8196 for system data file if COMPATIBLE is set to 10.0.0.0 or higher.  The value of 8196 is a value of 0×04, as in previous releases, plus an AND’d value of 0×2000 (8192) for internal uses. If COMPATIBLE is set to 9.2.0 (lowest possible value for Oracle ), the FHSTA column for system datafile will have a value of 4.   In Oracle, the COMPATIBLE value is irreversible if advanced to a higher value. So the value of 8196 for the fhsta (status) column for the first system tablespace datafile is normal.

31

FHSCN VARCHAR2(16)

CHECKPOINT_CHANGE#, Datafile checkpoint change#, Updated on every checkpoint, but not when in Hot backup state (not online backups). This must remain untouched when you are in hot backup mode, because you might get checkpoints between the BEGIN BACKUP and when you actually start the copying process.

32

FHTIM VARCHAR2(20)

CHECKPOINT_TIME, Datafile checkpoint timestamp

33

FHTHR NUMBER

THREAD#

34

FHRBA_SEQ NUMBER

SEQUENCE,即Redo log sequence number

35

FHRBA_BNO NUMBER

Block number,即the redo log file block number

36

FHRBA_BOF NUMBER

Byte offset,the byte offset into the block at which the redo record starts

37

FHETB RAW(132)

enable threads byte,这个我不确定,是猜的。

38

FHCPC NUMBER

CHECKPOINT_COUNT, Datafile checkpoint count

39

FHRTS VARCHAR2(20)

Recoverd timestamp

40

FHCCC NUMBER

Controlfile Checkpoint Count: Saved copy of the control file record of the checkpoint count. Helps detect old control files.

41

FHBCP_SCN VARCHAR2(16)

Backup Checkpoint SCN: Updated with the checkpoint done while file in Hot backup

42

FHBCP_TIM VARCHAR2(20)

Backup Checkpoint TIME: Updated with the checkpoint done while file in Hot backup

43

FHBCP_THR NUMBER

Backup Checkpoint Thread: Updated with the checkpoint done while file in Hot backup

44

FHBCP_RBA_SEQ NUMBER

Backup Checkpoint Sequence, 即Redo log sequence number: Updated with the checkpoint done while file in Hot backup

45

FHBCP_RBA_BNO NUMBER

the redo log file block number, Updated with the checkpoint done while file in Hot backup

46

FHBCP_RBA_BOF NUMBER

Byte offset,the byte offset into the block at which the redo record starts, Updated with the checkpoint done while file in Hot backup

47

FHBCP_ETB RAW(132)

enable threads byte,这个我不确定,是猜的

48

FHBHZ NUMBER

begin hot backup file size

49

FHXCD RAW(16)

External cache id: Used to ensure that concurrent instances access data through consistent external cache

50

FHTSN NUMBER

TS#,Tablespace number

51

FHTNM VARCHAR2(30)

TABLESPACE_NAME, Tablespace name

52

FHRFN NUMBER

RFILE#, Tablespace relative datafile number

53

FHAFS VARCHAR2(16)

absolute fuzzy scn, 即Minimum PITR SCN

54

FHRFS VARCHAR2(16)

The SCN at which the recovery of this file will be complete (no longer fuzzy). Both above fuzzy SCNs must be zero unless a fuzzy flag is set, and must be greater than the checkpoint SCN

55

FHRFT VARCHAR2(20)

The time at which the recovery of this file will be complete (no longer fuzzy).

56

HXIFZ NUMBER

File is fuzzy (YES | NO),decode(hxifz, 0,’NO’, 1,’YES’, NULL)

57

HXNRCV NUMBER

File needs media recovery (YES | NO),decode(hxnrcv, 0,’NO’, 1,’YES’,NULL)

58

HXFNM VARCHAR2(513)

NAME, Datafile name

59

FHPOFB NUMBER

 

60

FHPNFB NUMBER

 

61

FHPRE10 NUMBER

 

62

FHFIRSTUNRECSCN VARCHAR2(16)

UNRECOVERABLE_CHANGE#, Last unrecoverable change number made to this datafile. If the database is in ARCHIVELOG mode, then this column is updated when an unrecoverable operation completes. If the database is not in ARCHIVELOG mode, this column does not get updated.

63

FHFIRSTUNRECTIME VARCHAR2(20)

UNRECOVERABLE_TIME, Timestamp of the last unrecoverable change. This column is updated only if the database is in ARCHIVELOG mode.

64

HXLMDBA NUMBER

SPACE_HEADER, The amount of space currently being used and the amount that is free, as identified in the space header. decode(hxlmdba, 0, NULL, hxlmdba)

65

HXLMLD_SCN VARCHAR2(16)

LAST_DEALLOC_SCN, Last deallocated SCN