近来在itpub上看到anysql的mydul的第一版本的源码, 学习中。其实好多地方不是很明白, java也不是很熟悉, 格式不是很了解, 很多oracle的功能也不熟悉。慢慢学习中。。。
与这个相关的东西还有 itpub grassbell 斑主在 2004-07-27 一篇oracle data block物理结构的文章 , 好早啊, 那时我还在学校,什么oracle几乎没什么接触。 不想那么多了, 就想弄明白,哪怕已经很过时了。
我使用英文的google查询了一下找到这个篇文章
这个应该比较全面的了:
下面的内容主要来源 orafaq 的oracle data block格式的小节, 不是很具体:
oracle data block format
=================
struct kcbh, 20 bytes block header structure
ub1 type_kcbh block type
different block types are designated by
the first byte of the block.
01 undo segment header
02 undo data block
03 save undo header
04 save undo data block
05 data segment header(temp, index,
data and so on)
06 ktb managed data block(with itl)
07 temp table data block(no itl)
08 sort key
09 sort run
10 segment free list block
11 data file header
ub1 frmt_kcbh block format
1 oracle 7
2 oracle 8
ub1 spare1_kcbh not used
ub1 spare2_kcbh not used
ub4 rbda_kcbh rdba - relative data block address
ub4 bas_kcbh scn base
ub2 wrp_kcbh scn wrap
ub1 seq_kcbh sequence number, incremented for every
change made to the block at the same scn
ub1 flg_kcbh flag:
0x01 new block
0x02 delayed logging change
advanced scn/seq
0x04 check value saved - block
xor's to zero
0x08 temporary block
ub2 chkval_kcbh optional block checksum (if
db_block_checksum = true)
ub2 spare3_kcbh not used
------------------
struct ktbbh, 72 bytes transaction fixed header structure
ub1 ktbbhtyp block type
1 data
2 index
union ktbbhsid, 4 bytes segment / object id
struct ktbbhcsc, 8 bytes scn at last block cleanout
b2 ktbbhict number of itl slots
ub1 ktbbhflg 0 = on the freelist
ub1 ktbbhfs1 itl tx freelist slot
ub4 ktbbhfnx dba of next block on the freelist
struct ktbbhitl[2], 48 bytes itl list index
-------------------
struct kdbh, 14 bytes data header structure
ub1 kdbhflag n = pctfree hit(clusters);
f = do not put on freelist;
k = flushable cluster keys
b1 kdbhntab number of tables (> 1 in clusters)
b2 kdbhnrow number of rows
sb2 kdbhfrre first free row entry index;
-1 = you have to add one
sb2 kdbhfsbo freespace begin offset
sb2 kdbhfseo freespace end offset
b2 kdbhavsp available space in the block
b2 kdbhtosp total available space when all txs commit
--------------------
struct kdbt[1], 4 bytes table directory entry structure
b2 kdbtoffs
b2 kdbtnrow
--------------------
sb2 kdbr[1] row directory
ub1 freespace[8030] free space
ub1 rowdata[38] row data
ub4 tailchk
tailchecks:
the tail of an oracle 8 block is a concatenation of the lower order two bytes of the scn base, the block type and the scn sequence number.
e.g. if the scn base number is 0x00029728, the block type is 06 and the scn sequence number is 0x02, the tail check would be 0x97280602:
scn base type scn seq
9728 06 02
although this tail check value is generated from three components. oracle treats the final value as a single unsigned integer stored as a word(4 bytes). on little-endian architecture machines, which include intel, the value will be stores as low-order byte first.
阅读(3778) | 评论(0) | 转发(0) |