通过dump数据块信息,追溯三层结构位图信息

建表并查看数据所在的文件及段头(也就是L3块):

SQL> CREATE TABLESPACE tbs1 DATAFILE '/data1/oradata/ora1/tps101.dbf' SIZE 100M uniform size 1M;
SQL> create table ma.t64(id number(5),name varchar2(10)) tablespace tbs1;
SQL> insert into ma.t64 values(1,'a1');
SQL> commit;		 
SQL> select owner,segment_name,header_file,header_block from dba_segments where owner='MA' and segment_name='T64';

OWNER      SEGMENT_NAME    HEADER_FILE HEADER_BLOCK
---------- --------------- ----------- ------------
MA         T64                       7          131

由以上代码可知段头在7号文件的131号块,通过dump L3块的信息查看它里面存放的L2块的相关信息,dump信息在trace文件的最后面

SQL> alter system dump datafile 7 block 131;
$ cd $ORACLE_BASE/diag/rdbms/$ORACLE_SID/$ORACLE_SID/trace
$ ll -rt
$ vim  ora1_ora_2514.trc

Start dump data blocks tsn: 10 file#:7 minblk 131 maxblk 131
Block dump from cache:
Dump of buffer cache at level 4 for pdb=0 tsn=10 rdba=29360259
BH (0x96fdc118) file#: 7 rdba: 0x01c00083 (7/131) class: 4 ba: 0x96c6a000
  set: 5 pool: 3 bsz: 8192 bsi: 0 sflg: 2 pwc: 0,0
  dbwrid: 0 obj: 93621 objn: 93621 tsn: [0/10] afn: 7 hint: f
  hash: [0xd1bc8558,0xd1bc8558] lru: [0x96fdc340,0x96fdc0c0]
  ckptq: [NULL] fileq: [NULL]
  objq: [0x96fdc0e8,0x96fdbe68] objaq: [0xc2011120,0x96fdc0f8]
  st: XCURRENT md: NULL fpin: 'ktswh03: ktscts' fscn: 0x0.41bade tch: 5
  flags: block_written_once
  LRBA: [0x0.0.0] LSCN: [0x0.0] HSCN: [0xffff.ffffffff] HSUB: [2]
Block dump from disk:
Decrypting encrypted buffer before dump.
buffer tsn: 10 rdba: 0x01c00083 (7/131)
scn: 0x0.41bae5 seq: 0x02 flg: 0x04 tail: 0xbae52302
frmt: 0x02 chkval: 0xc707 type: 0x23=PAGETABLE SEGMENT HEADER
Hex dump of block: st=0, typ_found=1
Dump of memory from 0x00007F2D3BE2C000 to 0x00007F2D3BE2E000
7F2D3BE2C000 0000A223 01C00083 0041BAE5 04020000  [#.........A.....]
              ......
7F2D3BE2DFF0 00000000 00000000 00000000 BAE52302  [.............#..]
  Extent Control Header
  -----------------------------------------------------------------
  Extent Header:: spare1: 0      spare2: 0      #extents: 1      #blocks: 128
                  last map  0x00000000  #maps: 0      offset: 2716
      Highwater::  0x01c00100  ext#: 0      blk#: 128    ext size: 128
  #blocks in seg. hdr's freelists: 0
  #blocks below: 124
  mapblk  0x00000000  offset: 0
                   Unlocked
  --------------------------------------------------------
  Low HighWater Mark :
      Highwater::  0x01c00084  ext#: 0      blk#: 4      ext size: 128
  #blocks in seg. hdr's freelists: 0
  #blocks below: 0
  mapblk  0x00000000  offset: 0
  Level 1 BMB for High HWM block: 0x01c00081
  Level 1 BMB for Low HWM block: 0x01c00080
  --------------------------------------------------------
  Segment Type: 1 nl2: 1      blksz: 8192   fbsz: 0
  L2 Array start offset:  0x00001434
  First Level 3 BMB:  0x00000000
  L2 Hint for inserts:  0x01c00082                                    //L2用的是130号块
  Last Level 1 BMB:  0x01c00081
  Last Level II BMB:  0x01c00082
  Last Level III BMB:  0x00000000
     Map Header:: next  0x00000000  #extents: 1    obj#: 93621  flag: 0x10000000
  Inc # 0
  Extent Map
  -----------------------------------------------------------------
   0x01c00080  length: 128

  Auxillary Map
  --------------------------------------------------------
   Extent 0     :  L1 dba:  0x01c00080 Data dba:  0x01c00084
  --------------------------------------------------------

   Second Level Bitmap block DBAs
   --------------------------------------------------------
   DBA 1:   0x01c00082

End dump data blocks tsn: 10 file#: 7 minblk 131 maxblk 131

L3块的dump信息中只记录了一个L2块信息,L2块是130号块,随着数据增多,L2块也会增多。可以通过'L2 Hint for inserts'关键字知道L3块会使用哪个L2块。

再通过L2块找L1块:

Block dump from cache:
Dump of buffer cache at level 4 for pdb=0 tsn=10 rdba=29360258
BH (0x96f87758) file#: 7 rdba: 0x01c00082 (7/130) class: 9 ba: 0x963f4000
  set: 6 pool: 3 bsz: 8192 bsi: 0 sflg: 2 pwc: 0,19
  dbwrid: 0 obj: 93621 objn: 93621 tsn: [0/10] afn: 7 hint: f
  hash: [0xd1862778,0xd1862778] lru: [0x96f87980,0x96f87700]
  ckptq: [NULL] fileq: [NULL]
  objq: [0x96f87728,0x96f87228] objaq: [0xc2017420,0x96f87738]
  st: XCURRENT md: NULL fpin: 'ktspswh4: ktspfsbmb' fscn: 0x0.41bade tch: 5
  flags: block_written_once
  LRBA: [0x0.0.0] LSCN: [0x0.0] HSCN: [0xffff.ffffffff] HSUB: [3]
Block dump from disk:
Decrypting encrypted buffer before dump.
buffer tsn: 10 rdba: 0x01c00082 (7/130)
scn: 0x0.41bade seq: 0x02 flg: 0x04 tail: 0xbade2102
frmt: 0x02 chkval: 0xead5 type: 0x21=SECOND LEVEL BITMAP BLOCK
Hex dump of block: st=0, typ_found=1
Dump of memory from 0x00007F2D3BE2C000 to 0x00007F2D3BE2E000
7F2D3BE2C000 0000A221 01C00082 0041BADE 04020000  [!.........A.....]
           ......
7F2D3BE2DFF0 00000000 00000000 00000000 BADE2102  [.............!..]
Dump of Second Level Bitmap Block
   number: 2       nfree: 2       ffree: 0      pdba:     0x01c00083
   Inc #: 0 Objd: 93621
  opcode:0
 xid:
  L1 Ranges :
  --------------------------------------------------------
   0x01c00080  Free: 5 Inst: 1
   0x01c00081  Free: 5 Inst: 1

  --------------------------------------------------------
End dump data blocks tsn: 10 file#: 7 minblk 130 maxblk 130

L2块的dump信息中可以看到记录了2个L1块信息,分别是128、129号块。ASSM是通过对PID做HASH运算,得到一个随机值N,选取此L2块中的第N个L1块中的数据块来插入数据。

通过128号L1块找数据块信息:

Start dump data blocks tsn: 10 file#:7 minblk 128 maxblk 128
Block dump from cache:
Dump of buffer cache at level 4 for pdb=0 tsn=10 rdba=29360256
BH (0x96fdbfd8) file#: 7 rdba: 0x01c00080 (7/128) class: 8 ba: 0x96c68000
  set: 5 pool: 3 bsz: 8192 bsi: 0 sflg: 2 pwc: 0,0
  dbwrid: 0 obj: 93621 objn: 93621 tsn: [0/10] afn: 7 hint: f
  hash: [0xd1716bb8,0xd1716bb8] lru: [0x96fdc200,0x96fdbf80]
  ckptq: [NULL] fileq: [NULL]
  objq: [0xc2011130,0x96fdc228] objaq: [0x96fdc238,0x96fdbe78]
  st: XCURRENT md: NULL fpin: 'ktspfwh6: ktspffbmb' fscn: 0x0.41bade tch: 2
  flags: block_written_once
  LRBA: [0x0.0.0] LSCN: [0x0.0] HSCN: [0xffff.ffffffff] HSUB: [3]
Block dump from disk:
Decrypting encrypted buffer before dump.
buffer tsn: 10 rdba: 0x01c00080 (7/128)
scn: 0x0.41bae5 seq: 0x03 flg: 0x04 tail: 0xbae52003
frmt: 0x02 chkval: 0xfbbd type: 0x20=FIRST LEVEL BITMAP BLOCK
Hex dump of block: st=0, typ_found=1
Dump of memory from 0x00007F2D3BE2C000 to 0x00007F2D3BE2E000
7F2D3BE2C000 0000A220 01C00080 0041BAE5 04030000  [ .........A.....]
                  ......
7F2D3BE2DFF0 00000000 00000000 00000000 BAE52003  [............. ..]
Dump of First Level Bitmap Block
 --------------------------------
   nbits : 4 nranges: 1         parent dba:  0x01c00082   poffset: 0
   unformatted: 44      total: 64        first useful block: 4              //共64个数据块
   owning instance : 1
   instance ownership changed at 04/12/2019 08:29:37
   Last successful Search 04/12/2019 08:29:37
   Freeness Status:  nf1 0      nf2 0      nf3 0      nf4 16

   Extent Map Block Offset: 4294967295
   First free datablock : 4
   Bitmap block lock opcode 0
   Locker xid:     :  0x0000.000.00000000
   Dealloc scn: 3.0
   Flag: 0x00000000 (-/-/-/-/-/-)
   Inc #: 0 Objd: 93621
  --------------------------------------------------------
  DBA Ranges :
  --------------------------------------------------------
   0x01c00080  Length: 64     Offset: 0

   0:Metadata   1:Metadata   2:Metadata   3:Metadata
   4:unformatted   5:unformatted   6:unformatted   7:unformatted
   8:unformatted   9:unformatted   10:unformatted   11:unformatted
   12:unformatted   13:unformatted   14:unformatted   15:unformatted
   16:unformatted   17:unformatted   18:unformatted   19:unformatted
   20:unformatted   21:unformatted   22:unformatted   23:unformatted
   24:unformatted   25:unformatted   26:unformatted   27:unformatted
   28:unformatted   29:unformatted   30:unformatted   31:unformatted
   32:75-100% free   33:75-100% free   34:75-100% free   35:75-100% free
   36:75-100% free   37:75-100% free   38:75-100% free   39:75-100% free
   40:75-100% free   41:75-100% free   42:75-100% free   43:75-100% free
   44:75-100% free   45:75-100% free   46:75-100% free   47:75-100% free
   48:unformatted   49:unformatted   50:unformatted   51:unformatted
   52:unformatted   53:unformatted   54:unformatted   55:unformatted
   56:unformatted   57:unformatted   58:unformatted   59:unformatted
   60:unformatted   61:unformatted   62:unformatted   63:unformatted
  --------------------------------------------------------
End dump data blocks tsn: 10 file#: 7 minblk 128 maxblk 128

128号L1块中记录了64个数据块信息。ASSM是通过对PID做HASH运算,得到一个随机值M,选取此L1块中的第M个数据块来插入数据。

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值