Oracle ASM Active Change Directory

eric0435發表於2016-12-29

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等資訊。

來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/26015009/viewspace-2131585/,如需轉載,請註明出處,否則將追究法律責任。

相關文章