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]
DBRECOVER Recovery Options
For Oracle incidents, start with the DBRECOVER for Oracle trial to verify table visibility, row previews, and export readiness on copied datafiles. For MySQL and InnoDB incidents, DBRECOVER for MySQL is free software and can inspect.ibd files, ibdata1, and database directories locally.
When the case is urgent, preserve the original files first, work from copies, and contact paid emergency support with the database version, platform, error messages, file list, and recovery objective.