在 oracle 中,在创建一些对象(TYPE2 UNDO,TABLE PARTITION,TABLE,ROLLBACK,NESTED,TABLE,LOBSEGMENT,LOBINDEX,LOB PARTITION,INDEX PARTITION,INDEX,CLUSTER) ,oracle都会给他们分配一个段,但段要扩展空间的时候,就会在 header_file+header_block 中找到段头(L3 BMB),从L3中找到L2,从L1中找到可用块:
1:先创建表 test,并插入数据
-
SQL> create table test1(id1 number,id2 number);
-
Table created
-
-
SQL> insert into superman.test1 values(1,1);
-
1 row created.
-
SQL> commit;
-
Commit complete.
2:查询出test1的段头
-
SQL> select header_file,header_block,segment_name from dba_segments
-
2 where owner='SUPERMAN';
-
-
HEADER_FILE HEADER_BLOCK SEGMENT_NAME
-
----------- ------------ ---------------------------------------------------------------------------------
-
-
7 131 BIN$uDHNh3dH+9XgQAB/AQAOkg==$0
-
6 130 PEOPLEINFO
-
6 29442 TAB1
-
6 29466 TEST1
-
7 17026 SFZ_INDEX
-
SQL>
3:转储段头
-
SQL> alter system dump datafile 6 block 29466
截取了转储文件中的部分信息进行观察:
-
Extent Control Header
-
-----------------------------------------------------------------
-
Extent Header:: spare1: 0 spare2: 0 #extents: 1 #blocks: 8
-
last map 0x00000000 #maps: 0 offset: 2716
-
Highwater:: 0x01807320 ext#: 0 blk#: 8 ext size: 8
-
#blocks in seg. hdr's freelists: 0
-
#blocks below: 5
-
mapblk 0x00000000 offset: 0
-
Unlocked
-
--------------------------------------------------------
-
Low HighWater Mark :
-
Highwater:: 0x01807320 ext#: 0 blk#: 8 ext size: 8
-
#blocks in seg. hdr's freelists: 0
-
#blocks below: 5
-
mapblk 0x00000000 offset: 0
-
Level 1 BMB for High HWM block: 0x01807318
-
Level 1 BMB for Low HWM block: 0x01807318
-
--------------------------------------------------------
-
Segment Type: 1 nl2: 1 blksz: 8192 fbsz: 0
-
L2 Array start offset: 0x00001434
-
First Level 3 BMB: 0x00000000
-
L2 Hint for inserts: 0x01807319
-
Last Level 1 BMB: 0x01807318
-
Last Level II BMB: 0x01807319
-
Last Level III BMB: 0x00000000
-
Map Header:: next 0x00000000 #extents: 1 obj#: 73518 flag: 0x10000000
-
Inc # 0
-
Extent Map
-
-----------------------------------------------------------------
-
0x01807318 length: 8
-
-
Auxillary Map
-
--------------------------------------------------------
-
Extent 0 : L1 dba: 0x01807318 Data dba: 0x0180731b
-
--------------------------------------------------------
-
-
Second Level Bitmap block DBAs
-
--------------------------------------------------------
-
DBA 1: 0x01807319
-
-
End dump data blocks tsn: 6 file#: 6 minblk 29466 maxblk 29466
从上面的转储信息中就可以看到二级 bmb是 0x01807319(file 6 block 29465)一级 bmb 0x01807318(file 6 block 29464)
4:现在转出 二级 bmb,并截取部分信息进行观察
-
Dump of Second Level Bitmap Block
-
number: 1 nfree: 1 ffree: 0 pdba: 0x0180731a
-
Inc #: 0 Objd: 73518
-
opcode:0
-
xid:
-
L1 Ranges :
-
--------------------------------------------------------
-
0x01807318 Free: 5 Inst: 1
-
-
--------------------------------------------------------
-
End dump data blocks tsn: 6 file#: 6 minblk 29465 maxblk 29465
5:从二级bmb 中可以看出 指向一级bmb 的 块地址0x01807318(file 6 block 29464)
再转储一级bmb
-
Dump of First Level Bitmap Block
-
--------------------------------
-
nbits : 4 nranges: 1 parent dba: 0x01807319 poffset: 0
-
unformatted: 0 total: 8 first useful block: 3
-
owning instance : 1
-
instance ownership changed at 02/07/2012 11:48:49
-
Last successful Search 02/07/2012 11:48:49
-
Freeness Status: nf1 0 nf2 0 nf3 0 nf4 5
-
-
Extent Map Block Offset: 4294967295
-
First free datablock : 3
-
Bitmap block lock opcode 0
-
Locker xid: : 0x0000.000.00000000
-
Inc #: 0 Objd: 73518
-
HWM Flag: HWM Set
-
Highwater:: 0x01807320 ext#: 0 blk#: 8 ext size: 8
-
#blocks in seg. hdr's freelists: 0
-
#blocks below: 5
-
mapblk 0x00000000 offset: 0
-
--------------------------------------------------------
-
DBA Ranges :
-
--------------------------------------------------------
-
0x01807318 Length: 8 Offset: 0
-
-
0:Metadata 1:Metadata 2:Metadata 3:75-100% free
-
4:75-100% free 5:75-100% free 6:75-100% free 7:75-100% free
-
--------------------------------------------------------
这里我们可以看到一些信息了,这里我们可以把0x01807318 看做是起始地址,0:Metadata 1:Metadata 2:Metadata 3:75-100% free 4:75-100% free 5:75-100% free 6:75-100% free 7:75-100% free,前面的一些数字可以看做是偏移量,这里可以得出这段包含了 0x01807318- 0x0180731f 这8个块,其中0x01807318- 0x0180731a 这3个块是存放元数据的,既段的3个BMB,另外5个块都是可以用来存放表中的数据的!
阅读(2800) | 评论(0) | 转发(0) |