查看: 253|回复: 0

[Oracle数据库] Oracle ASM Allocation Table

发表于 2017-1-3 12:00:02

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.

  1. SQL> select group_number,disk_number,state,name,path from v$asm_disk where group_number3;
  2. GROUP_NUMBER DISK_NUMBER STATE NAME PATH
  3. ------------ ----------- ------------------------------ ------------------------------ ------------------------------
  4. 3 0 NORMAL DATADG_0001 /dev/raw/raw11
  5. 3 3 NORMAL DATADG_0000 /dev/raw/raw10
  6. 3 1 NORMAL DATADG_0003 /dev/raw/raw4
  7. 3 2 NORMAL DATADG_0002 /dev/raw/raw3
复制代码
  1. [oracle@jyrac1 ~]$ kfed read /dev/raw/raw10 | grep kfdhdb.altlocn
  2. kfdhdb.altlocn: 2 ; 0x0d0: 0x00000002
复制代码

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

  1. [oracle@jyrac1 ~]$ kfed read /dev/raw/raw10 blkn=2 | more
  2. kfbh.endian: 1 ; 0x000: 0x01
  3. kfbh.hard: 130 ; 0x001: 0x82
  4. kfbh.type: 3 ; 0x002: KFBTYP_ALLOCTBL
  5. kfbh.datfmt: 2 ; 0x003: 0x02
  6. kfbh.block.blk: 2 ; 0x004: blk=2
  7. kfbh.block.obj: 2147483651 ; 0x008: disk=3
  8. kfbh.check: 2183627135 ; 0x00c: 0x8227817f
  9. kfbh.fcn.base: 1453 ; 0x010: 0x000005ad
  10. kfbh.fcn.wrap: 0 ; 0x014: 0x00000000
  11. kfbh.spare1: 0 ; 0x018: 0x00000000
  12. kfbh.spare2: 0 ; 0x01c: 0x00000000
  13. kfdatb.aunum: 0 ; 0x000: 0x00000000
  14. kfdatb.shrink: 448 ; 0x004: 0x01c0
  15. kfdatb.ub2pad: 0 ; 0x006: 0x0000
  16. kfdatb.auinfo[0].link.next: 8 ; 0x008: 0x0008
  17. kfdatb.auinfo[0].link.prev: 8 ; 0x00a: 0x0008
  18. kfdatb.auinfo[1].link.next: 12 ; 0x00c: 0x000c
  19. kfdatb.auinfo[1].link.prev: 12 ; 0x00e: 0x000c
  20. kfdatb.auinfo[2].link.next: 16 ; 0x010: 0x0010
  21. kfdatb.auinfo[2].link.prev: 16 ; 0x012: 0x0010
  22. kfdatb.auinfo[3].link.next: 20 ; 0x014: 0x0014
  23. kfdatb.auinfo[3].link.prev: 20 ; 0x016: 0x0014
  24. kfdatb.auinfo[4].link.next: 24 ; 0x018: 0x0018
  25. kfdatb.auinfo[4].link.prev: 24 ; 0x01a: 0x0018
  26. kfdatb.auinfo[5].link.next: 28 ; 0x01c: 0x001c
  27. kfdatb.auinfo[5].link.prev: 28 ; 0x01e: 0x001c
  28. kfdatb.auinfo[6].link.next: 32 ; 0x020: 0x0020
  29. kfdatb.auinfo[6].link.prev: 32 ; 0x022: 0x0020
  30. kfdatb.spare: 0 ; 0x024: 0x00000000
  31. kfdate[0].discriminator: 1 ; 0x028: 0x00000001
  32. kfdate[0].allo.lo: 0 ; 0x028: XNUM=0x0
  33. kfdate[0].allo.hi: 8388608 ; 0x02c: V=1 I=0 H=0 FNUM=0x0
  34. kfdate[1].discriminator: 1 ; 0x030: 0x00000001
  35. kfdate[1].allo.lo: 0 ; 0x030: XNUM=0x0
  36. kfdate[1].allo.hi: 8388608 ; 0x034: V=1 I=0 H=0 FNUM=0x0
  37. kfdate[2].discriminator: 1 ; 0x038: 0x00000001
  38. kfdate[2].allo.lo: 0 ; 0x038: XNUM=0x0
  39. kfdate[2].allo.hi: 8388611 ; 0x03c: V=1 I=0 H=0 FNUM=0x3
  40. kfdate[3].discriminator: 1 ; 0x040: 0x00000001
  41. kfdate[3].allo.lo: 4 ; 0x040: XNUM=0x4
  42. kfdate[3].allo.hi: 8388611 ; 0x044: V=1 I=0 H=0 FNUM=0x3
  43. kfdate[4].discriminator: 1 ; 0x048: 0x00000001
  44. kfdate[4].allo.lo: 8 ; 0x048: XNUM=0x8
  45. 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

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

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

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

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

  1. [oracle@jyrac1 ~]$ kfed read /dev/raw/raw10 blkn=4 | more
  2. kfbh.endian: 1 ; 0x000: 0x01
  3. kfbh.hard: 130 ; 0x001: 0x82
  4. kfbh.type: 3 ; 0x002: KFBTYP_ALLOCTBL
  5. kfbh.datfmt: 2 ; 0x003: 0x02
  6. kfbh.block.blk: 4 ; 0x004: blk=4
  7. kfbh.block.obj: 2147483651 ; 0x008: disk=3
  8. kfbh.check: 2183629333 ; 0x00c: 0x82278a15
  9. kfbh.fcn.base: 3319 ; 0x010: 0x00000cf7
  10. kfbh.fcn.wrap: 0 ; 0x014: 0x00000000
  11. kfbh.spare1: 0 ; 0x018: 0x00000000
  12. kfbh.spare2: 0 ; 0x01c: 0x00000000
  13. kfdatb.aunum: 896 ; 0x000: 0x00000380
  14. kfdatb.shrink: 448 ; 0x004: 0x01c0
  15. kfdatb.ub2pad: 0 ; 0x006: 0x0000
  16. kfdatb.auinfo[0].link.next: 8 ; 0x008: 0x0008
  17. kfdatb.auinfo[0].link.prev: 8 ; 0x00a: 0x0008
  18. kfdatb.auinfo[1].link.next: 12 ; 0x00c: 0x000c
  19. kfdatb.auinfo[1].link.prev: 12 ; 0x00e: 0x000c
  20. kfdatb.auinfo[2].link.next: 16 ; 0x010: 0x0010
  21. kfdatb.auinfo[2].link.prev: 16 ; 0x012: 0x0010
  22. kfdatb.auinfo[3].link.next: 20 ; 0x014: 0x0014
  23. kfdatb.auinfo[3].link.prev: 20 ; 0x016: 0x0014
  24. kfdatb.auinfo[4].link.next: 24 ; 0x018: 0x0018
  25. kfdatb.auinfo[4].link.prev: 24 ; 0x01a: 0x0018
  26. kfdatb.auinfo[5].link.next: 28 ; 0x01c: 0x001c
  27. kfdatb.auinfo[5].link.prev: 28 ; 0x01e: 0x001c
  28. kfdatb.auinfo[6].link.next: 32 ; 0x020: 0x0020
  29. kfdatb.auinfo[6].link.prev: 32 ; 0x022: 0x0020
  30. kfdatb.spare: 0 ; 0x024: 0x00000000
  31. kfdate[0].discriminator: 1 ; 0x028: 0x00000001
  32. kfdate[0].allo.lo: 1082 ; 0x028: XNUM=0x43a
  33. kfdate[0].allo.hi: 8388867 ; 0x02c: V=1 I=0 H=0 FNUM=0x103
  34. kfdate[1].discriminator: 1 ; 0x030: 0x00000001
  35. kfdate[1].allo.lo: 1085 ; 0x030: XNUM=0x43d
  36. kfdate[1].allo.hi: 8388867 ; 0x034: V=1 I=0 H=0 FNUM=0x103
  37. ......
  38. kfdate[284].allo.hi: 8388868 ; 0x90c: V=1 I=0 H=0 FNUM=0x104
  39. kfdate[285].discriminator: 1 ; 0x910: 0x00000001
  40. kfdate[285].allo.lo: 1 ; 0x910: XNUM=0x1
  41. kfdate[285].allo.hi: 8388869 ; 0x914: V=1 I=0 H=0 FNUM=0x105
  42. kfdate[286].discriminator: 1 ; 0x918: 0x00000001
  43. kfdate[286].allo.lo: 2 ; 0x918: XNUM=0x2
  44. kfdate[286].allo.hi: 8388869 ; 0x91c: V=1 I=0 H=0 FNUM=0x105
  45. kfdate[287].discriminator: 1 ; 0x920: 0x00000001
  46. kfdate[287].allo.lo: 10 ; 0x920: XNUM=0xa
  47. kfdate[287].allo.hi: 8388869 ; 0x924: V=1 I=0 H=0 FNUM=0x105
  48. kfdate[288].discriminator: 1 ; 0x928: 0x00000001
  49. kfdate[288].allo.lo: 13 ; 0x928: XNUM=0xd
  50. kfdate[288].allo.hi: 8388869 ; 0x92c: V=1 I=0 H=0 FNUM=0x105
  51. kfdate[289].discriminator: 1 ; 0x930: 0x00000001
  52. kfdate[289].allo.lo: 15 ; 0x930: XNUM=0xf
  53. kfdate[289].allo.hi: 8388869 ; 0x934: V=1 I=0 H=0 FNUM=0x105
  54. kfdate[290].discriminator: 1 ; 0x938: 0x00000001
  55. kfdate[290].allo.lo: 18 ; 0x938: XNUM=0x12
  56. kfdate[290].allo.hi: 8388869 ; 0x93c: V=1 I=0 H=0 FNUM=0x105
  57. kfdate[291].discriminator: 1 ; 0x940: 0x00000001
  58. kfdate[291].allo.lo: 25 ; 0x940: XNUM=0x19
  59. kfdate[291].allo.hi: 8388869 ; 0x944: V=1 I=0 H=0 FNUM=0x105
  60. kfdate[292].discriminator: 1 ; 0x948: 0x00000001
  61. kfdate[292].allo.lo: 26 ; 0x948: XNUM=0x1a
  62. kfdate[292].allo.hi: 8388869 ; 0x94c: V=1 I=0 H=0 FNUM=0x105
  63. kfdate[293].discriminator: 1 ; 0x950: 0x00000001
  64. kfdate[293].allo.lo: 34 ; 0x950: XNUM=0x22
  65. kfdate[293].allo.hi: 8388869 ; 0x954: V=1 I=0 H=0 FNUM=0x105
  66. kfdate[294].discriminator: 1 ; 0x958: 0x00000001
  67. kfdate[294].allo.lo: 37 ; 0x958: XNUM=0x25
  68. kfdate[294].allo.hi: 8388869 ; 0x95c: V=1 I=0 H=0 FNUM=0x105
  69. kfdate[295].discriminator: 1 ; 0x960: 0x00000001
  70. kfdate[295].allo.lo: 39 ; 0x960: XNUM=0x27
  71. kfdate[295].allo.hi: 8388869 ; 0x964: V=1 I=0 H=0 FNUM=0x105
  72. kfdate[296].discriminator: 1 ; 0x968: 0x00000001
  73. kfdate[296].allo.lo: 42 ; 0x968: XNUM=0x2a
  74. kfdate[296].allo.hi: 8388869 ; 0x96c: V=1 I=0 H=0 FNUM=0x105
  75. kfdate[297].discriminator: 1 ; 0x970: 0x00000001
  76. kfdate[297].allo.lo: 49 ; 0x970: XNUM=0x31
  77. kfdate[297].allo.hi: 8388869 ; 0x974: V=1 I=0 H=0 FNUM=0x105
  78. kfdate[298].discriminator: 1 ; 0x978: 0x00000001
  79. kfdate[298].allo.lo: 50 ; 0x978: XNUM=0x32
  80. kfdate[298].allo.hi: 8388869 ; 0x97c: V=1 I=0 H=0 FNUM=0x105
  81. kfdate[299].discriminator: 1 ; 0x980: 0x00000001
  82. kfdate[299].allo.lo: 58 ; 0x980: XNUM=0x3a
  83. kfdate[299].allo.hi: 8388869 ; 0x984: V=1 I=0 H=0 FNUM=0x105
  84. kfdate[300].discriminator: 1 ; 0x988: 0x00000001
  85. kfdate[300].allo.lo: 1 ; 0x988: XNUM=0x1
  86. kfdate[300].allo.hi: 12583173 ; 0x98c: V=1 I=1 H=0 FNUM=0x105
  87. kfdate[301].discriminator: 1 ; 0x990: 0x00000001
  88. kfdate[301].allo.lo: 61 ; 0x990: XNUM=0x3d
  89. kfdate[301].allo.hi: 8388869 ; 0x994: V=1 I=0 H=0 FNUM=0x105
  90. kfdate[302].discriminator: 1 ; 0x998: 0x00000001
  91. kfdate[302].allo.lo: 63 ; 0x998: XNUM=0x3f
  92. kfdate[302].allo.hi: 8388869 ; 0x99c: V=1 I=0 H=0 FNUM=0x105
  93. kfdate[303].discriminator: 1 ; 0x9a0: 0x00000001
  94. kfdate[303].allo.lo: 66 ; 0x9a0: XNUM=0x42
  95. kfdate[303].allo.hi: 8388869 ; 0x9a4: V=1 I=0 H=0 FNUM=0x105
  96. kfdate[304].discriminator: 1 ; 0x9a8: 0x00000001
  97. kfdate[304].allo.lo: 73 ; 0x9a8: XNUM=0x49
  98. kfdate[304].allo.hi: 8388869 ; 0x9ac: V=1 I=0 H=0 FNUM=0x105
  99. kfdate[305].discriminator: 1 ; 0x9b0: 0x00000001
  100. kfdate[305].allo.lo: 74 ; 0x9b0: XNUM=0x4a
  101. kfdate[305].allo.hi: 8388869 ; 0x9b4: V=1 I=0 H=0 FNUM=0x105
  102. kfdate[306].discriminator: 1 ; 0x9b8: 0x00000001
  103. kfdate[306].allo.lo: 82 ; 0x9b8: XNUM=0x52
  104. kfdate[306].allo.hi: 8388869 ; 0x9bc: V=1 I=0 H=0 FNUM=0x105
  105. kfdate[307].discriminator: 1 ; 0x9c0: 0x00000001
  106. kfdate[307].allo.lo: 85 ; 0x9c0: XNUM=0x55
  107. kfdate[307].allo.hi: 8388869 ; 0x9c4: V=1 I=0 H=0 FNUM=0x105
  108. kfdate[308].discriminator: 1 ; 0x9c8: 0x00000001
  109. kfdate[308].allo.lo: 87 ; 0x9c8: XNUM=0x57
  110. kfdate[308].allo.hi: 8388869 ; 0x9cc: V=1 I=0 H=0 FNUM=0x105
  111. kfdate[309].discriminator: 1 ; 0x9d0: 0x00000001
  112. kfdate[309].allo.lo: 90 ; 0x9d0: XNUM=0x5a
  113. kfdate[309].allo.hi: 8388869 ; 0x9d4: V=1 I=0 H=0 FNUM=0x105
  114. kfdate[310].discriminator: 1 ; 0x9d8: 0x00000001
  115. kfdate[310].allo.lo: 97 ; 0x9d8: XNUM=0x61
  116. kfdate[310].allo.hi: 8388869 ; 0x9dc: V=1 I=0 H=0 FNUM=0x105
  117. kfdate[311].discriminator: 1 ; 0x9e0: 0x00000001
  118. kfdate[311].allo.lo: 98 ; 0x9e0: XNUM=0x62
  119. kfdate[311].allo.hi: 8388869 ; 0x9e4: V=1 I=0 H=0 FNUM=0x105
  120. kfdate[312].discriminator: 1 ; 0x9e8: 0x00000001
  121. kfdate[312].allo.lo: 106 ; 0x9e8: XNUM=0x6a
  122. kfdate[312].allo.hi: 8388869 ; 0x9ec: V=1 I=0 H=0 FNUM=0x105
  123. kfdate[313].discriminator: 1 ; 0x9f0: 0x00000001
  124. kfdate[313].allo.lo: 109 ; 0x9f0: XNUM=0x6d
  125. kfdate[313].allo.hi: 8388869 ; 0x9f4: V=1 I=0 H=0 FNUM=0x105
  126. kfdate[314].discriminator: 1 ; 0x9f8: 0x00000001
  127. kfdate[314].allo.lo: 111 ; 0x9f8: XNUM=0x6f
  128. kfdate[314].allo.hi: 8388869 ; 0x9fc: V=1 I=0 H=0 FNUM=0x105
  129. kfdate[315].discriminator: 1 ; 0xa00: 0x00000001
  130. kfdate[315].allo.lo: 114 ; 0xa00: XNUM=0x72
  131. kfdate[315].allo.hi: 8388869 ; 0xa04: V=1 I=0 H=0 FNUM=0x105
  132. kfdate[316].discriminator: 1 ; 0xa08: 0x00000001
  133. kfdate[316].allo.lo: 121 ; 0xa08: XNUM=0x79
  134. kfdate[316].allo.hi: 8388869 ; 0xa0c: V=1 I=0 H=0 FNUM=0x105
  135. kfdate[317].discriminator: 1 ; 0xa10: 0x00000001
  136. kfdate[317].allo.lo: 122 ; 0xa10: XNUM=0x7a
  137. kfdate[317].allo.hi: 8388869 ; 0xa14: V=1 I=0 H=0 FNUM=0x105
  138. kfdate[318].discriminator: 1 ; 0xa18: 0x00000001
  139. kfdate[318].allo.lo: 130 ; 0xa18: XNUM=0x82
  140. kfdate[318].allo.hi: 8388869 ; 0xa1c: V=1 I=0 H=0 FNUM=0x105
  141. kfdate[319].discriminator: 1 ; 0xa20: 0x00000001
  142. kfdate[319].allo.lo: 133 ; 0xa20: XNUM=0x85
  143. kfdate[319].allo.hi: 8388869 ; 0xa24: V=1 I=0 H=0 FNUM=0x105
  144. kfdate[320].discriminator: 1 ; 0xa28: 0x00000001
  145. kfdate[320].allo.lo: 135 ; 0xa28: XNUM=0x87
  146. kfdate[320].allo.hi: 8388869 ; 0xa2c: V=1 I=0 H=0 FNUM=0x105
  147. kfdate[321].discriminator: 1 ; 0xa30: 0x00000001
  148. kfdate[321].allo.lo: 138 ; 0xa30: XNUM=0x8a
  149. kfdate[321].allo.hi: 8388869 ; 0xa34: V=1 I=0 H=0 FNUM=0x105
  150. kfdate[322].discriminator: 1 ; 0xa38: 0x00000001
  151. kfdate[322].allo.lo: 145 ; 0xa38: XNUM=0x91
  152. kfdate[322].allo.hi: 8388869 ; 0xa3c: V=1 I=0 H=0 FNUM=0x105
  153. kfdate[323].discriminator: 1 ; 0xa40: 0x00000001
  154. kfdate[323].allo.lo: 146 ; 0xa40: XNUM=0x92
  155. kfdate[323].allo.hi: 8388869 ; 0xa44: V=1 I=0 H=0 FNUM=0x105
  156. kfdate[324].discriminator: 1 ; 0xa48: 0x00000001
  157. kfdate[324].allo.lo: 154 ; 0xa48: XNUM=0x9a
  158. kfdate[324].allo.hi: 8388869 ; 0xa4c: V=1 I=0 H=0 FNUM=0x105
  159. kfdate[325].discriminator: 1 ; 0xa50: 0x00000001
  160. kfdate[325].allo.lo: 157 ; 0xa50: XNUM=0x9d
  161. kfdate[325].allo.hi: 8388869 ; 0xa54: V=1 I=0 H=0 FNUM=0x105
  162. kfdate[326].discriminator: 1 ; 0xa58: 0x00000001
  163. kfdate[326].allo.lo: 159 ; 0xa58: XNUM=0x9f
  164. kfdate[326].allo.hi: 8388869 ; 0xa5c: V=1 I=0 H=0 FNUM=0x105
  165. kfdate[327].discriminator: 1 ; 0xa60: 0x00000001
  166. kfdate[327].allo.lo: 162 ; 0xa60: XNUM=0xa2
  167. kfdate[327].allo.hi: 8388869 ; 0xa64: V=1 I=0 H=0 FNUM=0x105
  168. kfdate[328].discriminator: 1 ; 0xa68: 0x00000001
  169. kfdate[328].allo.lo: 169 ; 0xa68: XNUM=0xa9
  170. kfdate[328].allo.hi: 8388869 ; 0xa6c: V=1 I=0 H=0 FNUM=0x105
  171. kfdate[329].discriminator: 1 ; 0xa70: 0x00000001
  172. kfdate[329].allo.lo: 170 ; 0xa70: XNUM=0xaa
  173. kfdate[329].allo.hi: 8388869 ; 0xa74: V=1 I=0 H=0 FNUM=0x105
  174. kfdate[330].discriminator: 1 ; 0xa78: 0x00000001
  175. kfdate[330].allo.lo: 178 ; 0xa78: XNUM=0xb2
  176. kfdate[330].allo.hi: 8388869 ; 0xa7c: V=1 I=0 H=0 FNUM=0x105
  177. kfdate[331].discriminator: 1 ; 0xa80: 0x00000001
  178. kfdate[331].allo.lo: 181 ; 0xa80: XNUM=0xb5
  179. kfdate[331].allo.hi: 8388869 ; 0xa84: V=1 I=0 H=0 FNUM=0x105
  180. kfdate[332].discriminator: 1 ; 0xa88: 0x00000001
  181. kfdate[332].allo.lo: 183 ; 0xa88: XNUM=0xb7
  182. kfdate[332].allo.hi: 8388869 ; 0xa8c: V=1 I=0 H=0 FNUM=0x105
  183. kfdate[333].discriminator: 1 ; 0xa90: 0x00000001
  184. kfdate[333].allo.lo: 186 ; 0xa90: XNUM=0xba
  185. kfdate[333].allo.hi: 8388869 ; 0xa94: V=1 I=0 H=0 FNUM=0x105
  186. kfdate[334].discriminator: 1 ; 0xa98: 0x00000001
  187. kfdate[334].allo.lo: 193 ; 0xa98: XNUM=0xc1
  188. kfdate[334].allo.hi: 8388869 ; 0xa9c: V=1 I=0 H=0 FNUM=0x105
  189. kfdate[335].discriminator: 1 ; 0xaa0: 0x00000001
  190. kfdate[335].allo.lo: 194 ; 0xaa0: XNUM=0xc2
  191. kfdate[335].allo.hi: 8388869 ; 0xaa4: V=1 I=0 H=0 FNUM=0x105
  192. kfdate[336].discriminator: 1 ; 0xaa8: 0x00000001
  193. kfdate[336].allo.lo: 202 ; 0xaa8: XNUM=0xca
  194. kfdate[336].allo.hi: 8388869 ; 0xaac: V=1 I=0 H=0 FNUM=0x105
  195. kfdate[337].discriminator: 1 ; 0xab0: 0x00000001
  196. kfdate[337].allo.lo: 205 ; 0xab0: XNUM=0xcd
  197. kfdate[337].allo.hi: 8388869 ; 0xab4: V=1 I=0 H=0 FNUM=0x105
  198. kfdate[338].discriminator: 1 ; 0xab8: 0x00000001
  199. kfdate[338].allo.lo: 207 ; 0xab8: XNUM=0xcf
  200. kfdate[338].allo.hi: 8388869 ; 0xabc: V=1 I=0 H=0 FNUM=0x105
  201. kfdate[339].discriminator: 1 ; 0xac0: 0x00000001
  202. kfdate[339].allo.lo: 210 ; 0xac0: XNUM=0xd2
  203. kfdate[339].allo.hi: 8388869 ; 0xac4: V=1 I=0 H=0 FNUM=0x105
  204. kfdate[340].discriminator: 1 ; 0xac8: 0x00000001
  205. kfdate[340].allo.lo: 217 ; 0xac8: XNUM=0xd9
  206. kfdate[340].allo.hi: 8388869 ; 0xacc: V=1 I=0 H=0 FNUM=0x105
  207. kfdate[341].discriminator: 1 ; 0xad0: 0x00000001
  208. kfdate[341].allo.lo: 218 ; 0xad0: XNUM=0xda
  209. kfdate[341].allo.hi: 8388869 ; 0xad4: V=1 I=0 H=0 FNUM=0x105
  210. kfdate[342].discriminator: 1 ; 0xad8: 0x00000001
  211. kfdate[342].allo.lo: 226 ; 0xad8: XNUM=0xe2
  212. kfdate[342].allo.hi: 8388869 ; 0xadc: V=1 I=0 H=0 FNUM=0x105
  213. kfdate[343].discriminator: 1 ; 0xae0: 0x00000001
  214. kfdate[343].allo.lo: 229 ; 0xae0: XNUM=0xe5
  215. kfdate[343].allo.hi: 8388869 ; 0xae4: V=1 I=0 H=0 FNUM=0x105
  216. kfdate[344].discriminator: 1 ; 0xae8: 0x00000001
  217. kfdate[344].allo.lo: 231 ; 0xae8: XNUM=0xe7
  218. kfdate[344].allo.hi: 8388869 ; 0xaec: V=1 I=0 H=0 FNUM=0x105
  219. kfdate[345].discriminator: 1 ; 0xaf0: 0x00000001
  220. kfdate[345].allo.lo: 234 ; 0xaf0: XNUM=0xea
  221. kfdate[345].allo.hi: 8388869 ; 0xaf4: V=1 I=0 H=0 FNUM=0x105
  222. kfdate[346].discriminator: 1 ; 0xaf8: 0x00000001
  223. kfdate[346].allo.lo: 241 ; 0xaf8: XNUM=0xf1
  224. kfdate[346].allo.hi: 8388869 ; 0xafc: V=1 I=0 H=0 FNUM=0x105
  225. kfdate[347].discriminator: 1 ; 0xb00: 0x00000001
  226. kfdate[347].allo.lo: 242 ; 0xb00: XNUM=0xf2
  227. kfdate[347].allo.hi: 8388869 ; 0xb04: V=1 I=0 H=0 FNUM=0x105
  228. kfdate[348].discriminator: 1 ; 0xb08: 0x00000001
  229. kfdate[348].allo.lo: 250 ; 0xb08: XNUM=0xfa
  230. kfdate[348].allo.hi: 8388869 ; 0xb0c: V=1 I=0 H=0 FNUM=0x105
  231. kfdate[349].discriminator: 1 ; 0xb10: 0x00000001
  232. kfdate[349].allo.lo: 253 ; 0xb10: XNUM=0xfd
  233. kfdate[349].allo.hi: 8388869 ; 0xb14: V=1 I=0 H=0 FNUM=0x105
  234. kfdate[350].discriminator: 1 ; 0xb18: 0x00000001
  235. kfdate[350].allo.lo: 255 ; 0xb18: XNUM=0xff
  236. kfdate[350].allo.hi: 8388869 ; 0xb1c: V=1 I=0 H=0 FNUM=0x105
  237. kfdate[351].discriminator: 1 ; 0xb20: 0x00000001
  238. kfdate[351].allo.lo: 258 ; 0xb20: XNUM=0x102
  239. kfdate[351].allo.hi: 8388869 ; 0xb24: V=1 I=0 H=0 FNUM=0x105
  240. kfdate[352].discriminator: 1 ; 0xb28: 0x00000001
  241. kfdate[352].allo.lo: 265 ; 0xb28: XNUM=0x109
  242. kfdate[352].allo.hi: 8388869 ; 0xb2c: V=1 I=0 H=0 FNUM=0x105
  243. kfdate[353].discriminator: 1 ; 0xb30: 0x00000001
  244. kfdate[353].allo.lo: 266 ; 0xb30: XNUM=0x10a
  245. kfdate[353].allo.hi: 8388869 ; 0xb34: V=1 I=0 H=0 FNUM=0x105
  246. kfdate[354].discriminator: 1 ; 0xb38: 0x00000001
  247. kfdate[354].allo.lo: 274 ; 0xb38: XNUM=0x112
  248. kfdate[354].allo.hi: 8388869 ; 0xb3c: V=1 I=0 H=0 FNUM=0x105
  249. kfdate[355].discriminator: 1 ; 0xb40: 0x00000001
  250. kfdate[355].allo.lo: 277 ; 0xb40: XNUM=0x115
  251. kfdate[355].allo.hi: 8388869 ; 0xb44: V=1 I=0 H=0 FNUM=0x105
  252. kfdate[356].discriminator: 1 ; 0xb48: 0x00000001
  253. kfdate[356].allo.lo: 279 ; 0xb48: XNUM=0x117
  254. kfdate[356].allo.hi: 8388869 ; 0xb4c: V=1 I=0 H=0 FNUM=0x105
  255. kfdate[357].discriminator: 1 ; 0xb50: 0x00000001
  256. kfdate[357].allo.lo: 282 ; 0xb50: XNUM=0x11a
  257. kfdate[357].allo.hi: 8388869 ; 0xb54: V=1 I=0 H=0 FNUM=0x105
  258. kfdate[358].discriminator: 1 ; 0xb58: 0x00000001
  259. kfdate[358].allo.lo: 289 ; 0xb58: XNUM=0x121
  260. kfdate[358].allo.hi: 8388869 ; 0xb5c: V=1 I=0 H=0 FNUM=0x105
  261. kfdate[359].discriminator: 1 ; 0xb60: 0x00000001
  262. kfdate[359].allo.lo: 290 ; 0xb60: XNUM=0x122
  263. kfdate[359].allo.hi: 8388869 ; 0xb64: V=1 I=0 H=0 FNUM=0x105
  264. kfdate[360].discriminator: 1 ; 0xb68: 0x00000001
  265. kfdate[360].allo.lo: 298 ; 0xb68: XNUM=0x12a
  266. kfdate[360].allo.hi: 8388869 ; 0xb6c: V=1 I=0 H=0 FNUM=0x105
  267. kfdate[361].discriminator: 1 ; 0xb70: 0x00000001
  268. kfdate[361].allo.lo: 301 ; 0xb70: XNUM=0x12d
  269. kfdate[361].allo.hi: 8388869 ; 0xb74: V=1 I=0 H=0 FNUM=0x105
  270. kfdate[362].discriminator: 1 ; 0xb78: 0x00000001
  271. kfdate[362].allo.lo: 4 ; 0xb78: XNUM=0x4
  272. kfdate[362].allo.hi: 8388870 ; 0xb7c: V=1 I=0 H=0 FNUM=0x106
  273. kfdate[363].discriminator: 0 ; 0x4d0: 0x00000000
  274. kfdate[363].free.lo.next: 0 ; 0x4d0: 0x0000
  275. kfdate[363].free.lo.prev: 0 ; 0x4d2: 0x0000
  276. kfdate[363].free.hi: 0 ; 0x4d4: V=0 ASZM=0x0
  277. ....
复制代码

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

  1. SQL> select au_kffxp from x$kffxp where group_kffxp=3 and number_kffxp=261 and disk_kffxp=3 order by au_kffxp asc;
  2. AU_KFFXP
  3. ----------
  4. 1181
  5. 1182
  6. 1183
  7. 1184
  8. 1185
  9. 1186
  10. 1187
  11. 1188
  12. 1189
  13. 1190
  14. 1191
  15. 1192
  16. 1193
  17. 1194
  18. 1195
  19. 1196
  20. 1197
  21. 1198
  22. 1199
  23. 1200
  24. 1201
  25. 1202
  26. 1203
  27. 1204
  28. 1205
  29. 1206
  30. 1207
  31. 1208
  32. 1209
  33. 1210
  34. 1211
  35. 1212
  36. 1213
  37. 1214
  38. 1215
  39. 1216
  40. 1217
  41. 1218
  42. 1219
  43. 1220
  44. 1221
  45. 1222
  46. 1223
  47. 1224
  48. 1225
  49. 1226
  50. 1227
  51. 1228
  52. 1229
  53. 1230
  54. 1231
  55. 1232
  56. 1233
  57. 1234
  58. 1235
  59. 1236
  60. 1237
  61. 1238
  62. 1239
  63. 1240
  64. 1241
  65. 1242
  66. 1243
  67. 1244
  68. 1245
  69. 1246
  70. 1247
  71. 1248
  72. 1249
  73. 1250
  74. 1251
  75. 1252
  76. 1253
  77. 1254
  78. 1255
  79. 1256
  80. 1257
  81. 77 rows selected.
复制代码

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

  1. [oracle@jyrac1 ~]$ kfed read /dev/raw/raw10 blkn=4 | more
  2. kfbh.endian: 1 ; 0x000: 0x01
  3. kfbh.hard: 130 ; 0x001: 0x82
  4. kfbh.type: 3 ; 0x002: KFBTYP_ALLOCTBL
  5. kfbh.datfmt: 2 ; 0x003: 0x02
  6. kfbh.block.blk: 4 ; 0x004: blk=4
  7. kfbh.block.obj: 2147483651 ; 0x008: disk=3
  8. kfbh.check: 2183629333 ; 0x00c: 0x82278a15
  9. kfbh.fcn.base: 3319 ; 0x010: 0x00000cf7
  10. kfbh.fcn.wrap: 0 ; 0x014: 0x00000000
  11. kfbh.spare1: 0 ; 0x018: 0x00000000
  12. kfbh.spare2: 0 ; 0x01c: 0x00000000
  13. kfdatb.aunum: 896 ; 0x000: 0x00000380
  14. kfdatb.shrink: 448 ; 0x004: 0x01c0
  15. kfdatb.ub2pad: 0 ; 0x006: 0x0000
  16. kfdatb.auinfo[0].link.next: 8 ; 0x008: 0x0008
  17. kfdatb.auinfo[0].link.prev: 8 ; 0x00a: 0x0008
  18. kfdatb.auinfo[1].link.next: 12 ; 0x00c: 0x000c
  19. kfdatb.auinfo[1].link.prev: 12 ; 0x00e: 0x000c
  20. kfdatb.auinfo[2].link.next: 16 ; 0x010: 0x0010
  21. kfdatb.auinfo[2].link.prev: 16 ; 0x012: 0x0010
  22. kfdatb.auinfo[3].link.next: 20 ; 0x014: 0x0014
  23. kfdatb.auinfo[3].link.prev: 20 ; 0x016: 0x0014
  24. kfdatb.auinfo[4].link.next: 24 ; 0x018: 0x0018
  25. kfdatb.auinfo[4].link.prev: 24 ; 0x01a: 0x0018
  26. kfdatb.auinfo[5].link.next: 28 ; 0x01c: 0x001c
  27. kfdatb.auinfo[5].link.prev: 28 ; 0x01e: 0x001c
  28. kfdatb.auinfo[6].link.next: 32 ; 0x020: 0x0020
  29. kfdatb.auinfo[6].link.prev: 32 ; 0x022: 0x0020
  30. kfdatb.spare: 0 ; 0x024: 0x00000000
  31. kfdate[0].discriminator: 1 ; 0x028: 0x00000001
  32. kfdate[0].allo.lo: 1082 ; 0x028: XNUM=0x43a
  33. kfdate[0].allo.hi: 8388867 ; 0x02c: V=1 I=0 H=0 FNUM=0x103
  34. kfdate[1].discriminator: 1 ; 0x030: 0x00000001
  35. kfdate[1].allo.lo: 1085 ; 0x030: XNUM=0x43d
  36. kfdate[1].allo.hi: 8388867 ; 0x034: V=1 I=0 H=0 FNUM=0x103
  37. ......
  38. kfdate[284].allo.hi: 8388868 ; 0x90c: V=1 I=0 H=0 FNUM=0x104
  39. kfdate[285].discriminator: 1 ; 0x910: 0x00000001
  40. kfdate[285].allo.lo: 1 ; 0x910: XNUM=0x1
  41. kfdate[285].allo.hi: 8388869 ; 0x914: V=1 I=0 H=0 FNUM=0x105
  42. .....
  43. kfdate[361].discriminator: 1 ; 0xb70: 0x00000001
  44. kfdate[361].allo.lo: 301 ; 0xb70: XNUM=0x12d
  45. kfdate[361].allo.hi: 8388869 ; 0xb74: V=1 I=0 H=0 FNUM=0x105
  46. kfdate[362].discriminator: 1 ; 0xb78: 0x00000001
  47. kfdate[362].allo.lo: 4 ; 0xb78: XNUM=0x4
  48. kfdate[362].allo.hi: 8388870 ; 0xb7c: V=1 I=0 H=0 FNUM=0x106
  49. kfdate[363].discriminator: 0 ; 0x4c8: 0x00000000
  50. kfdate[363].free.lo.next: 16 ; 0x4c8: 0x0010
  51. kfdate[363].free.lo.prev: 16 ; 0x4ca: 0x0010
  52. kfdate[363].free.hi: 2 ; 0x4cc: V=0 ASZM=0x2
  53. kfdate[364].discriminator: 0 ; 0x4d0: 0x00000000
  54. kfdate[364].free.lo.next: 0 ; 0x4d0: 0x0000
  55. kfdate[364].free.lo.prev: 0 ; 0x4d2: 0x0000
  56. kfdate[364].free.hi: 0 ; 0x4d4: V=0 ASZM=0x0
  57. ....
复制代码

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)

  1. [grid@jyrac1 ~]$ kfed read /dev/raw/raw10 aun=0 blkn=4 | grep kfdatb.shrink
  2. kfdatb.shrink: 448 ; 0x004: 0x01c0
  3. [grid@jyrac1 ~]$ kfed read /dev/raw/raw10 aun=0 blkn=1 | grep kfdfsb.max
  4. kfdfsb.max: 254 ; 0x004: 0x00fe
  5. [grid@jyrac1 ~]$ kfed read /dev/raw/raw10 aun=0 blkn=0 | grep kfdhdb.mfact
  6. 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

  1. [grid@jyrac1 ~]$ kfed read /dev/raw/raw5 aun=0 blkn=0 | grep kfdhdb.mfact
  2. kfdhdb.mfact: 454272 ; 0x0c0: 0x0006ee80
  3. [grid@jyrac1 ~]$ kfed read /dev/raw/raw5 aun=0 blkn=0 | grep kfdhdb.ausize
  4. kfdhdb.ausize: 16777216 ; 0x0bc: 0x01000000
复制代码

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

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

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

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

  1. [grid@db1 ~]$ kfed read /dev/oracleasm/disks/RLZY_DATA1 | grep mfact
  2. kfdhdb.mfact: 113792 ; 0x0c0: 0x0001bc80
  3. [grid@db1 ~]$ kfed read /dev/oracleasm/disks/RLZY_DATA1 aun=113792 blkn=2 | grep type
  4. kfbh.type: 3 ; 0x002: KFBTYP_ALLOCTBL
  5. [grid@db1 ~]$ kfed read /dev/oracleasm/disks/RLZY_DATA1 aun=113792 blkn=20 | grep type
  6. kfbh.type: 3 ; 0x002: KFBTYP_ALLOCTBL
  7. [grid@db1 ~]$ kfed read /dev/oracleasm/disks/RLZY_DATA1 aun=113792 blkn=200 | grep type
  8. kfbh.type: 3 ; 0x002: KFBTYP_ALLOCTBL
  9. [grid@db1 ~]$ kfed read /dev/oracleasm/disks/RLZY_DATA1 aun=113792 blkn=255 | grep type
  10. kfbh.type: 3 ; 0x002: KFBTYP_ALLOCTBL
复制代码

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

  1. [grid@db1 ~]$ kfed read /dev/oracleasm/disks/RLZY_DATA1 aun=227584 blkn=255 | grep type
  2. kfbh.type: 3 ; 0x002: KFBTYP_ALLOCTBL
  3. [grid@db1 ~]$ kfed read /dev/oracleasm/disks/RLZY_DATA1 aun=341376 blkn=255 | grep type
  4. kfbh.type: 3 ; 0x002: KFBTYP_ALLOCTBL
  5. [grid@db1 ~]$ kfed read /dev/oracleasm/disks/RLZY_DATA1 aun=455168 blkn=255 | grep type
  6. kfbh.type: 3 ; 0x002: KFBTYP_ALLOCTBL
复制代码

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



回复

使用道具 举报