转载

Oracle ASM Allocation Table

Allocation Table(AT)
每个ASM磁盘有一个Allocation Table来描述磁盘的内容。在disk中对于每个AU,AT都有一个条目llocation Table Entry(ATE)。如果AU被分配给一个ASM文件,它们包含了文件号与区号

查找Allocation Table
在ASM磁盘头(filed kfdhdb.altlocn)存储了Allocation Table的第一个块所存储的位置。在下面的例子中,显示了AT存储在块2.

SQL> select group_number,disk_number,state,name,path from v$asm_disk where group_number3;

GROUP_NUMBER DISK_NUMBER STATE                          NAME                           PATH
------------ ----------- ------------------------------ ------------------------------ ------------------------------
           3           0 NORMAL                         DATADG_0001                    /dev/raw/raw11
           3           3 NORMAL                         DATADG_0000                    /dev/raw/raw10
           3           1 NORMAL                         DATADG_0003                    /dev/raw/raw4
           3           2 NORMAL                         DATADG_0002                    /dev/raw/raw3

[oracle@jyrac1 ~]$ kfed read /dev/raw/raw10 | grep kfdhdb.altlocn
kfdhdb.altlocn:                       2 ; 0x0d0: 0x00000002

下面详细查看一下Allocation Table的第一个块

[oracle@jyrac1 ~]$ kfed read /dev/raw/raw10 blkn=2 | more
kfbh.endian:                          1 ; 0x000: 0x01
kfbh.hard:                          130 ; 0x001: 0x82
kfbh.type:                            3 ; 0x002: KFBTYP_ALLOCTBL
kfbh.datfmt:                          2 ; 0x003: 0x02
kfbh.block.blk:                       2 ; 0x004: blk=2
kfbh.block.obj:              2147483651 ; 0x008: disk=3
kfbh.check:                  2183627135 ; 0x00c: 0x8227817f
kfbh.fcn.base:                     1453 ; 0x010: 0x000005ad
kfbh.fcn.wrap:                        0 ; 0x014: 0x00000000
kfbh.spare1:                          0 ; 0x018: 0x00000000
kfbh.spare2:                          0 ; 0x01c: 0x00000000
kfdatb.aunum:                         0 ; 0x000: 0x00000000
kfdatb.shrink:                      448 ; 0x004: 0x01c0
kfdatb.ub2pad:                        0 ; 0x006: 0x0000
kfdatb.auinfo[0].link.next:           8 ; 0x008: 0x0008
kfdatb.auinfo[0].link.prev:           8 ; 0x00a: 0x0008
kfdatb.auinfo[1].link.next:          12 ; 0x00c: 0x000c
kfdatb.auinfo[1].link.prev:          12 ; 0x00e: 0x000c
kfdatb.auinfo[2].link.next:          16 ; 0x010: 0x0010
kfdatb.auinfo[2].link.prev:          16 ; 0x012: 0x0010
kfdatb.auinfo[3].link.next:          20 ; 0x014: 0x0014
kfdatb.auinfo[3].link.prev:          20 ; 0x016: 0x0014
kfdatb.auinfo[4].link.next:          24 ; 0x018: 0x0018
kfdatb.auinfo[4].link.prev:          24 ; 0x01a: 0x0018
kfdatb.auinfo[5].link.next:          28 ; 0x01c: 0x001c
kfdatb.auinfo[5].link.prev:          28 ; 0x01e: 0x001c
kfdatb.auinfo[6].link.next:          32 ; 0x020: 0x0020
kfdatb.auinfo[6].link.prev:          32 ; 0x022: 0x0020
kfdatb.spare:                         0 ; 0x024: 0x00000000
kfdate[0].discriminator:              1 ; 0x028: 0x00000001
kfdate[0].allo.lo:                    0 ; 0x028: XNUM=0x0
kfdate[0].allo.hi:              8388608 ; 0x02c: V=1 I=0 H=0 FNUM=0x0
kfdate[1].discriminator:              1 ; 0x030: 0x00000001
kfdate[1].allo.lo:                    0 ; 0x030: XNUM=0x0
kfdate[1].allo.hi:              8388608 ; 0x034: V=1 I=0 H=0 FNUM=0x0
kfdate[2].discriminator:              1 ; 0x038: 0x00000001
kfdate[2].allo.lo:                    0 ; 0x038: XNUM=0x0
kfdate[2].allo.hi:              8388611 ; 0x03c: V=1 I=0 H=0 FNUM=0x3
kfdate[3].discriminator:              1 ; 0x040: 0x00000001
kfdate[3].allo.lo:                    4 ; 0x040: XNUM=0x4
kfdate[3].allo.hi:              8388611 ; 0x044: V=1 I=0 H=0 FNUM=0x3
kfdate[4].discriminator:              1 ; 0x048: 0x00000001
kfdate[4].allo.lo:                    8 ; 0x048: XNUM=0x8
kfdate[4].allo.hi:              8388611 ; 0x04c: V=1 I=0 H=0 FNUM=0x3

从kfdatb.aunum=0,可知AU0是AT块中的第一个AU。kfdatb.shrink=448,意味着AT块可以容纳448个AU的信息。按着这个逻辑我们应该在下一个AT块中看到kfdatb.aunum=448

[oracle@jyrac1 ~]$ kfed read /dev/raw/raw10 blkn=3 | grep kfdatb.aunum
kfdatb.aunum:                       448 ; 0x000: 0x000001c0

以此类推,在一下AT块中将看到kfdatb.aunum=896:

[oracle@jyrac1 ~]$ kfed read /dev/raw/raw10 blkn=4 | grep kfdatb.aunum
kfdatb.aunum:                       896 ; 0x000: 0x00000380

Allocation table条目
对于分配的AUs,Allocation Table条目(kfdate[i])包含extent number,file number与AU的状态--正常分配(flag V=1),可用或未人分配AU(flag V=0)。下面的命令查看Allocation table block 4

[oracle@jyrac1 ~]$ kfed read /dev/raw/raw10 blkn=4 | more
kfbh.endian:                          1 ; 0x000: 0x01
kfbh.hard:                          130 ; 0x001: 0x82
kfbh.type:                            3 ; 0x002: KFBTYP_ALLOCTBL
kfbh.datfmt:                          2 ; 0x003: 0x02
kfbh.block.blk:                       4 ; 0x004: blk=4
kfbh.block.obj:              2147483651 ; 0x008: disk=3
kfbh.check:                  2183629333 ; 0x00c: 0x82278a15
kfbh.fcn.base:                     3319 ; 0x010: 0x00000cf7
kfbh.fcn.wrap:                        0 ; 0x014: 0x00000000
kfbh.spare1:                          0 ; 0x018: 0x00000000
kfbh.spare2:                          0 ; 0x01c: 0x00000000
kfdatb.aunum:                       896 ; 0x000: 0x00000380
kfdatb.shrink:                      448 ; 0x004: 0x01c0
kfdatb.ub2pad:                        0 ; 0x006: 0x0000
kfdatb.auinfo[0].link.next:           8 ; 0x008: 0x0008
kfdatb.auinfo[0].link.prev:           8 ; 0x00a: 0x0008
kfdatb.auinfo[1].link.next:          12 ; 0x00c: 0x000c
kfdatb.auinfo[1].link.prev:          12 ; 0x00e: 0x000c
kfdatb.auinfo[2].link.next:          16 ; 0x010: 0x0010
kfdatb.auinfo[2].link.prev:          16 ; 0x012: 0x0010
kfdatb.auinfo[3].link.next:          20 ; 0x014: 0x0014
kfdatb.auinfo[3].link.prev:          20 ; 0x016: 0x0014
kfdatb.auinfo[4].link.next:          24 ; 0x018: 0x0018
kfdatb.auinfo[4].link.prev:          24 ; 0x01a: 0x0018
kfdatb.auinfo[5].link.next:          28 ; 0x01c: 0x001c
kfdatb.auinfo[5].link.prev:          28 ; 0x01e: 0x001c
kfdatb.auinfo[6].link.next:          32 ; 0x020: 0x0020
kfdatb.auinfo[6].link.prev:          32 ; 0x022: 0x0020
kfdatb.spare:                         0 ; 0x024: 0x00000000
kfdate[0].discriminator:              1 ; 0x028: 0x00000001
kfdate[0].allo.lo:                 1082 ; 0x028: XNUM=0x43a
kfdate[0].allo.hi:              8388867 ; 0x02c: V=1 I=0 H=0 FNUM=0x103
kfdate[1].discriminator:              1 ; 0x030: 0x00000001
kfdate[1].allo.lo:                 1085 ; 0x030: XNUM=0x43d
kfdate[1].allo.hi:              8388867 ; 0x034: V=1 I=0 H=0 FNUM=0x103
......
kfdate[284].allo.hi:            8388868 ; 0x90c: V=1 I=0 H=0 FNUM=0x104
kfdate[285].discriminator:            1 ; 0x910: 0x00000001
kfdate[285].allo.lo:                  1 ; 0x910: XNUM=0x1
kfdate[285].allo.hi:            8388869 ; 0x914: V=1 I=0 H=0 FNUM=0x105
kfdate[286].discriminator:            1 ; 0x918: 0x00000001
kfdate[286].allo.lo:                  2 ; 0x918: XNUM=0x2
kfdate[286].allo.hi:            8388869 ; 0x91c: V=1 I=0 H=0 FNUM=0x105
kfdate[287].discriminator:            1 ; 0x920: 0x00000001
kfdate[287].allo.lo:                 10 ; 0x920: XNUM=0xa
kfdate[287].allo.hi:            8388869 ; 0x924: V=1 I=0 H=0 FNUM=0x105
kfdate[288].discriminator:            1 ; 0x928: 0x00000001
kfdate[288].allo.lo:                 13 ; 0x928: XNUM=0xd
kfdate[288].allo.hi:            8388869 ; 0x92c: V=1 I=0 H=0 FNUM=0x105
kfdate[289].discriminator:            1 ; 0x930: 0x00000001
kfdate[289].allo.lo:                 15 ; 0x930: XNUM=0xf
kfdate[289].allo.hi:            8388869 ; 0x934: V=1 I=0 H=0 FNUM=0x105
kfdate[290].discriminator:            1 ; 0x938: 0x00000001
kfdate[290].allo.lo:                 18 ; 0x938: XNUM=0x12
kfdate[290].allo.hi:            8388869 ; 0x93c: V=1 I=0 H=0 FNUM=0x105
kfdate[291].discriminator:            1 ; 0x940: 0x00000001
kfdate[291].allo.lo:                 25 ; 0x940: XNUM=0x19
kfdate[291].allo.hi:            8388869 ; 0x944: V=1 I=0 H=0 FNUM=0x105
kfdate[292].discriminator:            1 ; 0x948: 0x00000001
kfdate[292].allo.lo:                 26 ; 0x948: XNUM=0x1a
kfdate[292].allo.hi:            8388869 ; 0x94c: V=1 I=0 H=0 FNUM=0x105
kfdate[293].discriminator:            1 ; 0x950: 0x00000001
kfdate[293].allo.lo:                 34 ; 0x950: XNUM=0x22
kfdate[293].allo.hi:            8388869 ; 0x954: V=1 I=0 H=0 FNUM=0x105
kfdate[294].discriminator:            1 ; 0x958: 0x00000001
kfdate[294].allo.lo:                 37 ; 0x958: XNUM=0x25
kfdate[294].allo.hi:            8388869 ; 0x95c: V=1 I=0 H=0 FNUM=0x105
kfdate[295].discriminator:            1 ; 0x960: 0x00000001
kfdate[295].allo.lo:                 39 ; 0x960: XNUM=0x27
kfdate[295].allo.hi:            8388869 ; 0x964: V=1 I=0 H=0 FNUM=0x105
kfdate[296].discriminator:            1 ; 0x968: 0x00000001
kfdate[296].allo.lo:                 42 ; 0x968: XNUM=0x2a
kfdate[296].allo.hi:            8388869 ; 0x96c: V=1 I=0 H=0 FNUM=0x105
kfdate[297].discriminator:            1 ; 0x970: 0x00000001
kfdate[297].allo.lo:                 49 ; 0x970: XNUM=0x31
kfdate[297].allo.hi:            8388869 ; 0x974: V=1 I=0 H=0 FNUM=0x105
kfdate[298].discriminator:            1 ; 0x978: 0x00000001
kfdate[298].allo.lo:                 50 ; 0x978: XNUM=0x32
kfdate[298].allo.hi:            8388869 ; 0x97c: V=1 I=0 H=0 FNUM=0x105
kfdate[299].discriminator:            1 ; 0x980: 0x00000001
kfdate[299].allo.lo:                 58 ; 0x980: XNUM=0x3a
kfdate[299].allo.hi:            8388869 ; 0x984: V=1 I=0 H=0 FNUM=0x105
kfdate[300].discriminator:            1 ; 0x988: 0x00000001
kfdate[300].allo.lo:                  1 ; 0x988: XNUM=0x1
kfdate[300].allo.hi:           12583173 ; 0x98c: V=1 I=1 H=0 FNUM=0x105
kfdate[301].discriminator:            1 ; 0x990: 0x00000001
kfdate[301].allo.lo:                 61 ; 0x990: XNUM=0x3d
kfdate[301].allo.hi:            8388869 ; 0x994: V=1 I=0 H=0 FNUM=0x105
kfdate[302].discriminator:            1 ; 0x998: 0x00000001
kfdate[302].allo.lo:                 63 ; 0x998: XNUM=0x3f
kfdate[302].allo.hi:            8388869 ; 0x99c: V=1 I=0 H=0 FNUM=0x105
kfdate[303].discriminator:            1 ; 0x9a0: 0x00000001
kfdate[303].allo.lo:                 66 ; 0x9a0: XNUM=0x42
kfdate[303].allo.hi:            8388869 ; 0x9a4: V=1 I=0 H=0 FNUM=0x105
kfdate[304].discriminator:            1 ; 0x9a8: 0x00000001
kfdate[304].allo.lo:                 73 ; 0x9a8: XNUM=0x49
kfdate[304].allo.hi:            8388869 ; 0x9ac: V=1 I=0 H=0 FNUM=0x105
kfdate[305].discriminator:            1 ; 0x9b0: 0x00000001
kfdate[305].allo.lo:                 74 ; 0x9b0: XNUM=0x4a
kfdate[305].allo.hi:            8388869 ; 0x9b4: V=1 I=0 H=0 FNUM=0x105
kfdate[306].discriminator:            1 ; 0x9b8: 0x00000001
kfdate[306].allo.lo:                 82 ; 0x9b8: XNUM=0x52
kfdate[306].allo.hi:            8388869 ; 0x9bc: V=1 I=0 H=0 FNUM=0x105
kfdate[307].discriminator:            1 ; 0x9c0: 0x00000001
kfdate[307].allo.lo:                 85 ; 0x9c0: XNUM=0x55
kfdate[307].allo.hi:            8388869 ; 0x9c4: V=1 I=0 H=0 FNUM=0x105
kfdate[308].discriminator:            1 ; 0x9c8: 0x00000001
kfdate[308].allo.lo:                 87 ; 0x9c8: XNUM=0x57
kfdate[308].allo.hi:            8388869 ; 0x9cc: V=1 I=0 H=0 FNUM=0x105
kfdate[309].discriminator:            1 ; 0x9d0: 0x00000001
kfdate[309].allo.lo:                 90 ; 0x9d0: XNUM=0x5a
kfdate[309].allo.hi:            8388869 ; 0x9d4: V=1 I=0 H=0 FNUM=0x105
kfdate[310].discriminator:            1 ; 0x9d8: 0x00000001
kfdate[310].allo.lo:                 97 ; 0x9d8: XNUM=0x61
kfdate[310].allo.hi:            8388869 ; 0x9dc: V=1 I=0 H=0 FNUM=0x105
kfdate[311].discriminator:            1 ; 0x9e0: 0x00000001
kfdate[311].allo.lo:                 98 ; 0x9e0: XNUM=0x62
kfdate[311].allo.hi:            8388869 ; 0x9e4: V=1 I=0 H=0 FNUM=0x105
kfdate[312].discriminator:            1 ; 0x9e8: 0x00000001
kfdate[312].allo.lo:                106 ; 0x9e8: XNUM=0x6a
kfdate[312].allo.hi:            8388869 ; 0x9ec: V=1 I=0 H=0 FNUM=0x105
kfdate[313].discriminator:            1 ; 0x9f0: 0x00000001
kfdate[313].allo.lo:                109 ; 0x9f0: XNUM=0x6d
kfdate[313].allo.hi:            8388869 ; 0x9f4: V=1 I=0 H=0 FNUM=0x105
kfdate[314].discriminator:            1 ; 0x9f8: 0x00000001
kfdate[314].allo.lo:                111 ; 0x9f8: XNUM=0x6f
kfdate[314].allo.hi:            8388869 ; 0x9fc: V=1 I=0 H=0 FNUM=0x105
kfdate[315].discriminator:            1 ; 0xa00: 0x00000001
kfdate[315].allo.lo:                114 ; 0xa00: XNUM=0x72
kfdate[315].allo.hi:            8388869 ; 0xa04: V=1 I=0 H=0 FNUM=0x105
kfdate[316].discriminator:            1 ; 0xa08: 0x00000001
kfdate[316].allo.lo:                121 ; 0xa08: XNUM=0x79
kfdate[316].allo.hi:            8388869 ; 0xa0c: V=1 I=0 H=0 FNUM=0x105
kfdate[317].discriminator:            1 ; 0xa10: 0x00000001
kfdate[317].allo.lo:                122 ; 0xa10: XNUM=0x7a
kfdate[317].allo.hi:            8388869 ; 0xa14: V=1 I=0 H=0 FNUM=0x105
kfdate[318].discriminator:            1 ; 0xa18: 0x00000001
kfdate[318].allo.lo:                130 ; 0xa18: XNUM=0x82
kfdate[318].allo.hi:            8388869 ; 0xa1c: V=1 I=0 H=0 FNUM=0x105
kfdate[319].discriminator:            1 ; 0xa20: 0x00000001
kfdate[319].allo.lo:                133 ; 0xa20: XNUM=0x85
kfdate[319].allo.hi:            8388869 ; 0xa24: V=1 I=0 H=0 FNUM=0x105
kfdate[320].discriminator:            1 ; 0xa28: 0x00000001
kfdate[320].allo.lo:                135 ; 0xa28: XNUM=0x87
kfdate[320].allo.hi:            8388869 ; 0xa2c: V=1 I=0 H=0 FNUM=0x105
kfdate[321].discriminator:            1 ; 0xa30: 0x00000001
kfdate[321].allo.lo:                138 ; 0xa30: XNUM=0x8a
kfdate[321].allo.hi:            8388869 ; 0xa34: V=1 I=0 H=0 FNUM=0x105
kfdate[322].discriminator:            1 ; 0xa38: 0x00000001
kfdate[322].allo.lo:                145 ; 0xa38: XNUM=0x91
kfdate[322].allo.hi:            8388869 ; 0xa3c: V=1 I=0 H=0 FNUM=0x105
kfdate[323].discriminator:            1 ; 0xa40: 0x00000001
kfdate[323].allo.lo:                146 ; 0xa40: XNUM=0x92
kfdate[323].allo.hi:            8388869 ; 0xa44: V=1 I=0 H=0 FNUM=0x105
kfdate[324].discriminator:            1 ; 0xa48: 0x00000001
kfdate[324].allo.lo:                154 ; 0xa48: XNUM=0x9a
kfdate[324].allo.hi:            8388869 ; 0xa4c: V=1 I=0 H=0 FNUM=0x105
kfdate[325].discriminator:            1 ; 0xa50: 0x00000001
kfdate[325].allo.lo:                157 ; 0xa50: XNUM=0x9d
kfdate[325].allo.hi:            8388869 ; 0xa54: V=1 I=0 H=0 FNUM=0x105
kfdate[326].discriminator:            1 ; 0xa58: 0x00000001
kfdate[326].allo.lo:                159 ; 0xa58: XNUM=0x9f
kfdate[326].allo.hi:            8388869 ; 0xa5c: V=1 I=0 H=0 FNUM=0x105
kfdate[327].discriminator:            1 ; 0xa60: 0x00000001
kfdate[327].allo.lo:                162 ; 0xa60: XNUM=0xa2
kfdate[327].allo.hi:            8388869 ; 0xa64: V=1 I=0 H=0 FNUM=0x105
kfdate[328].discriminator:            1 ; 0xa68: 0x00000001
kfdate[328].allo.lo:                169 ; 0xa68: XNUM=0xa9
kfdate[328].allo.hi:            8388869 ; 0xa6c: V=1 I=0 H=0 FNUM=0x105
kfdate[329].discriminator:            1 ; 0xa70: 0x00000001
kfdate[329].allo.lo:                170 ; 0xa70: XNUM=0xaa
kfdate[329].allo.hi:            8388869 ; 0xa74: V=1 I=0 H=0 FNUM=0x105
kfdate[330].discriminator:            1 ; 0xa78: 0x00000001
kfdate[330].allo.lo:                178 ; 0xa78: XNUM=0xb2
kfdate[330].allo.hi:            8388869 ; 0xa7c: V=1 I=0 H=0 FNUM=0x105
kfdate[331].discriminator:            1 ; 0xa80: 0x00000001
kfdate[331].allo.lo:                181 ; 0xa80: XNUM=0xb5
kfdate[331].allo.hi:            8388869 ; 0xa84: V=1 I=0 H=0 FNUM=0x105
kfdate[332].discriminator:            1 ; 0xa88: 0x00000001
kfdate[332].allo.lo:                183 ; 0xa88: XNUM=0xb7
kfdate[332].allo.hi:            8388869 ; 0xa8c: V=1 I=0 H=0 FNUM=0x105
kfdate[333].discriminator:            1 ; 0xa90: 0x00000001
kfdate[333].allo.lo:                186 ; 0xa90: XNUM=0xba
kfdate[333].allo.hi:            8388869 ; 0xa94: V=1 I=0 H=0 FNUM=0x105
kfdate[334].discriminator:            1 ; 0xa98: 0x00000001
kfdate[334].allo.lo:                193 ; 0xa98: XNUM=0xc1
kfdate[334].allo.hi:            8388869 ; 0xa9c: V=1 I=0 H=0 FNUM=0x105
kfdate[335].discriminator:            1 ; 0xaa0: 0x00000001
kfdate[335].allo.lo:                194 ; 0xaa0: XNUM=0xc2
kfdate[335].allo.hi:            8388869 ; 0xaa4: V=1 I=0 H=0 FNUM=0x105
kfdate[336].discriminator:            1 ; 0xaa8: 0x00000001
kfdate[336].allo.lo:                202 ; 0xaa8: XNUM=0xca
kfdate[336].allo.hi:            8388869 ; 0xaac: V=1 I=0 H=0 FNUM=0x105
kfdate[337].discriminator:            1 ; 0xab0: 0x00000001
kfdate[337].allo.lo:                205 ; 0xab0: XNUM=0xcd
kfdate[337].allo.hi:            8388869 ; 0xab4: V=1 I=0 H=0 FNUM=0x105
kfdate[338].discriminator:            1 ; 0xab8: 0x00000001
kfdate[338].allo.lo:                207 ; 0xab8: XNUM=0xcf
kfdate[338].allo.hi:            8388869 ; 0xabc: V=1 I=0 H=0 FNUM=0x105
kfdate[339].discriminator:            1 ; 0xac0: 0x00000001
kfdate[339].allo.lo:                210 ; 0xac0: XNUM=0xd2
kfdate[339].allo.hi:            8388869 ; 0xac4: V=1 I=0 H=0 FNUM=0x105
kfdate[340].discriminator:            1 ; 0xac8: 0x00000001
kfdate[340].allo.lo:                217 ; 0xac8: XNUM=0xd9
kfdate[340].allo.hi:            8388869 ; 0xacc: V=1 I=0 H=0 FNUM=0x105
kfdate[341].discriminator:            1 ; 0xad0: 0x00000001
kfdate[341].allo.lo:                218 ; 0xad0: XNUM=0xda
kfdate[341].allo.hi:            8388869 ; 0xad4: V=1 I=0 H=0 FNUM=0x105
kfdate[342].discriminator:            1 ; 0xad8: 0x00000001
kfdate[342].allo.lo:                226 ; 0xad8: XNUM=0xe2
kfdate[342].allo.hi:            8388869 ; 0xadc: V=1 I=0 H=0 FNUM=0x105
kfdate[343].discriminator:            1 ; 0xae0: 0x00000001
kfdate[343].allo.lo:                229 ; 0xae0: XNUM=0xe5
kfdate[343].allo.hi:            8388869 ; 0xae4: V=1 I=0 H=0 FNUM=0x105
kfdate[344].discriminator:            1 ; 0xae8: 0x00000001
kfdate[344].allo.lo:                231 ; 0xae8: XNUM=0xe7
kfdate[344].allo.hi:            8388869 ; 0xaec: V=1 I=0 H=0 FNUM=0x105
kfdate[345].discriminator:            1 ; 0xaf0: 0x00000001
kfdate[345].allo.lo:                234 ; 0xaf0: XNUM=0xea
kfdate[345].allo.hi:            8388869 ; 0xaf4: V=1 I=0 H=0 FNUM=0x105
kfdate[346].discriminator:            1 ; 0xaf8: 0x00000001
kfdate[346].allo.lo:                241 ; 0xaf8: XNUM=0xf1
kfdate[346].allo.hi:            8388869 ; 0xafc: V=1 I=0 H=0 FNUM=0x105
kfdate[347].discriminator:            1 ; 0xb00: 0x00000001
kfdate[347].allo.lo:                242 ; 0xb00: XNUM=0xf2
kfdate[347].allo.hi:            8388869 ; 0xb04: V=1 I=0 H=0 FNUM=0x105
kfdate[348].discriminator:            1 ; 0xb08: 0x00000001
kfdate[348].allo.lo:                250 ; 0xb08: XNUM=0xfa
kfdate[348].allo.hi:            8388869 ; 0xb0c: V=1 I=0 H=0 FNUM=0x105
kfdate[349].discriminator:            1 ; 0xb10: 0x00000001
kfdate[349].allo.lo:                253 ; 0xb10: XNUM=0xfd
kfdate[349].allo.hi:            8388869 ; 0xb14: V=1 I=0 H=0 FNUM=0x105
kfdate[350].discriminator:            1 ; 0xb18: 0x00000001
kfdate[350].allo.lo:                255 ; 0xb18: XNUM=0xff
kfdate[350].allo.hi:            8388869 ; 0xb1c: V=1 I=0 H=0 FNUM=0x105
kfdate[351].discriminator:            1 ; 0xb20: 0x00000001
kfdate[351].allo.lo:                258 ; 0xb20: XNUM=0x102
kfdate[351].allo.hi:            8388869 ; 0xb24: V=1 I=0 H=0 FNUM=0x105
kfdate[352].discriminator:            1 ; 0xb28: 0x00000001
kfdate[352].allo.lo:                265 ; 0xb28: XNUM=0x109
kfdate[352].allo.hi:            8388869 ; 0xb2c: V=1 I=0 H=0 FNUM=0x105
kfdate[353].discriminator:            1 ; 0xb30: 0x00000001
kfdate[353].allo.lo:                266 ; 0xb30: XNUM=0x10a
kfdate[353].allo.hi:            8388869 ; 0xb34: V=1 I=0 H=0 FNUM=0x105
kfdate[354].discriminator:            1 ; 0xb38: 0x00000001
kfdate[354].allo.lo:                274 ; 0xb38: XNUM=0x112
kfdate[354].allo.hi:            8388869 ; 0xb3c: V=1 I=0 H=0 FNUM=0x105
kfdate[355].discriminator:            1 ; 0xb40: 0x00000001
kfdate[355].allo.lo:                277 ; 0xb40: XNUM=0x115
kfdate[355].allo.hi:            8388869 ; 0xb44: V=1 I=0 H=0 FNUM=0x105
kfdate[356].discriminator:            1 ; 0xb48: 0x00000001
kfdate[356].allo.lo:                279 ; 0xb48: XNUM=0x117
kfdate[356].allo.hi:            8388869 ; 0xb4c: V=1 I=0 H=0 FNUM=0x105
kfdate[357].discriminator:            1 ; 0xb50: 0x00000001
kfdate[357].allo.lo:                282 ; 0xb50: XNUM=0x11a
kfdate[357].allo.hi:            8388869 ; 0xb54: V=1 I=0 H=0 FNUM=0x105
kfdate[358].discriminator:            1 ; 0xb58: 0x00000001
kfdate[358].allo.lo:                289 ; 0xb58: XNUM=0x121
kfdate[358].allo.hi:            8388869 ; 0xb5c: V=1 I=0 H=0 FNUM=0x105
kfdate[359].discriminator:            1 ; 0xb60: 0x00000001
kfdate[359].allo.lo:                290 ; 0xb60: XNUM=0x122
kfdate[359].allo.hi:            8388869 ; 0xb64: V=1 I=0 H=0 FNUM=0x105
kfdate[360].discriminator:            1 ; 0xb68: 0x00000001
kfdate[360].allo.lo:                298 ; 0xb68: XNUM=0x12a
kfdate[360].allo.hi:            8388869 ; 0xb6c: V=1 I=0 H=0 FNUM=0x105
kfdate[361].discriminator:            1 ; 0xb70: 0x00000001
kfdate[361].allo.lo:                301 ; 0xb70: XNUM=0x12d
kfdate[361].allo.hi:            8388869 ; 0xb74: V=1 I=0 H=0 FNUM=0x105
kfdate[362].discriminator:            1 ; 0xb78: 0x00000001
kfdate[362].allo.lo:                  4 ; 0xb78: XNUM=0x4
kfdate[362].allo.hi:            8388870 ; 0xb7c: V=1 I=0 H=0 FNUM=0x106
kfdate[363].discriminator:            0 ; 0x4d0: 0x00000000
kfdate[363].free.lo.next:             0 ; 0x4d0: 0x0000
kfdate[363].free.lo.prev:             0 ; 0x4d2: 0x0000
kfdate[363].free.hi:                  0 ; 0x4d4: V=0 ASZM=0x0
....

上面输出内容显示了file 261(FNUM=0x105)的Allocation Table条目,从kfdate[285]开始到kfdate[361]结束。那么这说明file 261总共有77个AU。AU号等于kfdate[i]+offset[kfdatb.aunum=896]。也就是说,AU号为285+896=1181,286+896=1182....361+896=1527。我们可以通过查询x$kffxp视图来进行验证。

SQL> select au_kffxp from x$kffxp where group_kffxp=3  and number_kffxp=261  and disk_kffxp=3 order by  au_kffxp asc;

  AU_KFFXP
----------
      1181
      1182
      1183
      1184
      1185
      1186
      1187
      1188
      1189
      1190
      1191
      1192
      1193
      1194
      1195
      1196
      1197
      1198
      1199
      1200
      1201
      1202
      1203
      1204
      1205
      1206
      1207
      1208
      1209
      1210
      1211
      1212
      1213
      1214
      1215
      1216
      1217
      1218
      1219
      1220
      1221
      1222
      1223
      1224
      1225
      1226
      1227
      1228
      1229
      1230
      1231
      1232
      1233
      1234
      1235
      1236
      1237
      1238
      1239
      1240
      1241
      1242
      1243
      1244
      1245
      1246
      1247
      1248
      1249
      1250
      1251
      1252
      1253
      1254
      1255
      1256
      1257

77 rows selected.

可用空间
在下面的kfed输出中,可以看到kfdate[363]与kfdate[364]两关键字free next,这就说明它们是可以使用的或没有分配的AU(标记V=0)。

[oracle@jyrac1 ~]$ kfed read /dev/raw/raw10 blkn=4 | more
kfbh.endian:                          1 ; 0x000: 0x01
kfbh.hard:                          130 ; 0x001: 0x82
kfbh.type:                            3 ; 0x002: KFBTYP_ALLOCTBL
kfbh.datfmt:                          2 ; 0x003: 0x02
kfbh.block.blk:                       4 ; 0x004: blk=4
kfbh.block.obj:              2147483651 ; 0x008: disk=3
kfbh.check:                  2183629333 ; 0x00c: 0x82278a15
kfbh.fcn.base:                     3319 ; 0x010: 0x00000cf7
kfbh.fcn.wrap:                        0 ; 0x014: 0x00000000
kfbh.spare1:                          0 ; 0x018: 0x00000000
kfbh.spare2:                          0 ; 0x01c: 0x00000000
kfdatb.aunum:                       896 ; 0x000: 0x00000380
kfdatb.shrink:                      448 ; 0x004: 0x01c0
kfdatb.ub2pad:                        0 ; 0x006: 0x0000
kfdatb.auinfo[0].link.next:           8 ; 0x008: 0x0008
kfdatb.auinfo[0].link.prev:           8 ; 0x00a: 0x0008
kfdatb.auinfo[1].link.next:          12 ; 0x00c: 0x000c
kfdatb.auinfo[1].link.prev:          12 ; 0x00e: 0x000c
kfdatb.auinfo[2].link.next:          16 ; 0x010: 0x0010
kfdatb.auinfo[2].link.prev:          16 ; 0x012: 0x0010
kfdatb.auinfo[3].link.next:          20 ; 0x014: 0x0014
kfdatb.auinfo[3].link.prev:          20 ; 0x016: 0x0014
kfdatb.auinfo[4].link.next:          24 ; 0x018: 0x0018
kfdatb.auinfo[4].link.prev:          24 ; 0x01a: 0x0018
kfdatb.auinfo[5].link.next:          28 ; 0x01c: 0x001c
kfdatb.auinfo[5].link.prev:          28 ; 0x01e: 0x001c
kfdatb.auinfo[6].link.next:          32 ; 0x020: 0x0020
kfdatb.auinfo[6].link.prev:          32 ; 0x022: 0x0020
kfdatb.spare:                         0 ; 0x024: 0x00000000
kfdate[0].discriminator:              1 ; 0x028: 0x00000001
kfdate[0].allo.lo:                 1082 ; 0x028: XNUM=0x43a
kfdate[0].allo.hi:              8388867 ; 0x02c: V=1 I=0 H=0 FNUM=0x103
kfdate[1].discriminator:              1 ; 0x030: 0x00000001
kfdate[1].allo.lo:                 1085 ; 0x030: XNUM=0x43d
kfdate[1].allo.hi:              8388867 ; 0x034: V=1 I=0 H=0 FNUM=0x103
......
kfdate[284].allo.hi:            8388868 ; 0x90c: V=1 I=0 H=0 FNUM=0x104
kfdate[285].discriminator:            1 ; 0x910: 0x00000001
kfdate[285].allo.lo:                  1 ; 0x910: XNUM=0x1
kfdate[285].allo.hi:            8388869 ; 0x914: V=1 I=0 H=0 FNUM=0x105
.....
kfdate[361].discriminator:            1 ; 0xb70: 0x00000001
kfdate[361].allo.lo:                301 ; 0xb70: XNUM=0x12d
kfdate[361].allo.hi:            8388869 ; 0xb74: V=1 I=0 H=0 FNUM=0x105
kfdate[362].discriminator:            1 ; 0xb78: 0x00000001
kfdate[362].allo.lo:                  4 ; 0xb78: XNUM=0x4
kfdate[362].allo.hi:            8388870 ; 0xb7c: V=1 I=0 H=0 FNUM=0x106
kfdate[363].discriminator:            0 ; 0x4c8: 0x00000000
kfdate[363].free.lo.next:            16 ; 0x4c8: 0x0010
kfdate[363].free.lo.prev:            16 ; 0x4ca: 0x0010
kfdate[363].free.hi:                  2 ; 0x4cc: V=0 ASZM=0x2
kfdate[364].discriminator:            0 ; 0x4d0: 0x00000000
kfdate[364].free.lo.next:             0 ; 0x4d0: 0x0000
kfdate[364].free.lo.prev:             0 ; 0x4d2: 0x0000
kfdate[364].free.hi:                  0 ; 0x4d4: V=0 ASZM=0x0
....

Stride
每个AT块可以容纳448AU(AT中kfdatb.shrink=448),并有整个AT包含254个块(kfdfsb.max=254)。这意味着一个AT可以容纳254*448=113792个AU。这叫作stride,并且stride大小用AU的数量来表示,也就是ASM disk header中的kfdhdb.mfact的值(kfdhdb.mfact=113792)

[grid@jyrac1 ~]$ kfed read /dev/raw/raw10 aun=0 blkn=4 | grep kfdatb.shrink
kfdatb.shrink:                      448 ; 0x004: 0x01c0

[grid@jyrac1 ~]$ kfed read /dev/raw/raw10 aun=0 blkn=1 | grep kfdfsb.max
kfdfsb.max:                         254 ; 0x004: 0x00fe



[grid@jyrac1 ~]$ kfed read /dev/raw/raw10 aun=0 blkn=0 | grep kfdhdb.mfact
kfdhdb.mfact:                    113792 ; 0x0c0: 0x0001bc80

上面显示的stride大小是AU大小为1MB的例子,因为1MB的AU在AU0中可以容纳256个block,因为blcok 0属于disk header,燕且block 1属于Free Space Table,所以只有254个block给AT block使用。

当AU大小为4MB(在exadata中是缺省值),stride的大小将为454272个AU或1817088MB。当使用较大AU大小时,stride也会增长。下面是linux环境下,AU大小为16M时的stride大小也为454272

[grid@jyrac1 ~]$ kfed read /dev/raw/raw5 aun=0 blkn=0 | grep kfdhdb.mfact
kfdhdb.mfact:                    454272 ; 0x0c0: 0x0006ee80
[grid@jyrac1 ~]$ kfed read /dev/raw/raw5 aun=0 blkn=0 | grep kfdhdb.ausize
kfdhdb.ausize:                 16777216 ; 0x0bc: 0x01000000

多个Allocation Tables
对于较大的ASM磁盘可能有多个stride。每个stride包含属于它自己的物理地址元数据,这意味着它将有属于它自己的AT。

第二个stride在stride中的第一个AU中存储了它的物理地址元数据,执行以下命令来进行验证

[grid@jyrac1 ~]$ kfed read /dev/raw/raw10 | grep mfact
kfdhdb.mfact:                    113792 ; 0x0c0: 0x0001bc80

上面的输出显示stride的大小为113792个AU。我们来检查第二个stride中的AT条目。这些条目应该存储在AU 113792中的block 2-255中。

[grid@db1 ~]$ kfed read /dev/oracleasm/disks/RLZY_DATA1 | grep mfact
kfdhdb.mfact:                    113792 ; 0x0c0: 0x0001bc80
[grid@db1 ~]$ kfed read /dev/oracleasm/disks/RLZY_DATA1 aun=113792 blkn=2 | grep type
kfbh.type:                            3 ; 0x002: KFBTYP_ALLOCTBL

[grid@db1 ~]$ kfed read /dev/oracleasm/disks/RLZY_DATA1 aun=113792 blkn=20 | grep type
kfbh.type:                            3 ; 0x002: KFBTYP_ALLOCTBL
[grid@db1 ~]$ kfed read /dev/oracleasm/disks/RLZY_DATA1 aun=113792 blkn=200 | grep type
kfbh.type:                            3 ; 0x002: KFBTYP_ALLOCTBL
[grid@db1 ~]$ kfed read /dev/oracleasm/disks/RLZY_DATA1 aun=113792 blkn=255 | grep type
kfbh.type:                            3 ; 0x002: KFBTYP_ALLOCTBL

上面的输出与我们所期待的一样,在AU 113792中有其它的AT存在。如果还有另一个stride,在这个stride的开始位置有另一个AT。对于一个较大的磁盘,将有多个stride,因此我们可以看到第3,4,5个stride的AT

[grid@db1 ~]$ kfed read /dev/oracleasm/disks/RLZY_DATA1 aun=227584 blkn=255 | grep type
kfbh.type:                            3 ; 0x002: KFBTYP_ALLOCTBL
[grid@db1 ~]$ kfed read /dev/oracleasm/disks/RLZY_DATA1 aun=341376 blkn=255 | grep type
kfbh.type:                            3 ; 0x002: KFBTYP_ALLOCTBL
[grid@db1 ~]$ kfed read /dev/oracleasm/disks/RLZY_DATA1 aun=455168 blkn=255 | grep type
kfbh.type:                            3 ; 0x002: KFBTYP_ALLOCTBL

小结:每个ASM磁盘至少包含一个Allocation Table(分配表)来描述磁盘的内容。AT对于磁盘中的每个allocation unit(AU)都有一个条目。如果磁盘有多个stride,每个stride有属于它自己的Allocation Table。

正文到此结束
Loading...