免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
最近访问板块 发新帖
查看: 3442 | 回复: 3
打印 上一主题 下一主题

Oracle里段头的类型 [复制链接]

论坛徽章:
0
跳转到指定楼层
1 [收藏(0)] [报告]
发表于 2011-02-14 13:11 |只看该作者 |倒序浏览

首先什么是段头?

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

1datafile 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>

2bitmapped 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>

3ASSM里的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 137138265266393394也是L1 BMB

4ASSM里的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>

论坛徽章:
0
2 [报告]
发表于 2011-02-14 13:12 |只看该作者

5ASSM里的Pagetable segment header block,即大家从dba_segmentsselect出来的ASSM下的"段头",段头类型为0x23

SQL> select HEADER_FILE,HEADER_BLOCK from dba_segments where segment_name='TESTLMTTB';

HEADER_FILE HEADER_BLOCK

----------- ------------


138
12

BBED> set block 12


BLOCK#
12

BBED> dump


File: /dras20/astca/testlmt01.dbf (138)


Block: 12
Offsets:
0 to
511
Dba:0x2280000c

------------------------------------------------------------------------

23020000 2280000c aa35c797 00080104 c59e0000 00000000 00000000 00000000


00000000 00000004 00000200 0a9c0000 00000003 0000004b 00000080 228001d4


......省略显示部分内容


00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000


<32 bytes per line>

最后我们来看一个MSSM的实例:

因为是9i,所以system表空间就是MSSM

6unlimited undo segment header,其实就是系统回滚段的段头,段头类型为0x0e

SQL> select HEADER_FILE,HEADER_BLOCK from dba_segments where segment_name='SYSTEM';

HEADER_FILE HEADER_BLOCK

----------- ------------


1
9

BBED> set file 1


FILE#
1

BBED> set block 9


BLOCK#
9

BBED> dump


File: /dras11/oradata/astca/system01.dbf (1)


Block: 9
Offsets:
0 to
511
Dba:0x00400009

------------------------------------------------------------------------

0e020000 00400009 aa340432 00080104 cc3f0000 00000000 00000000 00000000


00000000 00000006 0000002f 10200000 00000001 00000006 00000008 00400017


......省略显示部分内容


00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000


<32 bytes per line>

7MSSM里的unlimited data segment header,即大家从dba_segmentsselect出来的MSSM下的"段头",段头类型为0x10

SQL> select HEADER_FILE,HEADER_BLOCK from dba_segments where segment_name='OBJ$';

HEADER_FILE HEADER_BLOCK

----------- ------------


1
121

BBED> set file 1


FILE#
1

BBED> set block 121


BLOCK#
121

BBED> map /v


File: /dras11/oradata/astca/system01.dbf (1)


Block: 121
Dba:0x00400079

------------------------------------------------------------


Unlimited Data Segment Header


struct kcbh, 20 bytes
@0


ub1 type_kcbh

@0


......省略显示部分内容


ub2 spare3_kcbh
@18


struct ktech, 72 bytes
@20


ub4 spare1_ktech
@20


......省略显示部分内容


ub4 flag_ktech

@88


struct ktemh, 16 bytes
@92


ub4 count_ktemh
@92


ub4 next_ktemh
@96


ub4 obj_ktemh
@100


ub4 flag_ktemh
@104


struct ktetb[19], 152 bytes
@108


ub4 ktetbdba
@108


ub4 ktetbnbk
@112

......省略显示部分内容


ub4 tailchk

@8188

BBED> set offset 96


OFFSET
96

BBED> dump


File: /dras11/oradata/astca/system01.dbf (1)


Block: 121
Offsets:
96 to
607
Dba:0x00400079

------------------------------------------------------------------------


00000000 00000012 40000000 0040007a 00000007 00401169 00000008 004011f9


00000008 00401309 00000008 00401661 00000008 00402049 00000008 00403191


......省略显示部分内容


00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000


<32 bytes per line>

BBED> set offset 0


OFFSET
0

BBED> dump


File: /dras11/oradata/astca/system01.dbf (1)


Block: 121
Offsets:
0 to
511
Dba:0x00400079

------------------------------------------------------------------------

10020000 00400079 aa2de25f 00080104 e69d0000 00000000 00000000 00000000


00000000 00000013 000001ff 10200000 00000012 00000014 00000080 0040d91d


......省略显示部分内容


00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000


<32 bytes per line>

论坛徽章:
59
2015七夕节徽章
日期:2015-08-24 11:17:25ChinaUnix专家徽章
日期:2015-07-20 09:19:30每周论坛发贴之星
日期:2015-07-20 09:19:42ChinaUnix元老
日期:2015-07-20 11:04:38荣誉版主
日期:2015-07-20 11:05:19巳蛇
日期:2015-07-20 11:05:26CU十二周年纪念徽章
日期:2015-07-20 11:05:27IT运维版块每日发帖之星
日期:2015-07-20 11:05:34操作系统版块每日发帖之星
日期:2015-07-20 11:05:36程序设计版块每日发帖之星
日期:2015-07-20 11:05:40数据库技术版块每日发帖之星
日期:2015-07-20 11:05:432015年辞旧岁徽章
日期:2015-07-20 11:05:44
3 [报告]
发表于 2011-02-14 13:40 |只看该作者
都在搞高兴的内容(此处略掉60字)

论坛徽章:
0
4 [报告]
发表于 2011-02-14 14:01 |只看该作者
http://dbsnake.com/2009/09/oracle-seg-hdr-type.html
看原文吧    转的有些乱
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

北京盛拓优讯信息技术有限公司. 版权所有 京ICP备16024965号-6 北京市公安局海淀分局网监中心备案编号:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年举报专区
中国互联网协会会员  联系我们:huangweiwei@itpub.net
感谢所有关心和支持过ChinaUnix的朋友们 转载本站内容请注明原作者名及出处

清除 Cookies - ChinaUnix - Archiver - WAP - TOP