7 x 24 在线支持!
How To Restore/Repair/Fix An Overwritten (KFBTYP_INVALID) Oracle ASM Disk Header (First 4K) 10.2.0.5, 11.1.0.7, 11.2 And Onwards
APPLIES TO:
Oracle Database Cloud Schema Service - Version N/A and later
Oracle Database Exadata Cloud Machine - Version N/A and later
Oracle Database Exadata Express Cloud Service - Version N/A and later
Oracle Cloud Infrastructure - Database Service - Version N/A and later
Oracle Database Backup Service - Version N/A and later
Information in this document applies to any platform.
GOAL
The present document provides an example about “how to restore/repair/fix an overwritten ASM Disk Header (first 4K) on 11.1.0.7 and Onwards”.
SOLUTION
A copy of the ASM disk header (first 4K) exists on 10.2.0.5, 11.1.0.7, 11.2 and onwards. It can be used to try to restore a valid ASM disk header (Assuming only the first 4k of the disk were affected/overwritten). In order to restore the ASM disk header (assuming the automatic ASM disk header backup is in good shape) please perform the next steps:
1) Backup the first 50MB of the affected disk (this step is mandatory):
$> dd if=<full path affected disk name> of=/tmp/<affected disk name>.dump bs=1048576 count=50
Example:
[grid@dbaasm ~]$ dd if=/dev/oracleasm/disks/ASMDISK2 of=/tmp/ASMDISK2.dump bs=1048576 count=50
50+0 records in
50+0 records out
52428800 bytes (52 MB) copied, 0.667474 seconds, 78.5 MB/s
Where: "/dev/oracleasm/disks/ASMDISK2" is the affected ASM disk member .
2) Collect the Allocation Unit Size (kfdhdb.ausize) from another healthy disk member (from the same affected diskgroup):
$> <ASM Oracle Home>/bin/kfed read <full path healthy disk name> | egrep 'ausize|dsknum|dskname|grpname|fgname'
Example:
[grid@dbaasm ~]$ kfed read /dev/oracleasm/disks/ASMDISK1 | egrep 'ausize|dsknum|dskname|grpname|fgname'
kfdhdb.dsknum: 0 ; 0x024: 0x0000
kfdhdb.dskname: ASMDISK1 ; 0x028: length=8
kfdhdb.grpname: DATA ; 0x048: length=4
kfdhdb.fgname: FG1_SAN1 ; 0x068: length=8
kfdhdb.ausize: 2097152 ; 0x0bc: 0x00200000
Note: In this example, the diskgroup was created using an AU_SIZE=2M (2097152 ) & "/dev/oracleasm/disks/ASMDISK1" is the healthy ASM disk member .
3) Then restore the ASM disk header from backup as follows:
$> <ASM Oracle Home>/bin/kfed repair <full path affected disk name> ausz=<AU size from point #2>
Example:
[grid@dbaasm ~]$ kfed repair /dev/oracleasm/disks/ASMDISK2 ausz=2097152
4) Verify that the ASM disk header in the affected disk was recreated/restored:
$> <ASM Oracle Home>/bin/kfed read <full path affected disk name> | head -40
Example:
[grid@dbaasm ~]$ kfed read /dev/oracleasm/disks/ASMDISK2 | head -40
kfbh.endian: 1 ; 0x000: 0x01
kfbh.hard: 130 ; 0x001: 0x82
kfbh.type: 1 ; 0x002: KFBTYP_DISKHEAD
kfbh.datfmt: 1 ; 0x003: 0x01
kfbh.block.blk: 0 ; 0x004: blk=0
kfbh.block.obj: 2147483650 ; 0x008: disk=2
kfbh.check: 4052202307 ; 0x00c: 0xf187b343
kfbh.fcn.base: 0 ; 0x010: 0x00000000
kfbh.fcn.wrap: 0 ; 0x014: 0x00000000
kfbh.spare1: 0 ; 0x018: 0x00000000
kfbh.spare2: 0 ; 0x01c: 0x00000000
kfdhdb.driver.provstr: ORCLDISKASMDISK2 ; 0x000: length=16
kfdhdb.driver.reserved[0]: 1145918273 ; 0x008: 0x444d5341
kfdhdb.driver.reserved[1]: 843797321 ; 0x00c: 0x324b5349
kfdhdb.driver.reserved[2]: 0 ; 0x010: 0x00000000
kfdhdb.driver.reserved[3]: 0 ; 0x014: 0x00000000
kfdhdb.driver.reserved[4]: 0 ; 0x018: 0x00000000
kfdhdb.driver.reserved[5]: 0 ; 0x01c: 0x00000000
kfdhdb.compat: 186647296 ; 0x020: 0x0b200300
kfdhdb.dsknum: 2 ; 0x024: 0x0002
kfdhdb.grptyp: 2 ; 0x026: KFDGTP_NORMAL
kfdhdb.hdrsts: 3 ; 0x027: KFDHDR_MEMBER
kfdhdb.dskname: ASMDISK2 ; 0x028: length=8
kfdhdb.grpname: DATA ; 0x048: length=4
kfdhdb.fgname: FG2_SAN2 ; 0x068: length=8
kfdhdb.capname: ; 0x088: length=0
kfdhdb.crestmp.hi: 32974423 ; 0x0a8: HOUR=0x17 DAYS=0x12 MNTH=0x9 YEAR=0x7dc
kfdhdb.crestmp.lo: 1180930048 ; 0x0ac: USEC=0x0 MSEC=0xe4 SECS=0x26 MINS=0x11
kfdhdb.mntstmp.hi: 33003184 ; 0x0b0: HOUR=0x10 DAYS=0x15 MNTH=0x5 YEAR=0x7de
kfdhdb.mntstmp.lo: 1230240768 ; 0x0b4: USEC=0x0 MSEC=0xff SECS=0x15 MINS=0x12
kfdhdb.secsize: 512 ; 0x0b8: 0x0200
kfdhdb.blksize: 4096 ; 0x0ba: 0x1000
kfdhdb.ausize: 2097152 ; 0x0bc: 0x00200000
kfdhdb.mfact: 228480 ; 0x0c0: 0x00037c80
kfdhdb.dsksize: 9769 ; 0x0c4: 0x00002629
kfdhdb.pmcnt: 2 ; 0x0c8: 0x00000002
kfdhdb.fstlocn: 1 ; 0x0cc: 0x00000001
kfdhdb.altlocn: 2 ; 0x0d0: 0x00000002
kfdhdb.f1b1locn: 0 ; 0x0d4: 0x00000000
kfdhdb.redomirrors[0]: 0 ; 0x0d8: 0x0000
.
.
.
.
5) Finally, mount the diskgroup:
SQL> alter diskgroup <diskgroup name> mount ;
Example:
SQL> alter diskgroup DATA mount;
Diskgroup altered.
Notes
Note 1: The solution provided in this document will work if the following conditions are true:
a) Only the first 4K of the affected disk were overwritten/wiped out/overlapped.
b) ASM disk header backup is in good shape.
Note 2: If this solution does not solve your problem, then do not attempt additional steps/actions on the affected diskgroup, therefore please engage Oracle Support through a new Service Request to determinate the “Root Cause” & possible solutions.
Note 3: An ASM disk with a corrupted “Disk Header” will report the following output:
[grid@dbaasm ~]$ kfed read /dev/oracleasm/disks/ASMDISK2
kfbh.endian: 0 ; 0x000: 0x00
kfbh.hard: 0 ; 0x001: 0x00
kfbh.type: 0 ; 0x002: KFBTYP_INVALID
kfbh.datfmt: 0 ; 0x003: 0x00
kfbh.block.blk: 0 ; 0x004: blk=0
kfbh.block.obj: 0 ; 0x008: file=0
kfbh.check: 0 ; 0x00c: 0x00000000
kfbh.fcn.base: 0 ; 0x010: 0x00000000
kfbh.fcn.wrap: 0 ; 0x014: 0x00000000
kfbh.spare1: 0 ; 0x018: 0x00000000
kfbh.spare2: 0 ; 0x01c: 0x00000000
000000000 00000000 00000000 00000000 00000000 [................]
Repeat 255 times
KFED-00322: Invalid content encountered during block traversal: [kfbtTraverseBlock][Invalid OSM block type][][0]