Active Change Directory简称ACD,是ASM的3号文件,我们都知道redo日志记录了数据文件数据块的每一次原子性变化,而ACD它描述了ASM元数据块每一次原子性变化,可以认为ACD是ASM实例的redo。redo根据database实例分为多个thread,同样ACD根据ASM实例也分为多个thread,每个thread为ACD分配了42个M,假如磁盘组AU为1M,那么thread 1使用0-41号extent,thread 2使用42-83号extent,以此类推
1 2 3 4 5 6 7 8 9 10 11 12 |
SQL> select PXN_KFFXP,XNUM_KFFXP,DISK_KFFXP,AU_KFFXP from x$kffxp where GROUP_KFFXP=2 and NUMBER_KFFXP=3 and XNUM_KFFXP<>2147483648; PXN_KFFXP XNUM_KFFXP DISK_KFFXP AU_KFFXP ---------- ---------- ---------- ---------- 0 0 2 3 --thread 1 ACD的第一个逻辑extent ... 41 41 0 16 42 42 2 2469 --thread 2 ACD的第一个逻辑extent ... 83 83 0 2483 84 rows selected. |
PXN_KFFXP为物理extent号,XNUM_KFFXP为逻辑extent号
- 对于external冗余磁盘组,XNUM_KFFXP=PXN_KFFXP
- 对于normal冗余磁盘组,XNUM_KFFXP=trunc(PXN_KFFXP/2)
- 对于high冗余磁盘组,XNUM_KFFXP=trunc(PXN_KFFXP/3)
需要注意的是对于元数据asm文件,normal磁盘组也有3份镜像,所以XNUM_KFFXP=trunc(PXN_KFFXP/3),对于每一个thread的ACD的第一个AU的0号块,存放的是ACD checkpoint block,它记录着ASM磁盘组元数据的检查点信息,当磁盘组意外dismount,重新mount时,需要从ACD checkpoint的位置开始recover,这点与db实例的实例恢复类似。
1 2 3 4 5 6 7 |
NOTE: attached to recovery domain 2 Fri Sep 25 00:31:57 2020 NOTE: crash recovery of group SOLDATA will recover thread=1 ckpt=28.3507 domain=2 inc#=2 instnum=2 NOTE: crash recovery of group SOLDATA will recover thread=2 ckpt=39.8576 domain=2 inc#=4 instnum=1 NOTE: crash recovery of group SOLDATA will recover thread=3 ckpt=21.9043 domain=2 inc#=6 instnum=4 NOTE: crash recovery of group SOLDATA will recover thread=4 ckpt=22.6878 domain=2 inc#=12 instnum=3 |
每个thread的ACD checkpoint block之后的块都是Active change block,是真正存放ASM元数据块改动记录的地方,下面我们来看看ACD checkpoint block和Active change block存放的内容。
ACD checkpoint block:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 |
[grid@rac1 ~]$ kfed read /dev/asmdisk-data6 aun=3 kfbh.endian: 1 ; 0x000: 0x01 kfbh.hard: 130 ; 0x001: 0x82 kfbh.type: 7 ; 0x002: KFBTYP_ACDC kfbh.datfmt: 1 ; 0x003: 0x01 kfbh.block.blk: 0 ; 0x004: blk=0 kfbh.block.obj: 3 ; 0x008: file=3 kfbh.check: 1111749672 ; 0x00c: 0x4243f428 kfbh.fcn.base: 0 ; 0x010: 0x00000000 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: 1 ; 0x004: 0x00000001 --thread 1 kfracdc.lastAba.seq: 4294967295 ; 0x008: 0xffffffff kfracdc.lastAba.blk: 4294967295 ; 0x00c: 0xffffffff kfracdc.blk0: 1 ; 0x010: 0x00000001 kfracdc.blks: 10751 ; 0x014: 0x000029ff kfracdc.ckpt.seq: 5 ; 0x018: 0x00000005 kfracdc.ckpt.blk: 659 ; 0x01c: 0x00000293 kfracdc.fcn.base: 7936 ; 0x020: 0x00001f00 kfracdc.fcn.wrap: 0 ; 0x024: 0x00000000 kfracdc.bufBlks: 256 ; 0x028: 0x00000100 kfracdc.strt112.seq: 2 ; 0x02c: 0x00000002 kfracdc.strt112.blk: 0 ; 0x030: 0x00000000 [grid@rac1 ~]$ kfed read /dev/asmdisk-data6 aun=2469 blkn=0 kfbh.endian: 1 ; 0x000: 0x01 kfbh.hard: 130 ; 0x001: 0x82 kfbh.type: 7 ; 0x002: KFBTYP_ACDC kfbh.datfmt: 1 ; 0x003: 0x01 kfbh.block.blk: 10752 ; 0x004: blk=10752 kfbh.block.obj: 3 ; 0x008: file=3 kfbh.check: 1111747004 ; 0x00c: 0x4243e9bc kfbh.fcn.base: 7882 ; 0x010: 0x00001eca 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 kfracdc.lastAba.seq: 4294967295 ; 0x008: 0xffffffff kfracdc.lastAba.blk: 4294967295 ; 0x00c: 0xffffffff kfracdc.blk0: 10753 ; 0x010: 0x00002a01 kfracdc.blks: 10751 ; 0x014: 0x000029ff kfracdc.ckpt.seq: 2 ; 0x018: 0x00000002 kfracdc.ckpt.blk: 2 ; 0x01c: 0x00000002 kfracdc.fcn.base: 7883 ; 0x020: 0x00001ecb kfracdc.fcn.wrap: 0 ; 0x024: 0x00000000 kfracdc.bufBlks: 256 ; 0x028: 0x00000100 kfracdc.strt112.seq: 2 ; 0x02c: 0x00000002 kfracdc.strt112.blk: 0 ; 0x030: 0x00000000 |
- KFBTYP_ACDC:ACD checkpoint
- kfracdc.thread:ASM thread号
- kfracdc.blk0:该thread的第一个Active change block块号
- kfracdc.blks:该thread有多少个Active change block块,ASM元数据块大小为4k,10751个Active change block,再加上1个ACDC block,正好是42M即42个AU
- kfracdc.ckpt.seq/blk:checkpoint ABA(ACD block address),类似于db实例的checkpoint rba
- kfracdc.fcn.base/wrap:checkpoint FCN,类似于db实例的checkpoint scn
Active change block:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 |
[grid@rac1 ~]$ kfed read /dev/asmdisk-data6 aun=3 blkn=4|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: 4 ; 0x004: blk=4 kfbh.block.obj: 3 ; 0x008: file=3 kfbh.check: 4174549927 ; 0x00c: 0xf8d293a7 kfbh.fcn.base: 80 ; 0x010: 0x00000050 kfbh.fcn.wrap: 0 ; 0x014: 0x00000000 kfbh.spare1: 0 ; 0x018: 0x00000000 kfbh.spare2: 0 ; 0x01c: 0x00000000 kfracdb.aba.seq: 2 ; 0x000: 0x00000002 kfracdb.aba.blk: 3 ; 0x004: 0x00000003 kfracdb.ents: 77 ; 0x008: 0x004d kfracdb.ub2spare: 0 ; 0x00a: 0x0000 kfracdb.lge[0].valid: 1 ; 0x00c: V=1 B=0 M=0 kfracdb.lge[0].chgCount: 1 ; 0x00d: 0x01 kfracdb.lge[0].len: 52 ; 0x00e: 0x0034 kfracdb.lge[0].kfcn.base: 81 ; 0x010: 0x00000051 kfracdb.lge[0].kfcn.wrap: 0 ; 0x014: 0x00000000 kfracdb.lge[0].bcd[0].kfbl.blk: 417 ; 0x018: blk=417 kfracdb.lge[0].bcd[0].kfbl.obj: 4 ; 0x01c: file=4 kfracdb.lge[0].bcd[0].kfcn.base: 81 ; 0x020: 0x00000051 kfracdb.lge[0].bcd[0].kfcn.wrap: 0 ; 0x024: 0x00000000 kfracdb.lge[0].bcd[0].oplen: 4 ; 0x028: 0x0004 kfracdb.lge[0].bcd[0].blkIndex: 161 ; 0x02a: 0x00a1 kfracdb.lge[0].bcd[0].flags: 30 ; 0x02c: F=0 N=1 F=1 L=1 V=1 A=0 C=0 kfracdb.lge[0].bcd[0].opcode: 208 ; 0x02e: 0x00d0 kfracdb.lge[0].bcd[0].kfbtyp: 0 ; 0x030: KFBTYP_INVALID kfracdb.lge[0].bcd[0].redund: 17 ; 0x031: SCHE=0x1 NUMB=0x1 kfracdb.lge[0].bcd[0].pad: 63903 ; 0x032: 0xf99f kfracdb.lge[0].bcd[0].KFRCOD_NEW: 16 ; 0x034: 0x00000010 kfracdb.lge[0].bcd[0].au[0]: 17 ; 0x038: 0x00000011 kfracdb.lge[0].bcd[0].disks[0]: 2 ; 0x03c: 0x0002 kfracdb.lge[1].valid: 1 ; 0x040: V=1 B=0 M=0 kfracdb.lge[1].chgCount: 1 ; 0x041: 0x01 kfracdb.lge[1].len: 52 ; 0x042: 0x0034 kfracdb.lge[1].kfcn.base: 82 ; 0x044: 0x00000052 kfracdb.lge[1].kfcn.wrap: 0 ; 0x048: 0x00000000 kfracdb.lge[1].bcd[0].kfbl.blk: 418 ; 0x04c: blk=418 kfracdb.lge[1].bcd[0].kfbl.obj: 4 ; 0x050: file=4 kfracdb.lge[1].bcd[0].kfcn.base: 82 ; 0x054: 0x00000052 kfracdb.lge[1].bcd[0].kfcn.wrap: 0 ; 0x058: 0x00000000 kfracdb.lge[1].bcd[0].oplen: 4 ; 0x05c: 0x0004 kfracdb.lge[1].bcd[0].blkIndex: 162 ; 0x05e: 0x00a2 kfracdb.lge[1].bcd[0].flags: 30 ; 0x060: F=0 N=1 F=1 L=1 V=1 A=0 C=0 --More-- |
- KFBTYP_CHNGDIR:Active change block
- kfracdb.aba.seq/blk:ACD block address
- kfracdb.ents:此Active change block有多少个lge(ACD redo log record)
- kfracdb.lge:ACD redo log record,类似于db实例redo的重做记录
- lge.chgCount:该lge有多少BCD(block change descriptor),BCD类似于db实例redo的重做记录的改动向量
- lge.len:lge的size
- lge.kfcn.base/wrap:lge的fcn,类似于db实例redo生成重做记录的SCN
- lge.chgCount:该lge有多少BCD(block change descriptor)
- lge.bcd:block change descriptor,类似于db实例redo的重做记录的改动向量,描述了每一次元数据块的改动