Data Blocks and Freelists (from ixora)[7]

[入库:2005年8月18日] [更新:2007年3月24日]

本文简介:选择自 youbo2004 的 blog

 
 

?

chained fetch ratio

29 march 2000

in my statistics i am getting
chained fetch ratio      0.3099       pctfree too low for a table
is there any way i can find out which table has pctfree too low?
 
? this could be chaining, rather than row migration. if it is row migration, and if your schema is analyzed, then our row_migration.sql script might help.
 
 
?

block headers

10 april 2000

i'm starting to take some blockdumps, but it is hard to know what i'm looking at. can you help me to understand what all those header fields are used for? they seem to take up quite a lot of space.
 
? there are three sets of header information, corresponding to the three layers of the oracle kernel that handle data blocks. i'll only explain the first two for now, because the third is too big a question to answer. firstly, all datafile blocks are written and read by the cache layer (kcb) generally through the database block buffer cache. there is a 20-byte header and 4-byte tail that are read and maintained by the cache layer. the cache layer header is also called the common block header.

blocks that contain user data are further interpreted and maintained by the transaction layer (ktb). these blocks have a transaction layer header immediately following the common block header. the transaction header is comprised of a 48-byte fixed header, including one 24-byte interested transaction slot, and a variable number of additional interested transaction list slots.

the remainder of each block, the data area, is used by the data layer (kd) to store user data. the data area contains a header, free space and row data. the internal structure of the data layer header and row data area is dependent on the block type. cluster blocks, table blocks, index branch blocks and index leaf blocks each have different stuctures. as i said, i'll not attempt to explain the structure of this area in detail for now, but i will tell you how big the headers are. here's how it looks in a diagram.

something here

the cache header and tail

this is what the cache header and tail look like in a block dump.

buffer tsn: 0 rdba: 0x004000f8 (1/248)
scn: 0x0000.0001ab63 seq: 0x01 flg: 0x00 tail: 0xab630601
frmt: 0x02 chkval: 0x0000 type: 0x06=trans data

the cache layer header is comprised of the following fields.

database
block address
4 bytes the tablespace relative database block address (rdba). this is constructed from the tablespace relative file number, and the block number of the data block within that file.
scn 6 bytes the scn at which the block was last changed. the low-order 4 bytes are called the scn base, and the high-order 2 bytes are called the scn wrap.
sequence 1 byte a sequence number incremented for each change to a block at the same scn. a new scn is allocated if the sequence number wraps.
flag 1 byte (i don't know.)
format 1 byte the format of the cache header was changed for oracle8. under oracle8, the value is always 2. previously, it was 1.
checksum 2 bytes an optional checksum of the block contents. when a block is written, the checksum is either cleared or set depending on the setting of the db_block_checksum parameter. when a block is read, the checksum is verified if present.
block type 1 byte the most common block types are:
1 = undo segment header block
2 = undo data block
5 = data segment header block
6 = data block
unused 4 bytes unused space, possibly for backward or forward compatibility.

the tail is comprised of the low-order two bytes of the scn base followed by the block type and the sequence number. the consistency of the header and tail is checked whenever a block is read. this detects most block corruptions, in particular split blocks from hot backups.

the transaction header

the transaction header consists of 24 bytes of control information followed by an array of one or more transaction slots. this array is called the interested transaction list (itl), and each slot may contain an interested transaction entry (ite). the initial number of itl slots is set by the initrans parameter for the segment, except that index branch blocks only have one slot. cluster and index segments have a minimum initrans value of 2. if there is sufficient free space in the data area of the block, additional transaction slots can be dynamically allocated as required, up to a limit dictated by the database block size or the maxtrans parameter for the segment.

this is what the transaction header looks like in a block dump.

block header dump:  0x00400035
object id on block? y
seg/obj: 0x2  csc: 0x00.21ab6  itc: 2  flg: -  typ: 1 - data
fsl: 0  fnx: 0x0 ver: 0x01

itl           xid                  uba         flag  lck        scn/fsc
0x01   xid:  0x0000.00f.00000005    uba: 0x0040000b.0000.12  c---    0  scn 0x0000.000000ac
0x02   xid:  0x0002.003.00000027    uba: 0x00c00004.0019.01  --u-    1  fsc 0x0000.00021b7c

the control information in the transaction header contains the following fields.

object number 4 bytes the object number of the segment in obj$.
cleanout scn 6 bytes the scn at which the last full cleanout was performed on the block.
itl count 1 byte number of entries in the itl.
flag 2 bytes a 0 indicates that the block is on a freelist. otherwise the flag is -.
block type 1 byte 1 = data
2 = index
itl
freelist slot
1 byte index to the first slot on the itl freelist.
next freelist
block
4 bytes the rdba of the next block on the segment freelist.
null if this block is not on a freelist.
version 1 byte (i don't know.)
unused 4 bytes unused space, possibly for backward or forward compatibility.

本文关键:Data Blocks and Freelists (from ixora)
  相关方案
Google
 

本站最佳浏览方式为 分辨率 1024x768 IE 6.0(或更高版本的 IE浏览器)

go top