file block header
Start dump data blocks tsn: 4 file#: 4 minblk 3 maxblk 3
buffer tsn: 4 数据文件对应的 tablespace 的 number ,这只是dump文件中记录的数据而已,block无此信息
rdba: 0×01000003 (4/3) datafile 中 block 的地址,标示的第几个 block
scn: 0×0000.00093761 system change number
seq: 0×01 A sequence number incremented for each change to a block at the same SCN
— A new SCN is allocated if the sequence number wraps.
— 同一个SCN影响这个block中的行数大于 254 行就会为这个事务分配一个新的SCN
— 如下面的操作就可能引起同一个SCN但影响的同一个block 中的行超过254行
— “delete from table_name”
— 影响的行数(最大254) 是用从 0×01 到 0xfe 表示的
— 当这个byte 的数据为 0xff 的时候标志这个 block 坏调了—> ora-01578
flg: 0×04 1 byte 1 = virgin block
— 2 = last change to the block was for a cleanout operation
— 4 = checksum value is set
— 8 = temporary data
— 这是一个可以组合的值 也就是说有为 6 的时候是 2,4 两种情况的组合
tail: 0×37611e01 4 bytes 这是记录在 block 的最后面的 4 bytes 的数据
frmt: 0×02 1 byte oracle 8 以后看见的都是 0×02
chkval: 0xb1e9 2 bytes 在 init 文件中设置了 db_block_checksum=true 才有值
type: 0×1e=KTFB Bitmapped File Space Bitmap Hex dump of block: st=0, typ_found=1
1 byte 这个 block 的类型 这里主要看 0×06 这种 因为这种是用来存用户数据的
http://www.ixora.com.au/notes/cache_block_types.htm

Block header dump: 0×010002c7
Object id on Block? Y
seg/obj: 0xcde4 csc: 0×00.93777 itc: 2 flg: E typ: 1 - DATA
brn: 0 bdba: 0×10002c1 ver: 0×01 opc: 0
inc: 0 exflg: 0
Itl Xid Uba Flag Lck Scn/Fsc
0×01 0×0001.029.00000137 0×00800369.00bf.27 –U- 1 fsc 0×0000.000941fc
0×02 0×0000.000.00000000 0×00000000.0000.00 —- 0 fsc 0×0000.00000000
data_block_dump,data header at 0×8642264
===============
tsiz: 0×1f98
hsiz: 0×14
pbl: 0×08642264
bdba: 0×010002c7
76543210
flag=——–
ntab=1
nrow=1
frre=-1
fsbo=0×14
fseo=0×1f92
avsp=0×1f7b
tosp=0×1f7b
0xe:pti[0] nrow=1 offs=0
0×12:pri[0] offs=0×1f92
block_row_dump:
tab 0, row 0, @0×1f92
tl: 6 fb: –H-FL– lb: 0×1 cc: 1
col 0: [ 2] c1 02
end_of_block_dump
Block header dump: 0×01000003
Object id on Block? Y
seg/obj: 0×614a csc: 0×00.802a3 itc: 1 flg: O typ: 1 - DATA
fsl: 0 fnx: 0×0 ver: 0×01
— seg/obj: 4 bytes 这里是16进制的 对应 sys.obj$.obj# 数据字典的数据
— csc: 6 bytes The SCN at which the last full cleanout was performed on the block
— itc: 1 byte 下面的Itl事务条的个数 8.1.7的文档上面说可以使用 INITRANS 在建表的时候
— 限制这个值的大小(max 255超过会报ORA-02207) 但要考虑block 的空间是否够
— 表在8i中 INITRANS default为1 , 9.2.0中 INITRANS default为2
— Yong Huang 说有些时候发生ORA-00060可以把表的 INITRANS 设置大点
— ixora 上说当block的空间不够创建一个ITL的时候一样可能引起ORA-00054
— flg: 2 bytes 0 indicates that the block is on a freelist. Otherwise the flag is -
— 9i 的ASSM 的情况下这个值为 E
— ixora 上说他占用 2 bytes 但我下面的试验和他的结果有一定的出入
— 我观察到的情况是 :
— Object id on Block? Y
— flg: O
— ver: 0×01
— 上面的3项是用同一个 byte 来表示的
— typ: 1 byte 1 为 table ; 2 为 index. oracle进行查询的时候是根据 obj$表中的情况来
— 判断对象的类型的,不是根据这个typ。也就是说如果有一个表但改变表中block
— 的这个标志位,一样可以查询出数据来,但dump block 时会出错,如下面的ora
— ORA-00600: 内部错误代码,自变量: [4555], [0], [], [], [], [], [], []
— 错误中的 [0] 就是typ对应的数据
— fsl: 1 byte Index to the first slot on the ITL freelist. ITL TX freelist slot
— fnx: 4 bytes 自由列表中下一块的地址 Null if this block is not on a freelist
— 有数据例如: fnx: 0×1000029
— ver: 1 byte format (version) 这个数据没有看到相关的文档介绍 从ixora上说是占用1byte
— 但我从下面的2进制文件中看到的有不同 下面有介绍
— unused: 4 bytes 在这里还有4 bytes 的空闲的空间 但在上面的 dump 文件上是没显示出来的
— 这个unused 的4 bytes是 ixora 上面的说法
— 9i 的 ASSM 的 ” fsl: 0 fnx: 0×0 ver: 0×01 “这一段数据的情况已经改变了
Itl Xid Uba Flag Lck Scn/Fsc
0×01 xid: 0×0003.045.000000b4 uba: 0×0080170a.00c7.36 –U- 1 fsc 0×0000.000802a5
— 这是 oracle 用来记录事务信息的部分 这里显示的只有一个ITL条 有多少个ITL条是可以动态增加的
— 只要 block 中的空间足够 可以定义初始化的 ITL 条的个数 用 INITRANS 这storage 参数
— 这里有多少个 ITL 可以从上面 “第二部分” 的 “itc:” 看出来
— 这部分牵扯 rollback segment 或 undo tablespace
— Itl itl 的序号
— xid: 8 bytes 值可以用select XIDUSN, XIDSLOT,XIDSQN from v$transaction;查到
— This is comprised of the rollback segment number (2 bytes), the slot number
— in the transaction table of that rollback segment (2 bytes), and the number
— of times use of that transaction table has wrapped (4 bytes).
— Uba: 8 bytes The location of the undo for the most recent change to this block by this
— transaction. This is comprised of the DBA of the rollback segment block (4
— bytes), the sequence number (2 bytes), and the record number for the change
— in that undo block (1 byte), plus 1 unused byte.
— flag 1 nibble —- = transaction is active, or committed pending cleanout
— C— = transaction has been committed and locks cleaned out
— -B– = this undo record contains the undo for this ITL entry
— –U- = transaction committed (maybe long ago); SCN is an upper bound
— —T = transaction was still active at block cleanout SCN
— Lck 3 nibbles The number of row-level locks held in the block by this transaction.
— Scn/Fsc 6 bytes If the transaction has been cleaned out, this is the commit SCN or an upper
— bound thereof. Otherwise the leading two bytes contain the free space credit
— for the transaction - that is, the number of bytes freed in the block by the
— transaction
— 参考http://www.ixora.com.au/q+a/datablock.htm#end
—
———————– 第四部分
data_block_dump
===============
tsiz: 0×1fb8
hsiz: 0×14
pbl: 0×02476c44
bdba: 0×01000003
flag=———–
ntab=1
nrow=1
frre=-1
fsbo=0×14
fseo=0×1fb2
avsp=0×1f9b
tosp=0×1f9b
0xe:pti[0] nrow=1 offs=0
0×12:pri[0] offs=0×1fb2
— tsiz: hsiz: pbl: bdba: 在数据文件都是没有存储的
— tsiz: 除了上面的3部分和block尾部的4个字节剩下的空间 0×1fb8就是8120字节 8k的block:
— 8192-20(block head)-24(Transaction Header)-24(一个事务条)-4(block tail)=8120
— hsiz: 数据块头20个字节+数据块尾4个字节=24字节(0×14)
— pbl: ptr to buffer holding the block 我是用的专用模式dump的datafile中的block出来
— 在同一个session的dump文件中 dump 出来的block 的这个都是同一个值
— bdba: 和第一部分中的rdba 一个意思
— flag 1 byte N=pctfree hit(clusters), F=don’t put on free list
— K=flushable cluster keys. 当然还有别的标记: A …
— ntab 1 byte 这block中有几个table的数据 cluster这个就可能大于1
— nrow 2 bytes block 中有多少行数据
— frre 2 bytes First free row index entry. -1=you have to add one.
— fsbo 2 bytes Free Space Begin offset
— fseo 2 bytes Free Space End offset
— avsp 2 bytes Available space in the block <pctfree and pctused?>
— tosp 2 bytes Total available space when all TXs commit
— 0xe: nrow 2 bytes block 中的这个table有多少行数据
— 0xe: offs 2 bytes 偏移量 用 cluster 的时候可以看出值
———————– 第五部分
block_row_dump:
tab 0, row 0, @0×1fb2
tl: 6 fb: –H-FL– lb: 0×1 cc: 1
col 0: [ 2] c1 02
end_of_block_dump
— tl: 这条记录中的长度 包括row head 的一般情况的 3 字节和表示数据长度的1字节和数据本身的长度
— fb: 1 byte K = Cluster Key (Flags may change meaning if this is set to show HASH cluster)
— C = Cluster table member
— H = Head piece of row
— D = Deleted row
— F = First data piece
— L = Last data piece
— P = First column continues from previous piece
— N = Last column continues in next piece
— lb: 1 byte 和上面第三部分的 ITL 的lck相对应 表示这行是否被 lock 了
— cc: 1 byte 表示这行有几列数据
— col 0: [ 2] : 1 byte 表示这行的这列的长度
— c1 02 : 这就是table中的数据 “1″ 可以通过下面的语句看 oracle真正使用的是
— 那些16进制的数据来表示的用户数据 select dump(col_name,16) from table_name;
