打印本文 打印本文 关闭窗口 关闭窗口
oracle block 格式
作者:武汉SEO闵涛  文章来源:敏韬网  点击数3009  更新时间:2009/4/22 22:08:00  文章录入:mintao  责任编辑:mintao
back 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: 0x1fb8
hsiz: 0x14
pbl: 0x02476c44
bdba: 0x01000003
flag=-----------
ntab=1
nrow=1
frre=-1
fsbo=0x14
fseo=0x1fb2
avsp=0x1f9b
tosp=0x1f9b
0xe:pti[0] nrow=1 offs=0
0x12:pri[0] offs=0x1fb2

---       tsiz:    hsiz:   pbl:   bdba: 在数据文件都是没有存储的
--- tsiz:        除了上面的3部分和block尾部的4个字节剩下的空间 0x1fb8就是8120字节  8k的block:
---              8192-20(block head)-24(Transaction Header)-24(一个事务条)-4(block tail)=8120
--- hsiz:        数据块头20个字节+数据块尾4个字节=24字节(0x14)
--- 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, @0x1fb2
tl: 6 fb: --H-FL-- lb: 0x1 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;

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

       下面的数据就是上面的 dump 文件对应的2进制文件  我依照 2 进制数据的顺序解释内容

------------------------  下面的对应上面dump 文件的第一部分
Offset      0  1  2  3  4  5  6  7   8  9  A  B  C  D  E  F

00006000   06 02 00 00 03 00 00 01  A5 02 08 00 00 00 01 02  
00006010   00 00 00 00

--- 06               :   type: 0x06=trans data (对应上面dump文件中的内容)
--- 02               :   frmt: 0x02
--- 00 00            :   filler  应该是 unused  上面的dump文件中并没有显示这部分内容
--- 03 00 00 01      :   rdba: 0x01000003 在同一个 tablespace 中是唯一的 当 datafile 中可能不唯一
---                        来看看他的规律 :连续建4个 datafile  他们的第一block为
---                        0x 01 00 04 01
---                        0x 01 00 08 01
---                        0x 01 00 0c 01
---                        0x 01 00 00 02
---                        对应的数据在是 0x01040001 , 0x01080001 , 0x010c0001 , 0x02000001
---       

上一页  [1] [2] [3] [4]  下一页

打印本文 打印本文 关闭窗口 关闭窗口