我们都知道,从Oracle 10.2.0.5开始,ASM磁盘会自动备份磁盘头块,备份块的位置在第2个AU的倒数第2个块上。
通常,缺省情况下,AU SIZE是1M,每个AU可以有256个block(每个block 4k),256*4k()=1M
因此,第2个AU同样存放了256个block(0~255),其备份块的位置为 au=1 blkn=254(au和block都是从0开始计数的)
具体的恢复案例,可以参考:
ASM磁盘头被fdisk损坏的修复过程
那么在exadata上,缺省的AU是4M,也就是每个AU可以存储 1024个block,即 block 0 ~ block 1023
那么第二个AU的倒数第二个block就是 au=1 blkn=1022 ( au和block都是从0开始计数的 )
我们来检测一下是不是这样:
col Attribute for a30 col Value for a30 SELECT g.name "Group name", a.name "Attribute", a.value "Value" FROM v$asm_diskgroup g, v$asm_attribute a WHERE g.group_number=a.group_number and a.name not like 'template%'; Group name Attribute Value ------------------------------ ------------------------------ ------------------------------ DATA_DM01 au_size 4194304 -------// AU SIZE DATA_DM01 disk_repair_time 3.6h DATA_DM01 idp.boundary auto DATA_DM01 idp.type dynamic DATA_DM01 sector_size 512 -------// SECTOR SIZE DATA_DM01 access_control.umask 066 DATA_DM01 compatible.rdbms 11.2.0.2.0 DATA_DM01 compatible.advm 11.2.0.0.0 DATA_DM01 cell.smart_scan_capable TRUE DATA_DM01 access_control.enabled FALSE DATA_DM01 compatible.asm 11.2.0.2.0 [grid@dm01db01 ~]$ kfed read o/192.168.10.3/DATA_DM01_CD_00_dm01cel01 ausz=4m aun=0 blkn=0|grep ausize kfdhdb.ausize: 4194304 ; 0x0bc: 0x00400000 -------// AU SIZE, 4M [grid@dm01db01 ~]$ kfed read o/192.168.10.3/DATA_DM01_CD_00_dm01cel01 ausz=4m aun=0 blkn=0|grep blksize kfdhdb.blksize: 4096 ; 0x0ba: 0x1000 -------// ASM BLOCK SIZ, 4k [grid@dm01db01 ~]$ kfed read o/192.168.10.3/DATA_DM01_CD_00_dm01cel01 ausz=4m aun=0 blkn=0|grep secsize kfdhdb.secsize: 512 ; 0x0b8: 0x0200 -------// SECTOR SIZE, 512 byte [grid@dm01db01 ~]$
注意:
这里kfed命令中,需要指定ausz=4m,否则kfed缺省按照1M来计算,那么结果就是错误的了:
[grid@dm01db01 ~]$ kfed read o/192.168.10.3/DATA_DM01_CD_00_dm01cel01 aun=1 blkn=1022 kfbh.endian: 1 ; 0x000: 0x01 kfbh.hard: 130 ; 0x001: 0x82 kfbh.type: 13 ; 0x002: KFBTYP_PST_NONE kfbh.datfmt: 1 ; 0x003: 0x01 kfbh.block.blk: 2147483902 ; 0x004: T=1 NUMB=0xfe kfbh.block.obj: 2147483648 ; 0x008: TYPE=0x8 NUMB=0x0 kfbh.check: 17662719 ; 0x00c: 0x010d82ff kfbh.fcn.base: 0 ; 0x010: 0x00000000 kfbh.fcn.wrap: 0 ; 0x014: 0x00000000 kfbh.spare1: 0 ; 0x018: 0x00000000 kfbh.spare2: 0 ; 0x01c: 0x00000000 ERROR!!!, failed to get the oracore error message [grid@dm01db01 ~]$
在kfed中指定ausz=4m,检测结果:
[grid@dm01db01 ~]$ kfed read o/192.168.10.3/DATA_DM01_CD_00_dm01cel01 ausz=4m aun=0 blkn=0 [grid@dm01db01 ~]$ kfed read o/192.168.10.3/DATA_DM01_CD_00_dm01cel01 ausz=4m aun=1 blkn=1022 kfbh.endian: 1 ; 0x000: 0x01 kfbh.endian: 1 ; 0x000: 0x01 kfbh.hard: 130 ; 0x001: 0x82 kfbh.hard: 130 ; 0x001: 0x82 kfbh.type: 1 ; 0x002: KFBTYP_DISKHEAD kfbh.type: 1 ; 0x002: KFBTYP_DISKHEAD kfbh.datfmt: 1 ; 0x003: 0x01 kfbh.datfmt: 1 ; 0x003: 0x01 kfbh.block.blk: 0 ; 0x004: T=0 NUMB=0x0 kfbh.block.blk: 1022 ; 0x004: T=0 NUMB=0x3fe ---这里不同 kfbh.block.obj: 2147483648 ; 0x008: TYPE=0x8 NUMB=0x0 kfbh.block.obj: 2147483648 ; 0x008: TYPE=0x8 NUMB=0x0 kfbh.check: 650486353 ; 0x00c: 0x26c5a251 kfbh.check: 650486191 ; 0x00c: 0x26c5a1af ---这里不同 kfbh.fcn.base: 4985684 ; 0x010: 0x004c1354 kfbh.fcn.base: 4985684 ; 0x010: 0x004c1354 kfbh.fcn.wrap: 0 ; 0x014: 0x00000000 kfbh.fcn.wrap: 0 ; 0x014: 0x00000000 kfbh.spare1: 0 ; 0x018: 0x00000000 kfbh.spare1: 0 ; 0x018: 0x00000000 kfbh.spare2: 0 ; 0x01c: 0x00000000 kfbh.spare2: 0 ; 0x01c: 0x00000000 kfdhdb.driver.provstr: ORCLDISK ; 0x000: length=8 kfdhdb.driver.provstr: ORCLDISK ; 0x000: length=8 kfdhdb.driver.reserved[0]: 0 ; 0x008: 0x00000000 kfdhdb.driver.reserved[0]: 0 ; 0x008: 0x00000000 kfdhdb.driver.reserved[1]: 0 ; 0x00c: 0x00000000 kfdhdb.driver.reserved[1]: 0 ; 0x00c: 0x00000000 kfdhdb.driver.reserved[2]: 0 ; 0x010: 0x00000000 kfdhdb.driver.reserved[2]: 0 ; 0x010: 0x00000000 kfdhdb.driver.reserved[3]: 0 ; 0x014: 0x00000000 kfdhdb.driver.reserved[3]: 0 ; 0x014: 0x00000000 kfdhdb.driver.reserved[4]: 0 ; 0x018: 0x00000000 kfdhdb.driver.reserved[4]: 0 ; 0x018: 0x00000000 kfdhdb.driver.reserved[5]: 0 ; 0x01c: 0x00000000 kfdhdb.driver.reserved[5]: 0 ; 0x01c: 0x00000000 kfdhdb.compat: 186647040 ; 0x020: 0x0b200200 kfdhdb.compat: 186647040 ; 0x020: 0x0b200200 kfdhdb.dsknum: 0 ; 0x024: 0x0000 kfdhdb.dsknum: 0 ; 0x024: 0x0000 kfdhdb.grptyp: 2 ; 0x026: KFDGTP_NORMAL kfdhdb.grptyp: 2 ; 0x026: KFDGTP_NORMAL kfdhdb.hdrsts: 3 ; 0x027: KFDHDR_MEMBER kfdhdb.hdrsts: 3 ; 0x027: KFDHDR_MEMBER kfdhdb.dskname:DATA_DM01_CD_00_DM01CEL01 ; 0x028: length=25 kfdhdb.dskname:DATA_DM01_CD_00_DM01CEL01 ; 0x028: length=25 kfdhdb.grpname: DATA_DM01 ; 0x048: length=9 kfdhdb.grpname: DATA_DM01 ; 0x048: length=9 kfdhdb.fgname: DM01CEL01 ; 0x068: length=9 kfdhdb.fgname: DM01CEL01 ; 0x068: length=9 kfdhdb.capname: ; 0x088: length=0 kfdhdb.capname: ; 0x088: length=0 kfdhdb.crestmp.hi: 32959025 ; 0x0a8: HOUR=0x11 DAYS=0x11 MNTH=0xa YEAR=0x7db kfdhdb.crestmp.hi: 32959025 ; 0x0a8: HOUR=0x11 DAYS=0x11 MNTH=0xa YEAR=0x7db kfdhdb.crestmp.lo: 1716041728 ; 0x0ac: USEC=0x0 MSEC=0x22e SECS=0x24 MINS=0x19 kfdhdb.crestmp.lo: 1716041728 ; 0x0ac: USEC=0x0 MSEC=0x22e SECS=0x24 MINS=0x19 kfdhdb.mntstmp.hi: 32989736 ; 0x0b0: HOUR=0x8 DAYS=0x11 MNTH=0x8 YEAR=0x7dd kfdhdb.mntstmp.hi: 32989736 ; 0x0b0: HOUR=0x8 DAYS=0x11 MNTH=0x8 YEAR=0x7dd kfdhdb.mntstmp.lo: 1753117696 ; 0x0b4: USEC=0x0 MSEC=0x39d SECS=0x7 MINS=0x1a kfdhdb.mntstmp.lo: 1753117696 ; 0x0b4: USEC=0x0 MSEC=0x39d SECS=0x7 MINS=0x1a kfdhdb.secsize: 512 ; 0x0b8: 0x0200 kfdhdb.secsize: 512 ; 0x0b8: 0x0200 kfdhdb.blksize: 4096 ; 0x0ba: 0x1000 kfdhdb.blksize: 4096 ; 0x0ba: 0x1000 kfdhdb.ausize: 4194304 ; 0x0bc: 0x00400000 kfdhdb.ausize: 4194304 ; 0x0bc: 0x00400000 kfdhdb.mfact: 454272 ; 0x0c0: 0x0006ee80 kfdhdb.mfact: 454272 ; 0x0c0: 0x0006ee80 kfdhdb.dsksize: 108288 ; 0x0c4: 0x0001a700 kfdhdb.dsksize: 108288 ; 0x0c4: 0x0001a700 kfdhdb.pmcnt: 2 ; 0x0c8: 0x00000002 kfdhdb.pmcnt: 2 ; 0x0c8: 0x00000002 kfdhdb.fstlocn: 1 ; 0x0cc: 0x00000001 kfdhdb.fstlocn: 1 ; 0x0cc: 0x00000001 kfdhdb.altlocn: 2 ; 0x0d0: 0x00000002 kfdhdb.altlocn: 2 ; 0x0d0: 0x00000002 kfdhdb.f1b1locn: 2 ; 0x0d4: 0x00000002 kfdhdb.f1b1locn: 2 ; 0x0d4: 0x00000002 kfdhdb.redomirrors[0]: 0 ; 0x0d8: 0x0000 kfdhdb.redomirrors[0]: 0 ; 0x0d8: 0x0000 kfdhdb.redomirrors[1]: 17 ; 0x0da: 0x0011 kfdhdb.redomirrors[1]: 17 ; 0x0da: 0x0011 kfdhdb.redomirrors[2]: 30 ; 0x0dc: 0x001e kfdhdb.redomirrors[2]: 30 ; 0x0dc: 0x001e kfdhdb.redomirrors[3]: 65535 ; 0x0de: 0xffff kfdhdb.redomirrors[3]: 65535 ; 0x0de: 0xffff kfdhdb.dbcompat: 186647040 ; 0x0e0: 0x0b200200 kfdhdb.dbcompat: 186647040 ; 0x0e0: 0x0b200200 kfdhdb.grpstmp.hi: 32959025 ; 0x0e4: HOUR=0x11 DAYS=0x11 MNTH=0xa YEAR=0x7db kfdhdb.grpstmp.hi: 32959025 ; 0x0e4: HOUR=0x11 DAYS=0x11 MNTH=0xa YEAR=0x7db kfdhdb.grpstmp.lo: 1713335296 ; 0x0e8: USEC=0x0 MSEC=0x3db SECS=0x21 MINS=0x19 kfdhdb.grpstmp.lo: 1713335296 ; 0x0e8: USEC=0x0 MSEC=0x3db SECS=0x21 MINS=0x19 kfdhdb.vfstart: 0 ; 0x0ec: 0x00000000 kfdhdb.vfstart: 0 ; 0x0ec: 0x00000000 kfdhdb.vfend: 0 ; 0x0f0: 0x00000000 kfdhdb.vfend: 0 ; 0x0f0: 0x00000000 kfdhdb.spfile: 0 ; 0x0f4: 0x00000000 kfdhdb.spfile: 0 ; 0x0f4: 0x00000000 kfdhdb.spfflg: 0 ; 0x0f8: 0x00000000 kfdhdb.spfflg: 0 ; 0x0f8: 0x00000000 kfdhdb.ub4spare[0]: 0 ; 0x0fc: 0x00000000 kfdhdb.ub4spare[0]: 0 ; 0x0fc: 0x00000000 kfdhdb.ub4spare[1]: 0 ; 0x100: 0x00000000 kfdhdb.ub4spare[1]: 0 ; 0x100: 0x00000000 kfdhdb.ub4spare[2]: 0 ; 0x104: 0x00000000 kfdhdb.ub4spare[2]: 0 ; 0x104: 0x00000000 kfdhdb.ub4spare[3]: 0 ; 0x108: 0x00000000 kfdhdb.ub4spare[3]: 0 ; 0x108: 0x00000000 kfdhdb.ub4spare[4]: 0 ; 0x10c: 0x00000000 kfdhdb.ub4spare[4]: 0 ; 0x10c: 0x00000000 kfdhdb.ub4spare[5]: 0 ; 0x110: 0x00000000 kfdhdb.ub4spare[5]: 0 ; 0x110: 0x00000000 kfdhdb.ub4spare[6]: 0 ; 0x114: 0x00000000 kfdhdb.ub4spare[6]: 0 ; 0x114: 0x00000000 kfdhdb.ub4spare[7]: 0 ; 0x118: 0x00000000 kfdhdb.ub4spare[7]: 0 ; 0x118: 0x00000000 kfdhdb.ub4spare[8]: 0 ; 0x11c: 0x00000000 kfdhdb.ub4spare[8]: 0 ; 0x11c: 0x00000000 kfdhdb.ub4spare[9]: 0 ; 0x120: 0x00000000 kfdhdb.ub4spare[9]: 0 ; 0x120: 0x00000000 kfdhdb.ub4spare[10]: 0 ; 0x124: 0x00000000 kfdhdb.ub4spare[10]: 0 ; 0x124: 0x00000000 kfdhdb.ub4spare[11]: 0 ; 0x128: 0x00000000 kfdhdb.ub4spare[11]: 0 ; 0x128: 0x00000000 kfdhdb.ub4spare[12]: 0 ; 0x12c: 0x00000000 kfdhdb.ub4spare[12]: 0 ; 0x12c: 0x00000000 kfdhdb.ub4spare[13]: 0 ; 0x130: 0x00000000 kfdhdb.ub4spare[13]: 0 ; 0x130: 0x00000000 kfdhdb.ub4spare[14]: 0 ; 0x134: 0x00000000 kfdhdb.ub4spare[14]: 0 ; 0x134: 0x00000000 kfdhdb.ub4spare[15]: 0 ; 0x138: 0x00000000 kfdhdb.ub4spare[15]: 0 ; 0x138: 0x00000000 kfdhdb.ub4spare[16]: 0 ; 0x13c: 0x00000000 kfdhdb.ub4spare[16]: 0 ; 0x13c: 0x00000000 kfdhdb.ub4spare[17]: 0 ; 0x140: 0x00000000 kfdhdb.ub4spare[17]: 0 ; 0x140: 0x00000000 kfdhdb.ub4spare[18]: 0 ; 0x144: 0x00000000 kfdhdb.ub4spare[18]: 0 ; 0x144: 0x00000000 kfdhdb.ub4spare[19]: 0 ; 0x148: 0x00000000 kfdhdb.ub4spare[19]: 0 ; 0x148: 0x00000000 kfdhdb.ub4spare[20]: 0 ; 0x14c: 0x00000000 kfdhdb.ub4spare[20]: 0 ; 0x14c: 0x00000000 kfdhdb.ub4spare[21]: 0 ; 0x150: 0x00000000 kfdhdb.ub4spare[21]: 0 ; 0x150: 0x00000000 kfdhdb.ub4spare[22]: 0 ; 0x154: 0x00000000 kfdhdb.ub4spare[22]: 0 ; 0x154: 0x00000000 kfdhdb.ub4spare[23]: 0 ; 0x158: 0x00000000 kfdhdb.ub4spare[23]: 0 ; 0x158: 0x00000000 kfdhdb.ub4spare[24]: 0 ; 0x15c: 0x00000000 kfdhdb.ub4spare[24]: 0 ; 0x15c: 0x00000000 kfdhdb.ub4spare[25]: 0 ; 0x160: 0x00000000 kfdhdb.ub4spare[25]: 0 ; 0x160: 0x00000000 kfdhdb.ub4spare[26]: 0 ; 0x164: 0x00000000 kfdhdb.ub4spare[26]: 0 ; 0x164: 0x00000000 kfdhdb.ub4spare[27]: 0 ; 0x168: 0x00000000 kfdhdb.ub4spare[27]: 0 ; 0x168: 0x00000000 kfdhdb.ub4spare[28]: 0 ; 0x16c: 0x00000000 kfdhdb.ub4spare[28]: 0 ; 0x16c: 0x00000000 kfdhdb.ub4spare[29]: 0 ; 0x170: 0x00000000 kfdhdb.ub4spare[29]: 0 ; 0x170: 0x00000000 kfdhdb.ub4spare[30]: 0 ; 0x174: 0x00000000 kfdhdb.ub4spare[30]: 0 ; 0x174: 0x00000000 kfdhdb.ub4spare[31]: 0 ; 0x178: 0x00000000 kfdhdb.ub4spare[31]: 0 ; 0x178: 0x00000000 kfdhdb.ub4spare[32]: 0 ; 0x17c: 0x00000000 kfdhdb.ub4spare[32]: 0 ; 0x17c: 0x00000000 kfdhdb.ub4spare[33]: 0 ; 0x180: 0x00000000 kfdhdb.ub4spare[33]: 0 ; 0x180: 0x00000000 kfdhdb.ub4spare[34]: 0 ; 0x184: 0x00000000 kfdhdb.ub4spare[34]: 0 ; 0x184: 0x00000000 kfdhdb.ub4spare[35]: 0 ; 0x188: 0x00000000 kfdhdb.ub4spare[35]: 0 ; 0x188: 0x00000000 kfdhdb.ub4spare[36]: 0 ; 0x18c: 0x00000000 kfdhdb.ub4spare[36]: 0 ; 0x18c: 0x00000000 kfdhdb.ub4spare[37]: 0 ; 0x190: 0x00000000 kfdhdb.ub4spare[37]: 0 ; 0x190: 0x00000000 kfdhdb.ub4spare[38]: 0 ; 0x194: 0x00000000 kfdhdb.ub4spare[38]: 0 ; 0x194: 0x00000000 kfdhdb.ub4spare[39]: 0 ; 0x198: 0x00000000 kfdhdb.ub4spare[39]: 0 ; 0x198: 0x00000000 kfdhdb.ub4spare[40]: 0 ; 0x19c: 0x00000000 kfdhdb.ub4spare[40]: 0 ; 0x19c: 0x00000000 kfdhdb.ub4spare[41]: 0 ; 0x1a0: 0x00000000 kfdhdb.ub4spare[41]: 0 ; 0x1a0: 0x00000000 kfdhdb.ub4spare[42]: 0 ; 0x1a4: 0x00000000 kfdhdb.ub4spare[42]: 0 ; 0x1a4: 0x00000000 kfdhdb.ub4spare[43]: 0 ; 0x1a8: 0x00000000 kfdhdb.ub4spare[43]: 0 ; 0x1a8: 0x00000000 kfdhdb.ub4spare[44]: 0 ; 0x1ac: 0x00000000 kfdhdb.ub4spare[44]: 0 ; 0x1ac: 0x00000000 kfdhdb.ub4spare[45]: 0 ; 0x1b0: 0x00000000 kfdhdb.ub4spare[45]: 0 ; 0x1b0: 0x00000000 kfdhdb.ub4spare[46]: 0 ; 0x1b4: 0x00000000 kfdhdb.ub4spare[46]: 0 ; 0x1b4: 0x00000000 kfdhdb.ub4spare[47]: 0 ; 0x1b8: 0x00000000 kfdhdb.ub4spare[47]: 0 ; 0x1b8: 0x00000000 kfdhdb.ub4spare[48]: 0 ; 0x1bc: 0x00000000 kfdhdb.ub4spare[48]: 0 ; 0x1bc: 0x00000000 kfdhdb.ub4spare[49]: 0 ; 0x1c0: 0x00000000 kfdhdb.ub4spare[49]: 0 ; 0x1c0: 0x00000000 kfdhdb.ub4spare[50]: 0 ; 0x1c4: 0x00000000 kfdhdb.ub4spare[50]: 0 ; 0x1c4: 0x00000000 kfdhdb.ub4spare[51]: 0 ; 0x1c8: 0x00000000 kfdhdb.ub4spare[51]: 0 ; 0x1c8: 0x00000000 kfdhdb.ub4spare[52]: 0 ; 0x1cc: 0x00000000 kfdhdb.ub4spare[52]: 0 ; 0x1cc: 0x00000000 kfdhdb.ub4spare[53]: 0 ; 0x1d0: 0x00000000 kfdhdb.ub4spare[53]: 0 ; 0x1d0: 0x00000000 kfdhdb.acdb.aba.seq: 0 ; 0x1d4: 0x00000000 kfdhdb.acdb.aba.seq: 0 ; 0x1d4: 0x00000000 kfdhdb.acdb.aba.blk: 0 ; 0x1d8: 0x00000000 kfdhdb.acdb.aba.blk: 0 ; 0x1d8: 0x00000000 kfdhdb.acdb.ents: 0 ; 0x1dc: 0x0000 kfdhdb.acdb.ents: 0 ; 0x1dc: 0x0000 kfdhdb.acdb.ub2spare: 0 ; 0x1de: 0x0000 kfdhdb.acdb.ub2spare: 0 ; 0x1de: 0x0000 [grid@dm01db01 ~]$ [grid@dm01db01 ~]$
经过检查,我们发现,这个规律在exadata上依然有效,ASM除了缺省4M的AU,其余没什么变化,O(∩_∩)O哈哈~
顺便介绍一个小方法,快速计算备份块的位置:(该方法根据ASM Support Guy修改而来)
ausize=`kfed read o/192.168.10.3/DATA_DM01_CD_00_dm01cel01 ausz=4m | grep ausize | tr -s ' ' | cut -d' ' -f2` blksize=`kfed read o/192.168.10.3/DATA_DM01_CD_00_dm01cel01 ausz=4m | grep blksize | tr -s ' ' | cut -d' ' -f2` let n=$ausize/$blksize-2 echo $n [grid@dm01db01 ~]$ ausize=`kfed read o/192.168.10.3/DATA_DM01_CD_00_dm01cel01 ausz=4m | grep ausize | tr -s ' ' | cut -d' ' -f2` [grid@dm01db01 ~]$ [grid@dm01db01 ~]$ blksize=`kfed read o/192.168.10.3/DATA_DM01_CD_00_dm01cel01 ausz=4m | grep blksize | tr -s ' ' | cut -d' ' -f2` [grid@dm01db01 ~]$ [grid@dm01db01 ~]$ let n=$ausize/$blksize-2 [grid@dm01db01 ~]$ echo $n 1022 [grid@dm01db01 ~]$
Pingback 引用通告: 在Exadata上,为什么 DUL 和 ODU不能读取数据库的数据,但是Kfed却可以? – 世间所有相遇都是久别重逢 - Lunar的oracle实验室