FLM来管理的EXTENT
时间:2011-01-02 来源:oracle狂热分子
FLM来管理的EXTENT
1,首先创建一个segment space management manual的tablespace,然后在这个表中创建一个表,如;
SQL> select tablespace_name,segment_space_management from dba_tablespaces;
TABLESPACE_NAME SEGMEN
------------------------------ ------
SYSTEM MANUAL
UNDOTBS1 MANUAL
SYSAUX AUTO
TEMP MANUAL
USERS AUTO
TEST1 MANUAL SQL> select tablespace_name,segment_name from dba_segments where owner='SYS' and segment_name='TEST2'; TABLESPACE_NAME SEGMENT_NAME
------------------------------ ------------------------------
TEST1 TEST2
2,接下来对这个SEGMENT的HEADER BLOCK进行DUMP; SQL> select segment_name,header_file,header_block from dba_segments where segment_name='TEST2' and owner='SYS'; SEGMENT_NAME HEADER_FILE HEADER_BLOCK
------------------------------ ----------- ------------
TEST2 5 9 SQL> alter system dump datafile 5 block 9; System altered. 3,接下来分析TRACE文件,
Extent Control Header
-----------------------------------------------------------------
Extent Header:: spare1: 0 spare2: 0 #extents: 3 #blocks: 23
last map 0x00000000 #maps: 0 offset: 4128
Highwater:: 0x0140001e ext#: 2 blk#: 5 ext size: 8
#blocks in seg. hdr's freelists: 5
#blocks below: 20
mapblk 0x00000000 offset: 2
Unlocked
Map Header:: next 0x00000000 #extents: 3 obj#: 52310 flag: 0x40000000
Extent Map
-----------------------------------------------------------------
0x0140000a length: 7
0x01400011 length: 8
0x01400019 length: 8 nfl = 1, nfb = 1 typ = 1 nxf = 0 ccnt = 9
SEG LST:: flg: USED lhd: 0x01400019 ltl: 0x0140001d
End dump data blocks tsn: 8 file#: 5 minblk 9 maxblk 9
倒数第二行和第三行的数据结构是FREE LIST AREA的部分
nfl = 1, nfb = 1 typ = 1 nxf = 0 ccnt = 9
SEG LST:: flg: USED lhd: 0x01400019 ltl: 0x0140001d FLG表示是否使用了FLM的管理方式,LHD表示FREE LIST的第一块的DBA地址,LTL表示了FREE LIST最后一块的地址;Highwater:: 0x0140001e表示了INSERT INTO操作的开始的数据块的DBA
对于每个数据块,都有一个FLC字段,用来表示该块已连链接到一个FREE LIST,FLC的NEXT DBA为0则表示该块为最FREE LIST的最后一块.当DL请求一个新的数据块用来进行UPDATE操作时,必须从FREE LIST头部开始进行查找,一直到找到足够的空间为止,随着表不断增大时,更新操作的查找空间需要的时间越来越长,从而影响性能.
------------------------------ ------
SYSTEM MANUAL
UNDOTBS1 MANUAL
SYSAUX AUTO
TEMP MANUAL
USERS AUTO
TEST1 MANUAL SQL> select tablespace_name,segment_name from dba_segments where owner='SYS' and segment_name='TEST2'; TABLESPACE_NAME SEGMENT_NAME
------------------------------ ------------------------------
TEST1 TEST2
2,接下来对这个SEGMENT的HEADER BLOCK进行DUMP; SQL> select segment_name,header_file,header_block from dba_segments where segment_name='TEST2' and owner='SYS'; SEGMENT_NAME HEADER_FILE HEADER_BLOCK
------------------------------ ----------- ------------
TEST2 5 9 SQL> alter system dump datafile 5 block 9; System altered. 3,接下来分析TRACE文件,
Extent Control Header
-----------------------------------------------------------------
Extent Header:: spare1: 0 spare2: 0 #extents: 3 #blocks: 23
last map 0x00000000 #maps: 0 offset: 4128
Highwater:: 0x0140001e ext#: 2 blk#: 5 ext size: 8
#blocks in seg. hdr's freelists: 5
#blocks below: 20
mapblk 0x00000000 offset: 2
Unlocked
Map Header:: next 0x00000000 #extents: 3 obj#: 52310 flag: 0x40000000
Extent Map
-----------------------------------------------------------------
0x0140000a length: 7
0x01400011 length: 8
0x01400019 length: 8 nfl = 1, nfb = 1 typ = 1 nxf = 0 ccnt = 9
SEG LST:: flg: USED lhd: 0x01400019 ltl: 0x0140001d
End dump data blocks tsn: 8 file#: 5 minblk 9 maxblk 9
倒数第二行和第三行的数据结构是FREE LIST AREA的部分
nfl = 1, nfb = 1 typ = 1 nxf = 0 ccnt = 9
SEG LST:: flg: USED lhd: 0x01400019 ltl: 0x0140001d FLG表示是否使用了FLM的管理方式,LHD表示FREE LIST的第一块的DBA地址,LTL表示了FREE LIST最后一块的地址;Highwater:: 0x0140001e表示了INSERT INTO操作的开始的数据块的DBA
对于每个数据块,都有一个FLC字段,用来表示该块已连链接到一个FREE LIST,FLC的NEXT DBA为0则表示该块为最FREE LIST的最后一块.当DL请求一个新的数据块用来进行UPDATE操作时,必须从FREE LIST头部开始进行查找,一直到找到足够的空间为止,随着表不断增大时,更新操作的查找空间需要的时间越来越长,从而影响性能.
相关阅读 更多 +