【Oracle ASM】ASM FILE NUMBER 3 Active Change Directory

《深入了解Oracle ASM(二):ASM File number 1 文件目录》 

《【Oracle ASM】ASM FILE NUMBER #2 DISK Directory》

ASM FILE NUMBER 3中存放的是Active Change Directory,其作用在于维护对于一个或者多个metadata block的原子性变化,ASM的redo log record 会写入到Active Change Directory(COD)中。

log record是通过单一IO写出的。每一个ASM实例会为ACD分配42个AU的区域来存放生成的redo。 每一个AU的blkn=0用来存放检查点记录。 检查点记录每3秒被写一次,其描述了当实例crash时应当从哪里开始读取redo。

AU中剩余的部分循环写入redo,这些redo包含了所有metadata block的变化。这一块很像RDBMS的redolog。

 

ACDC – ACD checkpoint

ABA – ACD block address

LGE – ACD redo log record

BCD – ACD block change descriptor

 

 

SQL> SELECT xnum_kffxp "Extent", au_kffxp "AU", disk_kffxp "Disk" from  x$kffxp
  2     WHERE group_kffxp=1 and number_kffxp=3
  3     and xnum_kffxp <> 2147483648;

    Extent         AU       Disk
---------- ---------- ----------
         0          3          8
         0          2          7
         0          2          5
         1          3          1
         1          2         13
         1          4          2
         2          2         12
         2          3         13
         2          3          0
         3          3          5
         3          4          1

    Extent         AU       Disk
---------- ---------- ----------
         3          5          2
         4          3          7
         4          3          4
         4          4          8
         5          2         10
         5          5          8
         5          4         13
         6          6          2
         6          4          0
         6          4          4
         7          2          3

    Extent         AU       Disk
---------- ---------- ----------
         7          2          6
         7          5          1
         8          5          4
         8          7          2
         8          6          1
         9          5         13
         9          8          2
         9          5          0
        10          6          0
        10          9          2
        10          6         13

33 rows selected.

[oracle@mlab2 trace]$ kfed read /oracleasm/asm-disk09 aus=4194304 aun=3 blkn=0|less
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:                  1111708235 ; 0x00c: 0x4243524b
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
kfracdc.lastAba.seq:         4294967295 ; 0x008: 0xffffffff
kfracdc.lastAba.blk:         4294967295 ; 0x00c: 0xffffffff
kfracdc.blk0:                         1 ; 0x010: 0x00000001
kfracdc.blks:                     11263 ; 0x014: 0x00002bff
kfracdc.ckpt.seq:                     6 ; 0x018: 0x00000006
kfracdc.ckpt.blk:                  5310 ; 0x01c: 0x000014be
kfracdc.fcn.base:                 44621 ; 0x020: 0x0000ae4d
kfracdc.fcn.wrap:                     0 ; 0x024: 0x00000000
kfracdc.bufBlks:                    512 ; 0x028: 0x00000200
kfracdc.strt112.seq:                  2 ; 0x02c: 0x00000002
kfracdc.strt112.blk:                  0 ; 0x030: 0x00000000

ACD的AU的blkn=0记录checkpoint record ,KFBTYP_ACDC即 Checkpoint block

kfracdc

  • kfracdc.eyec[0] eye catcher: ACDC
  • kfracdc.thread: 线程号
  • kfracdc.lastAba.seq/blk last valid block of the aba
  • kfracdc.blk0 addr of block 0 of this thd
  • kfracdc.ckpt.seq/blk checkpoint ABA. recovery must start here
  • kfracdc.fcn.base/wrap checkpoint FCN. If thread is closed, this is last KFCN it wrote to the log
  • bufBlks size of buffer in blks when this chunk was last opened
  • kfracdc.blks # of blocks in this thread

 

blkn=0 之后的均是KFBTYP_CHNGDIR  即Active change block

 

oracle@mlab2 trace]$ kfed read /oracleasm/asm-disk09 aus=4194304 aun=3 blkn=1|less
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
kfracdb.aba.blk:                      0 ; 0x004: 0x00000000
kfracdb.ents:                         2 ; 0x008: 0x0002
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:                  64 ; 0x00e: 0x0040
kfracdb.lge[0].kfcn.base:             1 ; 0x010: 0x00000001
kfracdb.lge[0].kfcn.wrap:             0 ; 0x014: 0x00000000
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
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
kfracdb.lge[0].bcd[0].kfbtyp:         9 ; 0x030: KFBTYP_COD_BGO
kfracdb.lge[0].bcd[0].redund:        19 ; 0x031: SCHE=0x1 NUMB=0x3
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]:          7 ; 0x038: 0x00000007
kfracdb.lge[0].bcd[0].au[1]:          3 ; 0x03c: 0x00000003
kfracdb.lge[0].bcd[0].au[2]:          6 ; 0x040: 0x00000006
kfracdb.lge[0].bcd[0].disks[0]:       0 ; 0x044: 0x0000
kfracdb.lge[0].bcd[0].disks[1]:       3 ; 0x046: 0x0003
kfracdb.lge[0].bcd[0].disks[2]:       4 ; 0x048: 0x0004
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.aba.seq/blk  the ABA of this block

kfracdb.ents  # of kfrlge entries in block

kfracdb.lge[0].valid: 之后的是实际的redo entry

Trackbacks

  1. […] 《【Oracle ASM】ASM FILE NUMBER 3 Active Change Directory》      中我们介绍而来ACD,但是对于长时间运行的操作则简单的ACD不足以描述其变化。 在一些特殊情况下,Continuing Operations Directory (COD)会分配记录来跟踪大的操作并保证其完成。 如果由于进程失败而导致操作没有彻底完成,则恢复进程将查询该COD记录,并要么完成 要么回滚该操作。 […]

Comment

*

沪ICP备14014813号-2

沪公网安备 31010802001379号