Active Change Directory(ACD)
当ASM对多个数据结构执行原子性改变。ASM的active change directory 简称ACD会记录相应的日志,它类似于RDBMS的重做日志。ACD的ASM文件号为3。对应的日志记录会以单次IO的方式写入,来确保操作原子性。ACD被分成多个chunk或者thread,每个运行的ASM实例将得到一个大小为42MB的ACD chunk。当一个磁盘组被创建时,会分配一个独立的chunk给ACD。随着更多的实例挂载了该磁盘组,ACD的chunk数也会同比例增长,每个实例会使用属于自己的ACD chunk区。
ACD包含以下内容:
.ACDC – ACD checkpoint ACD检查点
.ABA – ACD block address ACD块地址
.LGE – ACD redo log record ACD 重做日志记录
.BCD – ACD block change descriptor ACD块变更描述
定位ASM active change directory
可以通过查询X$KFFXP视图来获取ACD目录包含的AU。ACD的文件号为3,因此在我们的查询中我们使number_kffxp=3
SQL> select group_number,name,type from v$asm_diskgroup; GROUP_NUMBER NAME TYPE ------------ ------------------------------ ------------ 1 ARCHDG NORMAL 2 CRSDG EXTERN 3 DATADG NORMAL SQL> select group_number,disk_number,name,path,state from v$asm_disk where group_number=3; GROUP_NUMBER DISK_NUMBER NAME PATH STATE ------------ ----------- ------------------------------ ------------------------------ ------------------------------ 3 0 DATADG_0001 /dev/raw/raw11 NORMAL 3 3 DATADG_0000 /dev/raw/raw10 NORMAL 3 1 DATADG_0003 /dev/raw/raw4 NORMAL 3 2 DATADG_0002 /dev/raw/raw3 NORMAL SQL> select number_kffxp file#, disk_kffxp disk#, count(disk_kffxp) extents 2 from x$kffxp 3 where group_kffxp=3 4 and disk_kffxp <> 65534 5 and number_kffxp=3 6 group by number_kffxp, disk_kffxp 7 order by 1; FILE# DISK# EXTENTS ---------- ---------- ---------- 3 0 64 3 1 63 3 2 64 3 3 64
file 3,即是active change directory,一个占据255个au
SQL> select x.xnum_kffxp "virtual extent",pxn_kffxp "physical extent",x.au_kffxp "au",x.disk_kffxp "disk #",d.name "disk name" 2 from x$kffxp x, v$asm_disk_stat d 3 where x.group_kffxp=d.group_number 4 and x.disk_kffxp=d.disk_number 5 and x.group_kffxp=3 6 and x.number_kffxp=3 7 order by 1, 2,3; virtual extent physical extent au disk # disk name -------------- --------------- ---------- ---------- ------------------------------------------------------------ 0 0 2 3 DATADG_0000 0 1 4 0 DATADG_0001 0 2 4 2 DATADG_0002 1 3 4 1 DATADG_0003 1 4 3 3 DATADG_0000 1 5 5 0 DATADG_0001 2 6 6 0 DATADG_0001 2 7 5 2 DATADG_0002 2 8 4 3 DATADG_0000 3 9 6 2 DATADG_0002 3 10 7 0 DATADG_0001 3 11 5 1 DATADG_0003 4 12 5 3 DATADG_0000 4 13 6 1 DATADG_0003 4 14 8 0 DATADG_0001 5 15 7 1 DATADG_0003 5 16 7 2 DATADG_0002 5 17 6 3 DATADG_0000 6 18 9 0 DATADG_0001 6 19 8 1 DATADG_0003 6 20 8 2 DATADG_0002 7 21 9 2 DATADG_0002 7 22 7 3 DATADG_0000 7 23 10 0 DATADG_0001 8 24 8 3 DATADG_0000 8 25 10 2 DATADG_0002 8 26 9 1 DATADG_0003 9 27 10 1 DATADG_0003 9 28 11 0 DATADG_0001 9 29 11 2 DATADG_0002 10 30 12 0 DATADG_0001 10 31 9 3 DATADG_0000 10 32 11 1 DATADG_0003 11 33 12 2 DATADG_0002 11 34 12 1 DATADG_0003 11 35 10 3 DATADG_0000 12 36 11 3 DATADG_0000 12 37 13 0 DATADG_0001 12 38 13 2 DATADG_0002 13 39 13 1 DATADG_0003 13 40 12 3 DATADG_0000 13 41 14 0 DATADG_0001 14 42 15 0 DATADG_0001 14 43 14 2 DATADG_0002 14 44 13 3 DATADG_0000 15 45 15 2 DATADG_0002 15 46 16 0 DATADG_0001 15 47 14 1 DATADG_0003 16 48 14 3 DATADG_0000 16 49 15 1 DATADG_0003 16 50 17 0 DATADG_0001 17 51 16 1 DATADG_0003 17 52 16 2 DATADG_0002 17 53 15 3 DATADG_0000 18 54 18 0 DATADG_0001 18 55 17 1 DATADG_0003 18 56 17 2 DATADG_0002 19 57 18 2 DATADG_0002 19 58 16 3 DATADG_0000 19 59 19 0 DATADG_0001 20 60 18 3 DATADG_0000 20 61 20 2 DATADG_0002 20 62 18 1 DATADG_0003 21 63 19 1 DATADG_0003 21 64 21 0 DATADG_0001 21 65 21 2 DATADG_0002 22 66 22 0 DATADG_0001 22 67 19 3 DATADG_0000 22 68 20 1 DATADG_0003 23 69 22 2 DATADG_0002 23 70 21 1 DATADG_0003 23 71 20 3 DATADG_0000 24 72 21 3 DATADG_0000 24 73 23 0 DATADG_0001 24 74 23 2 DATADG_0002 25 75 22 1 DATADG_0003 25 76 22 3 DATADG_0000 25 77 24 0 DATADG_0001 26 78 25 0 DATADG_0001 26 79 24 2 DATADG_0002 26 80 23 3 DATADG_0000 27 81 25 2 DATADG_0002 27 82 26 0 DATADG_0001 27 83 23 1 DATADG_0003 28 84 24 3 DATADG_0000 28 85 24 1 DATADG_0003 28 86 27 0 DATADG_0001 29 87 25 1 DATADG_0003 29 88 26 2 DATADG_0002 29 89 25 3 DATADG_0000 30 90 28 0 DATADG_0001 30 91 26 1 DATADG_0003 30 92 27 2 DATADG_0002 31 93 28 2 DATADG_0002 31 94 26 3 DATADG_0000 31 95 29 0 DATADG_0001 32 96 27 3 DATADG_0000 32 97 29 2 DATADG_0002 32 98 27 1 DATADG_0003 33 99 28 1 DATADG_0003 33 100 30 0 DATADG_0001 33 101 30 2 DATADG_0002 34 102 31 0 DATADG_0001 34 103 28 3 DATADG_0000 34 104 29 1 DATADG_0003 35 105 31 2 DATADG_0002 35 106 30 1 DATADG_0003 35 107 29 3 DATADG_0000 36 108 30 3 DATADG_0000 36 109 32 0 DATADG_0001 36 110 32 2 DATADG_0002 37 111 31 1 DATADG_0003 37 112 31 3 DATADG_0000 37 113 33 0 DATADG_0001 38 114 34 0 DATADG_0001 38 115 33 2 DATADG_0002 38 116 32 3 DATADG_0000 39 117 34 2 DATADG_0002 39 118 35 0 DATADG_0001 39 119 32 1 DATADG_0003 40 120 33 3 DATADG_0000 40 121 33 1 DATADG_0003 40 122 36 0 DATADG_0001 41 123 34 1 DATADG_0003 41 124 35 2 DATADG_0002 41 125 34 3 DATADG_0000 42 126 40 0 DATADG_0001 42 127 40 1 DATADG_0003 42 128 40 3 DATADG_0000 43 129 41 2 DATADG_0002 43 130 41 3 DATADG_0000 43 131 41 0 DATADG_0001 44 132 42 3 DATADG_0000 44 133 42 2 DATADG_0002 44 134 41 1 DATADG_0003 45 135 42 1 DATADG_0003 45 136 42 0 DATADG_0001 45 137 43 2 DATADG_0002 46 138 43 0 DATADG_0001 46 139 43 1 DATADG_0003 46 140 44 2 DATADG_0002 47 141 45 2 DATADG_0002 47 142 44 1 DATADG_0003 47 143 43 3 DATADG_0000 48 144 44 3 DATADG_0000 48 145 44 0 DATADG_0001 48 146 46 2 DATADG_0002 49 147 45 1 DATADG_0003 49 148 45 0 DATADG_0001 49 149 47 2 DATADG_0002 50 150 46 0 DATADG_0001 50 151 46 1 DATADG_0003 50 152 45 3 DATADG_0000 51 153 48 2 DATADG_0002 51 154 47 0 DATADG_0001 51 155 47 1 DATADG_0003 52 156 46 3 DATADG_0000 52 157 48 1 DATADG_0003 52 158 48 0 DATADG_0001 53 159 49 1 DATADG_0003 53 160 47 3 DATADG_0000 53 161 49 0 DATADG_0001 54 162 50 0 DATADG_0001 54 163 49 2 DATADG_0002 54 164 50 1 DATADG_0003 55 165 50 2 DATADG_0002 55 166 48 3 DATADG_0000 55 167 51 0 DATADG_0001 56 168 49 3 DATADG_0000 56 169 51 2 DATADG_0002 56 170 51 1 DATADG_0003 57 171 52 1 DATADG_0003 57 172 52 2 DATADG_0002 57 173 50 3 DATADG_0000 58 174 52 0 DATADG_0001 58 175 51 3 DATADG_0000 58 176 53 2 DATADG_0002 59 177 54 2 DATADG_0002 59 178 53 1 DATADG_0003 59 179 52 3 DATADG_0000 60 180 53 3 DATADG_0000 60 181 53 0 DATADG_0001 60 182 55 2 DATADG_0002 61 183 54 1 DATADG_0003 61 184 54 0 DATADG_0001 61 185 56 2 DATADG_0002 62 186 55 0 DATADG_0001 62 187 55 1 DATADG_0003 62 188 54 3 DATADG_0000 63 189 57 2 DATADG_0002 63 190 56 0 DATADG_0001 63 191 56 1 DATADG_0003 64 192 55 3 DATADG_0000 64 193 57 1 DATADG_0003 64 194 57 0 DATADG_0001 65 195 58 1 DATADG_0003 65 196 56 3 DATADG_0000 65 197 58 0 DATADG_0001 66 198 59 0 DATADG_0001 66 199 58 2 DATADG_0002 66 200 59 1 DATADG_0003 67 201 59 2 DATADG_0002 67 202 57 3 DATADG_0000 67 203 60 0 DATADG_0001 68 204 58 3 DATADG_0000 68 205 60 2 DATADG_0002 68 206 60 1 DATADG_0003 69 207 61 1 DATADG_0003 69 208 61 2 DATADG_0002 69 209 59 3 DATADG_0000 70 210 61 0 DATADG_0001 70 211 60 3 DATADG_0000 70 212 62 2 DATADG_0002 71 213 63 2 DATADG_0002 71 214 62 1 DATADG_0003 71 215 61 3 DATADG_0000 72 216 62 3 DATADG_0000 72 217 62 0 DATADG_0001 72 218 64 2 DATADG_0002 73 219 63 1 DATADG_0003 73 220 63 0 DATADG_0001 73 221 65 2 DATADG_0002 74 222 64 0 DATADG_0001 74 223 64 1 DATADG_0003 74 224 63 3 DATADG_0000 75 225 66 2 DATADG_0002 75 226 65 0 DATADG_0001 75 227 65 1 DATADG_0003 76 228 64 3 DATADG_0000 76 229 66 1 DATADG_0003 76 230 66 0 DATADG_0001 77 231 67 1 DATADG_0003 77 232 65 3 DATADG_0000 77 233 67 0 DATADG_0001 78 234 68 0 DATADG_0001 78 235 67 2 DATADG_0002 78 236 68 1 DATADG_0003 79 237 68 2 DATADG_0002 79 238 66 3 DATADG_0000 79 239 69 0 DATADG_0001 80 240 67 3 DATADG_0000 80 241 69 2 DATADG_0002 80 242 69 1 DATADG_0003 81 243 70 1 DATADG_0003 81 244 70 2 DATADG_0002 81 245 68 3 DATADG_0000 82 246 70 0 DATADG_0001 82 247 69 3 DATADG_0000 82 248 71 2 DATADG_0002 83 249 72 2 DATADG_0002 83 250 71 1 DATADG_0003 83 251 70 3 DATADG_0000 2147483648 0 20 0 DATADG_0001 2147483648 1 17 3 DATADG_0000 2147483648 2 19 2 DATADG_0002 255 rows selected.
查询返回了255行,即255个AU。其中虚拟extent为2147483648是当前没有被格式化的AU有3个,那么真正使用的是255-3=252,也就从虚拟extent的编号(0-83),由于磁盘组DATADG是normal冗余磁盘组并且存在三个或多个故障磁盘组,所以ACD有三份镜像,252/3=84个AU,而这里有2个ASM实例,所以每个ASM实例有42个AU,AU的大小为1MB,所以就是42MB。
使用kfed来读取元数据
首先读取磁盘组datadg的0号磁盘(/dev/raw/raw11)中的2号AU的3号块来定位到active change directory 所在AU
[grid@jyrac1 ~]$ kfed read /dev/raw/raw11 aun=2 blkn=3 | more kfbh.endian: 1 ; 0x000: 0x01 kfbh.hard: 130 ; 0x001: 0x82 kfbh.type: 4 ; 0x002: KFBTYP_FILEDIR kfbh.datfmt: 1 ; 0x003: 0x01 kfbh.block.blk: 3 ; 0x004: blk=3 kfbh.block.obj: 1 ; 0x008: file=1 kfbh.check: 40592047 ; 0x00c: 0x026b62af kfbh.fcn.base: 121 ; 0x010: 0x00000079 kfbh.fcn.wrap: 0 ; 0x014: 0x00000000 kfbh.spare1: 0 ; 0x018: 0x00000000 kfbh.spare2: 0 ; 0x01c: 0x00000000 kfffdb.node.incarn: 1 ; 0x000: A=1 NUMM=0x0 kfffdb.node.frlist.number: 4294967295 ; 0x004: 0xffffffff kfffdb.node.frlist.incarn: 0 ; 0x008: A=0 NUMM=0x0 kfffdb.hibytes: 0 ; 0x00c: 0x00000000 kfffdb.lobytes: 88080384 ; 0x010: 0x05400000 kfffdb.xtntcnt: 252 ; 0x014: 0x000000fc kfffdb.xtnteof: 252 ; 0x018: 0x000000fc kfffdb.blkSize: 4096 ; 0x01c: 0x00001000 kfffdb.flags: 1 ; 0x020: O=1 S=0 S=0 D=0 C=0 I=0 R=0 A=0 kfffdb.fileType: 15 ; 0x021: 0x0f kfffdb.dXrs: 19 ; 0x022: SCHE=0x1 NUMB=0x3 kfffdb.iXrs: 19 ; 0x023: SCHE=0x1 NUMB=0x3 kfffdb.dXsiz[0]: 4294967295 ; 0x024: 0xffffffff kfffdb.dXsiz[1]: 0 ; 0x028: 0x00000000 kfffdb.dXsiz[2]: 0 ; 0x02c: 0x00000000 kfffdb.iXsiz[0]: 4294967295 ; 0x030: 0xffffffff kfffdb.iXsiz[1]: 0 ; 0x034: 0x00000000 kfffdb.iXsiz[2]: 0 ; 0x038: 0x00000000 kfffdb.xtntblk: 63 ; 0x03c: 0x003f kfffdb.break: 60 ; 0x03e: 0x003c kfffdb.priZn: 0 ; 0x040: KFDZN_COLD kfffdb.secZn: 0 ; 0x041: KFDZN_COLD kfffdb.ub2spare: 0 ; 0x042: 0x0000 kfffdb.alias[0]: 4294967295 ; 0x044: 0xffffffff kfffdb.alias[1]: 4294967295 ; 0x048: 0xffffffff kfffdb.strpwdth: 0 ; 0x04c: 0x00 kfffdb.strpsz: 0 ; 0x04d: 0x00 kfffdb.usmsz: 0 ; 0x04e: 0x0000 kfffdb.crets.hi: 33042831 ; 0x050: HOUR=0xf DAYS=0xc MNTH=0xc YEAR=0x7e0 kfffdb.crets.lo: 2457465856 ; 0x054: USEC=0x0 MSEC=0x27d SECS=0x27 MINS=0x24 kfffdb.modts.hi: 33042831 ; 0x058: HOUR=0xf DAYS=0xc MNTH=0xc YEAR=0x7e0 kfffdb.modts.lo: 2457465856 ; 0x05c: USEC=0x0 MSEC=0x27d SECS=0x27 MINS=0x24 kfffdb.dasz[0]: 0 ; 0x060: 0x00 kfffdb.dasz[1]: 0 ; 0x061: 0x00 kfffdb.dasz[2]: 0 ; 0x062: 0x00 kfffdb.dasz[3]: 0 ; 0x063: 0x00 kfffdb.permissn: 0 ; 0x064: 0x00 kfffdb.ub1spar1: 0 ; 0x065: 0x00 kfffdb.ub2spar2: 0 ; 0x066: 0x0000 kfffdb.user.entnum: 0 ; 0x068: 0x0000 kfffdb.user.entinc: 0 ; 0x06a: 0x0000 kfffdb.group.entnum: 0 ; 0x06c: 0x0000 kfffdb.group.entinc: 0 ; 0x06e: 0x0000 kfffdb.spare[0]: 0 ; 0x070: 0x00000000 kfffdb.spare[1]: 0 ; 0x074: 0x00000000 kfffdb.spare[2]: 0 ; 0x078: 0x00000000 kfffdb.spare[3]: 0 ; 0x07c: 0x00000000 kfffdb.spare[4]: 0 ; 0x080: 0x00000000 kfffdb.spare[5]: 0 ; 0x084: 0x00000000 kfffdb.spare[6]: 0 ; 0x088: 0x00000000 kfffdb.spare[7]: 0 ; 0x08c: 0x00000000 kfffdb.spare[8]: 0 ; 0x090: 0x00000000 kfffdb.spare[9]: 0 ; 0x094: 0x00000000 kfffdb.spare[10]: 0 ; 0x098: 0x00000000 kfffdb.spare[11]: 0 ; 0x09c: 0x00000000 kfffdb.usm: ; 0x0a0: length=0 kfffde[0].xptr.au: 2 ; 0x4a0: 0x00000002 kfffde[0].xptr.disk: 3 ; 0x4a4: 0x0003 kfffde[0].xptr.flags: 0 ; 0x4a6: L=0 E=0 D=0 S=0 kfffde[0].xptr.chk: 43 ; 0x4a7: 0x2b kfffde[1].xptr.au: 4 ; 0x4a8: 0x00000004 kfffde[1].xptr.disk: 0 ; 0x4ac: 0x0000 kfffde[1].xptr.flags: 0 ; 0x4ae: L=0 E=0 D=0 S=0 kfffde[1].xptr.chk: 46 ; 0x4af: 0x2e kfffde[2].xptr.au: 4 ; 0x4b0: 0x00000004 kfffde[2].xptr.disk: 2 ; 0x4b4: 0x0002 kfffde[2].xptr.flags: 0 ; 0x4b6: L=0 E=0 D=0 S=0 kfffde[2].xptr.chk: 44 ; 0x4b7: 0x2c kfffde[3].xptr.au: 4 ; 0x4b8: 0x00000004 kfffde[3].xptr.disk: 1 ; 0x4bc: 0x0001 kfffde[3].xptr.flags: 0 ; 0x4be: L=0 E=0 D=0 S=0 kfffde[3].xptr.chk: 47 ; 0x4bf: 0x2f kfffde[4].xptr.au: 3 ; 0x4c0: 0x00000003 kfffde[4].xptr.disk: 3 ; 0x4c4: 0x0003 kfffde[4].xptr.flags: 0 ; 0x4c6: L=0 E=0 D=0 S=0 kfffde[4].xptr.chk: 42 ; 0x4c7: 0x2a kfffde[5].xptr.au: 5 ; 0x4c8: 0x00000005 kfffde[5].xptr.disk: 0 ; 0x4cc: 0x0000 kfffde[5].xptr.flags: 0 ; 0x4ce: L=0 E=0 D=0 S=0 kfffde[5].xptr.chk: 47 ; 0x4cf: 0x2f
从kfffde[0].xptr.au=2,kfffde[0].xptr.disk=3,可知ACD所在AU为3号磁盘的2号AU,它还有两个镜像副本存储在0号磁盘4号AU与2号磁盘4号AU上,这与查询视图所得到的结果完全一致。
SQL> select x.xnum_kffxp "virtual extent",pxn_kffxp "physical extent",x.au_kffxp "au",x.disk_kffxp "disk #",d.name "disk name" 2 from x$kffxp x, v$asm_disk_stat d 3 where x.group_kffxp=d.group_number 4 and x.disk_kffxp=d.disk_number 5 and x.group_kffxp=3 6 and x.number_kffxp=3 7 order by 1, 2,3; virtual extent physical extent au disk # disk name -------------- --------------- ---------- ---------- ------------------------------------------------------------ 0 0 2 3 DATADG_0000 0 1 4 0 DATADG_0001 0 2 4 2 DATADG_0002 .....
使用kfed查看ASM active change directory
接下来使用kfed工具对ACD进行查看。因为上一个查询显示ACD是从DATADG_0000(/dev/raw/raw10)磁盘的第2个AU开始的,而且有2个ASM实例,总共有84个AU,每个AU有三份镜像,那么是不是1
号ASM实例的ACD分布在虚拟extent(0-41),而2号ASM实例的ACD分布在虚拟extent(42-83),下面进行验证。
[grid@jyrac1 ~]$ kfed read /dev/raw/raw10 aun=2 | more kfbh.endian: 1 ; 0x000: 0x01 kfbh.hard: 130 ; 0x001: 0x82 kfbh.type: 7 ; 0x002: KFBTYP_ACDC --ACDC,即是Active Change Diectory Checkpoint kfbh.datfmt: 1 ; 0x003: 0x01 kfbh.block.blk: 0 ; 0x004: blk=0 --这是对应的block号 kfbh.block.obj: 3 ; 0x008: file=3 kfbh.check: 1111751467 ; 0x00c: 0x4243fb2b kfbh.fcn.base: 0 ; 0x010: 0x00000000 kfbh.fcn.wrap: 0 ; 0x014: 0x00000000 kfbh.spare1: 0 ; 0x018: 0x00000000 kfbh.spare2: 0 ; 0x01c: 0x00000000 --kfracdc,这部分即表示active change directory checkpoint信息。 kfracdc.eyec[0]: 65 ; 0x000: 0x41 kfracdc.eyec[1]: 67 ; 0x001: 0x43 kfracdc.eyec[2]: 68 ; 0x002: 0x44 kfracdc.eyec[3]: 67 ; 0x003: 0x43 kfracdc.thread: 1 ; 0x004: 0x00000001 --thread 1,表示对应1号asm实例。 kfracdc.lastAba.seq: 4294967295 ; 0x008: 0xffffffff --last ACD block address sequences kfracdc.lastAba.blk: 4294967295 ; 0x00c: 0xffffffff --last ACD block address block number kfracdc.blk0: 1 ; 0x010: 0x00000001 kfracdc.blks: 10751 ; 0x014: 0x000029ff --ACD 数据(元数据和数据)所占block总数,换算一下即为42m. 10751*4096/1024/1024=42MB kfracdc.ckpt.seq: 3 ; 0x018: 0x00000003 --checkpoint当前的sequences号 kfracdc.ckpt.blk: 598 ; 0x01c: 0x00000256 --checkpoint信息所占的block数 kfracdc.fcn.base: 4288 ; 0x020: 0x000010c0 kfracdc.fcn.wrap: 0 ; 0x024: 0x00000000 kfracdc.bufBlks: 256 ; 0x028: 0x00000100 --block总数 kfracdc.strt112.seq: 2 ; 0x02c: 0x00000002 kfracdc.strt112.blk: 0 ; 0x030: 0x00000000
从上面的kfracdc.thread=1,可以确定存储在3号磁盘DATADG_0000(/dev/raw/raw10)的第2个AU上的ACD属于1号ASM实例,从之前的查询结果可知从虚拟extent(42-83)所存储的ACD应该属于2号
ASM实例,2号ASM实例上第一个ACD就分布在虚拟extent 42所对应的3号磁盘DATADG_0000(/dev/raw/raw10)的第40个AU(0号磁盘与1号磁盘上的第40个AU为镜像副本)
[grid@jyrac1 ~]$ kfed read /dev/raw/raw10 aun=40 blkn=0 | more kfbh.endian: 1 ; 0x000: 0x01 kfbh.hard: 130 ; 0x001: 0x82 kfbh.type: 7 ; 0x002: KFBTYP_ACDC --ACDC,即是Active Change Diectory Checkpoint kfbh.datfmt: 1 ; 0x003: 0x01 kfbh.block.blk: 10752 ; 0x004: blk=10752 --这是对应的block号,这也1号ASM实例中所查到的ACD元数据中的kfracdc.blks:=10751对应上了 kfbh.block.obj: 3 ; 0x008: file=3 kfbh.check: 1111751043 ; 0x00c: 0x4243f983 kfbh.fcn.base: 77 ; 0x010: 0x0000004d kfbh.fcn.wrap: 0 ; 0x014: 0x00000000 kfbh.spare1: 0 ; 0x018: 0x00000000 kfbh.spare2: 0 ; 0x01c: 0x00000000 kfracdc.eyec[0]: 65 ; 0x000: 0x41 kfracdc.eyec[1]: 67 ; 0x001: 0x43 kfracdc.eyec[2]: 68 ; 0x002: 0x44 kfracdc.eyec[3]: 67 ; 0x003: 0x43 kfracdc.thread: 2 ; 0x004: 0x00000002 --thread 2,表示对应2号asm实例。 kfracdc.lastAba.seq: 4294967295 ; 0x008: 0xffffffff --last ACD block address sequences kfracdc.lastAba.blk: 4294967295 ; 0x00c: 0xffffffff --last ACD block address block number kfracdc.blk0: 10753 ; 0x010: 0x00002a01 kfracdc.blks: 10751 ; 0x014: 0x000029ff --ACD 数据(元数据和数据)所占block总数,换算一下即为42m. 10751*4096/1024/1024=42MB kfracdc.ckpt.seq: 3 ; 0x018: 0x00000003 --checkpoint当前的sequences号 kfracdc.ckpt.blk: 187 ; 0x01c: 0x000000bb --checkpoint信息所占的block数 kfracdc.fcn.base: 4299 ; 0x020: 0x000010cb kfracdc.fcn.wrap: 0 ; 0x024: 0x00000000 kfracdc.bufBlks: 256 ; 0x028: 0x00000100 --block总数 kfracdc.strt112.seq: 2 ; 0x02c: 0x00000002 kfracdc.strt112.blk: 0 ; 0x030: 0x00000000
以上是ACD的开始,也就是block 0。我们来看一下block 1,也就是ACD的实际数据
[grid@jyrac1 ~]$ kfed read /dev/raw/raw10 aun=2 blkn=1 | more kfbh.endian: 1 ; 0x000: 0x01 kfbh.hard: 130 ; 0x001: 0x82 kfbh.type: 8 ; 0x002: KFBTYP_CHNGDIR kfbh.datfmt: 1 ; 0x003: 0x01 kfbh.block.blk: 1 ; 0x004: blk=1 kfbh.block.obj: 3 ; 0x008: file=3 kfbh.check: 17400326 ; 0x00c: 0x01098206 kfbh.fcn.base: 0 ; 0x010: 0x00000000 kfbh.fcn.wrap: 0 ; 0x014: 0x00000000 kfbh.spare1: 0 ; 0x018: 0x00000000 kfbh.spare2: 0 ; 0x01c: 0x00000000 kfracdb.aba.seq: 2 ; 0x000: 0x00000002 --ACD block address sequences kfracdb.aba.blk: 0 ; 0x004: 0x00000000 --ACD block address block number kfracdb.ents: 2 ; 0x008: 0x0002 --这里应该是指的包含的extent数。即2m kfracdb.ub2spare: 0 ; 0x00a: 0x0000 --下面的信息为ACD redo log records记录 kfracdb.lge[0].valid: 1 ; 0x00c: V=1 B=0 M=0 kfracdb.lge[0].chgCount: 1 ; 0x00d: 0x01 kfracdb.lge[0].len: 64 ; 0x00e: 0x0040 kfracdb.lge[0].kfcn.base: 1 ; 0x010: 0x00000001 kfracdb.lge[0].kfcn.wrap: 0 ; 0x014: 0x00000000 --下面的bcd信息是表示ACD block change description信息 kfracdb.lge[0].bcd[0].kfbl.blk: 0 ; 0x018: blk=0 kfracdb.lge[0].bcd[0].kfbl.obj: 4 ; 0x01c: file=4 kfracdb.lge[0].bcd[0].kfcn.base: 0 ; 0x020: 0x00000000 kfracdb.lge[0].bcd[0].kfcn.wrap: 0 ; 0x024: 0x00000000 kfracdb.lge[0].bcd[0].oplen: 4 ; 0x028: 0x0004 --表示长度,类似logfile dump的LEN kfracdb.lge[0].bcd[0].blkIndex: 0 ; 0x02a: 0x0000 kfracdb.lge[0].bcd[0].flags: 28 ; 0x02c: F=0 N=0 F=1 L=1 V=1 A=0 C=0 kfracdb.lge[0].bcd[0].opcode: 212 ; 0x02e: 0x00d4 --opcode,类似数据库实例中的update/delete/insert操作的opcode编号 kfracdb.lge[0].bcd[0].kfbtyp: 9 ; 0x030: KFBTYP_COD_BGO --操作类型,类似数据库实例中的update/delete/insert等类型 kfracdb.lge[0].bcd[0].redund: 19 ; 0x031: SCHE=0x1 NUMB=0x3 --这里表示冗余级别,17是unport,18是mirror,19表示high kfracdb.lge[0].bcd[0].pad: 63903 ; 0x032: 0xf99f kfracdb.lge[0].bcd[0].KFRCOD_CRASH: 1 ; 0x034: 0x00000001 kfracdb.lge[0].bcd[0].au[0]: 36 ; 0x038: 0x00000024 kfracdb.lge[0].bcd[0].au[1]: 35 ; 0x03c: 0x00000023 kfracdb.lge[0].bcd[0].au[2]: 35 ; 0x040: 0x00000023 kfracdb.lge[0].bcd[0].disks[0]: 2 ; 0x044: 0x0002 kfracdb.lge[0].bcd[0].disks[1]: 3 ; 0x046: 0x0003 kfracdb.lge[0].bcd[0].disks[2]: 1 ; 0x048: 0x0001 kfracdb.lge[1].valid: 1 ; 0x04c: V=1 B=0 M=0 kfracdb.lge[1].chgCount: 1 ; 0x04d: 0x01 kfracdb.lge[1].len: 64 ; 0x04e: 0x0040 kfracdb.lge[1].kfcn.base: 2 ; 0x050: 0x00000002 kfracdb.lge[1].kfcn.wrap: 0 ; 0x054: 0x00000000 kfracdb.lge[1].bcd[0].kfbl.blk: 1 ; 0x058: blk=1 kfracdb.lge[1].bcd[0].kfbl.obj: 4 ; 0x05c: file=4 kfracdb.lge[1].bcd[0].kfcn.base: 0 ; 0x060: 0x00000000 kfracdb.lge[1].bcd[0].kfcn.wrap: 0 ; 0x064: 0x00000000 kfracdb.lge[1].bcd[0].oplen: 4 ; 0x068: 0x0004 kfracdb.lge[1].bcd[0].blkIndex: 1 ; 0x06a: 0x0001 kfracdb.lge[1].bcd[0].flags: 28 ; 0x06c: F=0 N=0 F=1 L=1 V=1 A=0 C=0 kfracdb.lge[1].bcd[0].opcode: 212 ; 0x06e: 0x00d4 kfracdb.lge[1].bcd[0].kfbtyp: 15 ; 0x070: KFBTYP_COD_RBO kfracdb.lge[1].bcd[0].redund: 19 ; 0x071: SCHE=0x1 NUMB=0x3 kfracdb.lge[1].bcd[0].pad: 63903 ; 0x072: 0xf99f kfracdb.lge[1].bcd[0].KFRCOD_CRASH: 0 ; 0x074: 0x00000000 kfracdb.lge[1].bcd[0].au[0]: 36 ; 0x078: 0x00000024 kfracdb.lge[1].bcd[0].au[1]: 35 ; 0x07c: 0x00000023 kfracdb.lge[1].bcd[0].au[2]: 35 ; 0x080: 0x00000023 kfracdb.lge[1].bcd[0].disks[0]: 2 ; 0x084: 0x0002 kfracdb.lge[1].bcd[0].disks[1]: 3 ; 0x086: 0x0003 kfracdb.lge[1].bcd[0].disks[2]: 1 ; 0x088: 0x0001
当运行的asm实例,突然crash后,那么重启asm实例以后,asm可以根据ACD信息去进行instance recover
小结:
Active change dictectory,也就是asm元数据file 3,一共占据42个AU 大小,简称ACD. 每个asm实例对应一份ACD信息,换句话讲,你是双节点asm rac,那么就有84M的ACD数据,以此类推.(事实上不管你AU是多大ACD的信息都是固定的大小)。asm中ACD就类似数据库实例中的redo,记录asm元数据操作记录,以便于asm crash后进行instance recover。ACD信息所在AU,第一个block是其元数据,后面的block是data信息。 ACD data的数据,跟redo的结构有点类似,里面记录的也是thread,sequence,len,opcode等信息。