首先什么是段头?
The segment header is the header block of the first extent of a segment. In Free List Managed (FLM) segments the header block is always the first block of a segment. In Automatic Segment Space Managed (ASSM) segments, the bitmap blocks always appear before the header block within the first extent of the segment.
The segment header contains information on the extents allocated to the segment and free space within the segment.
接着我们来看oracle里段头的具体类型:
0x01
undo segment header
0x0b
data file header
0x0c
data segment header with FLG blocks
0x0e
unlimited undo segment header
0x0f
unlimited save undo segment header
0x10
unlimited data segment header
0x11
unlimited data segment header with FLG blocks
0x12
extent map block
0x17
bitmapped segment header
0x1d
bitmapped file space header
0x20
first level bitmap block
0x21
second level bitmap block
0x22
third level bitmap block
0x23
Pagetable segment header block
0x24
Pagetable extent map block
0x25
System Managed Undo Extent Map Block
然后我们来看一个ASSM的实例:
SQL> create tablespace testlmt datafile '/dras20/astca/testlmt01.dbf' size 10M extent management local uniform size 1m segment space management auto;
Tablespace created
SQL> create table testlmttb tablespace testlmt as select * from dba_objects;
Table created
SQL> select extent_id,file_id,block_id,bytes from dba_extents where segment_name='TESTLMTTB';
EXTENT_ID
FILE_ID
BLOCK_ID
BYTES
---------- ---------- ---------- ----------
0
138
9
1048576
1
138
137
1048576
2
138
265
1048576
3
138
393
1048576
1、datafile header,即段头类型为0x0b
BBED> set file 138
FILE#
138
BBED> set block 1
BLOCK#
1
BBED> dump
File: /dras20/astca/testlmt01.dbf (138)
Block: 1
Offsets:
0 to
511
Dba:0x22800001
------------------------------------------------------------------------
0b020000 22800001 00000000 00000104 4bbb0000 09200000 08000000 df7fd2dd
41535443 41000000 000102df 00000500 00002000 008a0003 00000000 00000000
......省略显示部分内容
00000000 00000000 00000000 00000059 00075445 53544c4d 54000000 00000000
<32 bytes per line>
2、bitmapped file space header,即段头类型为0x1d
BBED> set block 2
BLOCK#
2
BBED> dump
File: /dras20/astca/testlmt01.dbf (138)
Block: 2
Offsets:
0 to
511
Dba:0x22800002
------------------------------------------------------------------------
1d020000 22800002 aa35c791 00080204 8a370000 0000008a 00000080 00000500
00000001 00000000 00000000 00000007 00000488 00000004 00000005 00000000
......省略显示部分内容
00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
<32 bytes per line>
3、ASSM里的first level bitmap block,即L1 BMB,段头类型为0x20
BBED> set block 9
BLOCK#
9
BBED> dump
File: /dras20/astca/testlmt01.dbf (138)
Block: 9
Offsets:
0 to
511
Dba:0x22800009
------------------------------------------------------------------------
20020000 22800009 aa35c793 00080304 8ef60000 00000000 00000000 00000000
00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
......省略显示部分内容
00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
<32 bytes per line>
这里Block 137、138、265、266、393、394也是L1 BMB。
4、ASSM里的second level bitmap block,即L2 BMB,段头类型为0x21
BBED> set block 11
BLOCK#
11
BBED> dump
File: /dras20/astca/testlmt01.dbf (138)
Block: 11
Offsets:
0 to
511
Dba:0x2280000b
------------------------------------------------------------------------
21020000 2280000b aa35c793 00080804 a63a0000 00000000 00000000 00000000
00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
......省略显示部分内容
00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
<32 bytes per line>