Oracle 10g rac+asm 磁碟頭備份與恢復實驗

paulyibinyi發表於2011-06-28

作者:
paulyibinyi

一、實驗目的:

我們經常由於誤操作,比如對disk做了pvid=yes的操作,導致磁碟組的磁碟頭資訊丟失,從而不能正常

mount,導致資料庫起不來,從而影響業務。以下實驗就是為了解決上面情況,而提供的解決方法。

二、實驗環境:

作業系統:AIX 6.1
資料庫版本:oracle 10.2.0.4 + rac + asm
資料庫名:test
例項名:test1、test2
ip地址:(p520)192.168.3.225/(p650)192.168.3.223


三、實驗步驟:

1、生成kfed工具和讀取磁碟頭資訊:
1)編譯kfed,生成kfed工具:
cd $ORACLE_HOME/rdbms/lib
cp ins_rdbms.mk ins_rdbms.mk.bak
[make -f ins_rdbms.mk ikfed]
Linking KFED utility (kfed)
rm -f /oracle/app/oracle/product/10.2.0/clusterdb/rdbms/lib/kfed
ld -b64 -o /oracle/app/oracle/product/10.2.0/clusterdb/rdbms/lib/kfed -

L/oracle/app/oracle/product/10.2.0/clusterdb/rdbms/lib/ -

L/oracle/app/oracle/product/10.2.0/clusterdb/lib/ -bnoerrmsg

/oracle/app/oracle/product/10.2.0/clusterdb/lib/s0main.o

/oracle/app/oracle/product/10.2.0/clusterdb/rdbms/lib/sskfeded.o

/oracle/app/oracle/product/10.2.0/clusterdb/rdbms/lib/skfedpt.o -bI:/usr/lib/aio.exp

/oracle/app/oracle/product/10.2.0/clusterdb/rdbms/lib/defopt.o -ldbtools10 `cat

/oracle/app/oracle/product/10.2.0/clusterdb/lib/ldflags` -lnsslb10 -lncrypt10 -lnsgr10 -

lnzjs10 -ln10 -lnnz10 -lnl10 -lnro10 `cat

/oracle/app/oracle/product/10.2.0/clusterdb/lib/ldflags` -lnsslb10 -lncrypt10 -lnsgr10 -

lnzjs10 -ln10 -lnnz10 -lnl10 -lclient10 -lnnetd10 -lvsn10 -lcommon10 -lgeneric10 -lmm -

lsnls10 -lnls10 -lcore10 -lsnls10 -lnls10 -lcore10 -lsnls10 -lnls10 -lxml10 -lcore10 -

lunls10 -lsnls10 -lnls10 -lcore10 -lnls10 `cat

/oracle/app/oracle/product/10.2.0/clusterdb/lib/ldflags` -lnsslb10 -lncrypt10 -lnsgr10 -

lnzjs10 -ln10 -lnnz10 -lnl10 -lnro10 `cat

/oracle/app/oracle/product/10.2.0/clusterdb/lib/ldflags` -lnsslb10 -lncrypt10 -lnsgr10 -

lnzjs10 -ln10 -lnnz10 -lnl10 -lclient10 -lnnetd10 -lvsn10 -lcommon10 -lgeneric10 -lpls10

-lsnls10 -lnls10 -lcore10 -lsnls10 -lnls10 -lcore10 -lsnls10 -lnls10 -lxml10 -lcore10 -

lunls10 -lsnls10 -lnls10 -lcore10 -lnls10 -lclient10 -lnnetd10 -lvsn10 -lcommon10 -

lgeneric10 -lsnls10 -lnls10 -lcore10 -lsnls10 -lnls10 -lcore10 -lsnls10 -lnls10 -lxml10

-lcore10 -lunls10 -lsnls10 -lnls10 -lcore10 -lnls10 -lld -lm `cat

/oracle/app/oracle/product/10.2.0/clusterdb/lib/sysliblist` -lm `if [ "`/usr/bin/uname -

v`" = "4" ];
then echo "-bI:/oracle/app/oracle/product/10.2.0/clusterdb/lib/pw-syscall.exp"; fi;`

-lsql10 /oracle/app/oracle/product/10.2.0/clusterdb/lib/nautab.o

/oracle/app/oracle/product/10.2.0/clusterdb/lib/naeet.o

/oracle/app/oracle/product/10.2.0/clusterdb/lib/naect.o

/oracle/app/oracle/product/10.2.0/clusterdb/lib/naedhs.o
mv -f /oracle/app/oracle/product/10.2.0/clusterdb/bin/kfed

/oracle/app/oracle/product/10.2.0/clusterdb/bin/kfedO
mv /oracle/app/oracle/product/10.2.0/clusterdb/rdbms/lib/kfed

/oracle/app/oracle/product/10.2.0/clusterdb/bin/kfed
chmod 751 /oracle/app/oracle/product/10.2.0/clusterdb/bin/kfed

2)檢視磁碟組下的磁碟資訊:
[oracle@p520:/]$sqlplus / as sysdba

SQL*Plus: Release 10.2.0.1.0 - Production on Thu May 27 10:19:10 2010

Copyright (c) 1982, 2005, Oracle. All rights reserved.

Connected to:
Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - 64bit Production
With the Partitioning, Real Application Clusters, OLAP and Data Mining options

SQL> col name format a30
SQL> col path format a30
SQL> select name,path from v$asm_disk;

NAME PATH
------------------------------ -----------------------
DATA_0000 /dev/rhdisk5
DATA_0001 /dev/rhdisk3

SQL> select name ,state from v$asm_diskgroup;

NAME STATE
------------------------------ ----------------------
DATA MOUNTED

SQL> /

NAME PATH HEADER_STATUS
------------------------------ ------------------------------ ---------------
DATA_0000 /dev/rhdisk5 MEMBER
DATA_0001 /dev/rhdisk3 MEMBER

3)用kfed工具讀取磁碟頭資訊:
比如讀取磁碟組data下hdisk5磁碟頭資訊
[oracle@p520:/]$kfed read /dev/rhdisk5
kfbh.endian: 0 ; 0x000: 0x00
kfbh.hard: 130 ; 0x001: 0x82
kfbh.type: 1 ; 0x002: KFBTYP_DISKHEAD
kfbh.datfmt: 1 ; 0x003: 0x01
kfbh.block.blk: 0 ; 0x004: T=0 NUMB=0x0
kfbh.block.obj: 2147483648 ; 0x008: TYPE=0x8 NUMB=0x0
kfbh.check: 257017006 ; 0x00c: 0x0f51c4ae
kfbh.fcn.base: 578 ; 0x010: 0x00000242
kfbh.fcn.wrap: 0 ; 0x014: 0x00000000
kfbh.spare1: 0 ; 0x018: 0x00000000
kfbh.spare2: 0 ; 0x01c: 0x00000000
kfdhdb.driver.provstr: ORCLDISK ; 0x000: length=8
kfdhdb.driver.reserved[0]: 0 ; 0x008: 0x00000000
kfdhdb.driver.reserved[1]: 0 ; 0x00c: 0x00000000
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: 168820736 ; 0x020: 0x0a100000
kfdhdb.dsknum: 0 ; 0x024: 0x0000
kfdhdb.grptyp: 1 ; 0x026: KFDGTP_EXTERNAL
kfdhdb.hdrsts: 3 ; 0x027: KFDHDR_MEMBER
kfdhdb.dskname: DATA_0000 ; 0x028: length=9
kfdhdb.grpname: DATA ; 0x048: length=4
kfdhdb.fgname: DATA_0000 ; 0x068: length=9
kfdhdb.capname: ; 0x088: length=0
kfdhdb.crestmp.hi: 32937833 ; 0x0a8: HOUR=0x9 DAYS=0x1b MNTH=0x5 YEAR=0x7da
kfdhdb.crestmp.lo: 1704514560 ; 0x0ac: USEC=0x0 MSEC=0x235 SECS=0x19 MINS=0x19
kfdhdb.mntstmp.hi: 32937834 ; 0x0b0: HOUR=0xa DAYS=0x1b MNTH=0x5 YEAR=0x7da
kfdhdb.mntstmp.lo: 679906304 ; 0x0b4: USEC=0x0 MSEC=0x1a3 SECS=0x8 MINS=0xa
kfdhdb.secsize: 512 ; 0x0b8: 0x0200
kfdhdb.blksize: 4096 ; 0x0ba: 0x1000
kfdhdb.ausize: 1048576 ; 0x0bc: 0x00100000
kfdhdb.mfact: 113792 ; 0x0c0: 0x0001bc80
kfdhdb.dsksize: 51200 ; 0x0c4: 0x0000c800
kfdhdb.pmcnt: 2 ; 0x0c8: 0x00000002
kfdhdb.fstlocn: 1 ; 0x0cc: 0x00000001
kfdhdb.altlocn: 2 ; 0x0d0: 0x00000002
kfdhdb.f1b1locn: 2 ; 0x0d4: 0x00000002
kfdhdb.redomirrors[0]: 0 ; 0x0d8: 0x0000
kfdhdb.redomirrors[1]: 65535 ; 0x0da: 0xffff
kfdhdb.redomirrors[2]: 65535 ; 0x0dc: 0xffff
kfdhdb.redomirrors[3]: 65535 ; 0x0de: 0xffff
kfdhdb.dbcompat: 168820736 ; 0x0e0: 0x0a100000
kfdhdb.grpstmp.hi: 32937833 ; 0x0e4: HOUR=0x9 DAYS=0x1b MNTH=0x5 YEAR=0x7da
kfdhdb.grpstmp.lo: 1704339456 ; 0x0e8: USEC=0x0 MSEC=0x18a SECS=0x19 MINS=0x19
kfdhdb.ub4spare[0]: 0 ; 0x0ec: 0x00000000
kfdhdb.ub4spare[1]: 0 ; 0x0f0: 0x00000000
kfdhdb.ub4spare[2]: 0 ; 0x0f4: 0x00000000
kfdhdb.ub4spare[3]: 0 ; 0x0f8: 0x00000000
kfdhdb.ub4spare[4]: 0 ; 0x0fc: 0x00000000
kfdhdb.ub4spare[5]: 0 ; 0x100: 0x00000000
kfdhdb.ub4spare[6]: 0 ; 0x104: 0x00000000
kfdhdb.ub4spare[7]: 0 ; 0x108: 0x00000000
kfdhdb.ub4spare[8]: 0 ; 0x10c: 0x00000000
kfdhdb.ub4spare[9]: 0 ; 0x110: 0x00000000
kfdhdb.ub4spare[10]: 0 ; 0x114: 0x00000000
kfdhdb.ub4spare[11]: 0 ; 0x118: 0x00000000
kfdhdb.ub4spare[12]: 0 ; 0x11c: 0x00000000
kfdhdb.ub4spare[13]: 0 ; 0x120: 0x00000000
kfdhdb.ub4spare[14]: 0 ; 0x124: 0x00000000
kfdhdb.ub4spare[15]: 0 ; 0x128: 0x00000000
kfdhdb.ub4spare[16]: 0 ; 0x12c: 0x00000000
kfdhdb.ub4spare[17]: 0 ; 0x130: 0x00000000
kfdhdb.ub4spare[18]: 0 ; 0x134: 0x00000000
kfdhdb.ub4spare[19]: 0 ; 0x138: 0x00000000
kfdhdb.ub4spare[20]: 0 ; 0x13c: 0x00000000
kfdhdb.ub4spare[21]: 0 ; 0x140: 0x00000000
kfdhdb.ub4spare[22]: 0 ; 0x144: 0x00000000
kfdhdb.ub4spare[23]: 0 ; 0x148: 0x00000000
kfdhdb.ub4spare[24]: 0 ; 0x14c: 0x00000000
kfdhdb.ub4spare[25]: 0 ; 0x150: 0x00000000
kfdhdb.ub4spare[26]: 0 ; 0x154: 0x00000000
kfdhdb.ub4spare[27]: 0 ; 0x158: 0x00000000
kfdhdb.ub4spare[28]: 0 ; 0x15c: 0x00000000
kfdhdb.ub4spare[29]: 0 ; 0x160: 0x00000000
kfdhdb.ub4spare[30]: 0 ; 0x164: 0x00000000
kfdhdb.ub4spare[31]: 0 ; 0x168: 0x00000000
kfdhdb.ub4spare[32]: 0 ; 0x16c: 0x00000000
kfdhdb.ub4spare[33]: 0 ; 0x170: 0x00000000
kfdhdb.ub4spare[34]: 0 ; 0x174: 0x00000000
kfdhdb.ub4spare[35]: 0 ; 0x178: 0x00000000
kfdhdb.ub4spare[36]: 0 ; 0x17c: 0x00000000
kfdhdb.ub4spare[37]: 0 ; 0x180: 0x00000000
kfdhdb.ub4spare[38]: 0 ; 0x184: 0x00000000
kfdhdb.ub4spare[39]: 0 ; 0x188: 0x00000000
kfdhdb.ub4spare[40]: 0 ; 0x18c: 0x00000000
kfdhdb.ub4spare[41]: 0 ; 0x190: 0x00000000
kfdhdb.ub4spare[42]: 0 ; 0x194: 0x00000000
kfdhdb.ub4spare[43]: 0 ; 0x198: 0x00000000
kfdhdb.ub4spare[44]: 0 ; 0x19c: 0x00000000
kfdhdb.ub4spare[45]: 0 ; 0x1a0: 0x00000000
kfdhdb.ub4spare[46]: 0 ; 0x1a4: 0x00000000
kfdhdb.ub4spare[47]: 0 ; 0x1a8: 0x00000000
kfdhdb.ub4spare[48]: 0 ; 0x1ac: 0x00000000
kfdhdb.ub4spare[49]: 0 ; 0x1b0: 0x00000000
kfdhdb.ub4spare[50]: 0 ; 0x1b4: 0x00000000
kfdhdb.ub4spare[51]: 0 ; 0x1b8: 0x00000000
kfdhdb.ub4spare[52]: 0 ; 0x1bc: 0x00000000
kfdhdb.ub4spare[53]: 0 ; 0x1c0: 0x00000000
kfdhdb.ub4spare[54]: 0 ; 0x1c4: 0x00000000
kfdhdb.ub4spare[55]: 0 ; 0x1c8: 0x00000000
kfdhdb.ub4spare[56]: 0 ; 0x1cc: 0x00000000
kfdhdb.ub4spare[57]: 0 ; 0x1d0: 0x00000000
kfdhdb.acdb.aba.seq: 0 ; 0x1d4: 0x00000000
kfdhdb.acdb.aba.blk: 0 ; 0x1d8: 0x00000000
kfdhdb.acdb.ents: 0 ; 0x1dc: 0x0000
kfdhdb.acdb.ub2spare: 0 ; 0x1de: 0x0000
從上面讀出的內容,我們可以獲取以下資訊:
dsknum:磁碟號
grptyp:磁碟所屬型別EXTERNAL REDUNDANCY
磁碟所屬型別主要有:
NORMAL REDUNDANCY - Two-way mirroring, requiring two failure groups.
HIGH REDUNDANCY - Three-way mirroring, requiring three failure groups.
EXTERNAL REDUNDANCY - No mirroring for disks that are already protected using hardware

mirroring or RAID.
ddrsts:磁碟頭狀態
dskname:在asm中磁碟名
grpname:磁碟組名
fgname:failure group name
crestmp.hi:asm磁碟組建立時間
mntstmp.hi:asm磁碟組mount時間
blksize:磁碟頭塊大小 4096
ausize:條帶化大小 預設1M
dsksize:磁碟大小
f1b1locn:File Directory blk 1 AU num
Beginging for file directory


2、磁碟頭有使用dd備份下的恢復:

1)使用dd備份:
因為磁碟頭資訊只佔用最前面4k內容,所以我們可以用dd只備份前面4k內容:
[oracle@p520:/]$dd if=/dev/rhdisk5 f=/oracle/hdisk5header bs=4096 count=1
1+0 records in.
1+0 records out.
[oracle@p520:/]$dd if=/dev/rhdisk3 f=/oracle/hdisk3header bs=4096 count=1
1+0 records in.
1+0 records out.

2)使用dd恢復:
dd破壞hdisk5 磁碟頭資訊
[oracle@p520:/oracle]$dd if=/dev/zero f=/dev/rhdisk5 bs=4096 count=1
1+0 records in.
1+0 records out.
損壞磁碟頭資訊如下:
[oracle@p520:/oracle]$kfed read /dev/rhdisk5
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: T=0 NUMB=0x0
kfbh.block.obj: 0 ; 0x008: TYPE=0x0 NUMB=0x0
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
可以看到,磁碟頭相關資訊丟失。

asm例項啟動時報以下錯誤資訊:
SQL> startup
ASM instance started
Total System Global Area 130023424 bytes
Fixed Size 2019136 bytes
Variable Size 102838464 bytes
ASM Cache 25165824 bytes
ORA-15032: not all alterations performed
ORA-15063: ASM discovered an insufficient number of disks for diskgroup "DATA"
SQL> select name,state from v$asm_diskgroup;

NAME STATE
----------- -------------
DATA DISMOUNTED
SQL> alter diskgroup data mount;
alter diskgroup data mount
*
ERROR at line 1:
ORA-15032: not all alterations performed
ORA-15063: ASM discovered an insufficient number of disks for diskgroup "DATA"

Asm例項日誌記錄以下內容:
Thu May 27 11:00:03 2010
ERROR: no PST quorum in group 1: required 1, found 0
Thu May 27 11:00:03 2010
NOTE: cache dismounting group 1/0x1E9B7FD5 (DATA)
NOTE: dbwr not being msg'd to dismount
ERROR: diskgroup DATA was not mounted

使用dd進行恢復:
[oracle@p520:/oracle]$dd if=/oracle/hdisk5header f=/dev/rhdisk5 bs=4096 count=1
1+0 records in.
1+0 records out.

這時可以正常讀取磁碟頭資訊:
[oracle@p520:/oracle]$kfed read /dev/rhdisk5
kfbh.endian: 0 ; 0x000: 0x00
kfbh.hard: 130 ; 0x001: 0x82
kfbh.type: 1 ; 0x002: KFBTYP_DISKHEAD
kfbh.datfmt: 1 ; 0x003: 0x01
kfbh.block.blk: 0 ; 0x004: T=0 NUMB=0x0
kfbh.block.obj: 2147483648 ; 0x008: TYPE=0x8 NUMB=0x0
kfbh.check: 257017006 ; 0x00c: 0x0f51c4ae
kfbh.fcn.base: 578 ; 0x010: 0x00000242
kfbh.fcn.wrap: 0 ; 0x014: 0x00000000
kfbh.spare1: 0 ; 0x018: 0x00000000
kfbh.spare2: 0 ; 0x01c: 0x00000000
kfdhdb.driver.provstr: ORCLDISK ; 0x000: length=8
kfdhdb.driver.reserved[0]: 0 ; 0x008: 0x00000000
kfdhdb.driver.reserved[1]: 0 ; 0x00c: 0x00000000
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: 168820736 ; 0x020: 0x0a100000
kfdhdb.dsknum: 0 ; 0x024: 0x0000
kfdhdb.grptyp: 1 ; 0x026: KFDGTP_EXTERNAL
kfdhdb.hdrsts: 3 ; 0x027: KFDHDR_MEMBER
kfdhdb.dskname: DATA_0000 ; 0x028: length=9
kfdhdb.grpname: DATA ; 0x048: length=4
kfdhdb.fgname: DATA_0000 ; 0x068: length=9
kfdhdb.capname: ; 0x088: length=0
kfdhdb.crestmp.hi: 32937833 ; 0x0a8: HOUR=0x9 DAYS=0x1b MNTH=0x5 YEAR=0x7da
kfdhdb.crestmp.lo: 1704514560 ; 0x0ac: USEC=0x0 MSEC=0x235 SECS=0x19 MINS=0x19
kfdhdb.mntstmp.hi: 32937834 ; 0x0b0: HOUR=0xa DAYS=0x1b MNTH=0x5 YEAR=0x7da
kfdhdb.mntstmp.lo: 679906304 ; 0x0b4: USEC=0x0 MSEC=0x1a3 SECS=0x8 MINS=0xa
kfdhdb.secsize: 512 ; 0x0b8: 0x0200
kfdhdb.blksize: 4096 ; 0x0ba: 0x1000
kfdhdb.ausize: 1048576 ; 0x0bc: 0x00100000
kfdhdb.mfact: 113792 ; 0x0c0: 0x0001bc80
kfdhdb.dsksize: 51200 ; 0x0c4: 0x0000c800
kfdhdb.pmcnt: 2 ; 0x0c8: 0x00000002
kfdhdb.fstlocn: 1 ; 0x0cc: 0x00000001
kfdhdb.altlocn: 2 ; 0x0d0: 0x00000002
kfdhdb.f1b1locn: 2 ; 0x0d4: 0x00000002
kfdhdb.redomirrors[0]: 0 ; 0x0d8: 0x0000
kfdhdb.redomirrors[1]: 65535 ; 0x0da: 0xffff
kfdhdb.redomirrors[2]: 65535 ; 0x0dc: 0xffff
kfdhdb.redomirrors[3]: 65535 ; 0x0de: 0xffff
kfdhdb.dbcompat: 168820736 ; 0x0e0: 0x0a100000
kfdhdb.grpstmp.hi: 32937833 ; 0x0e4: HOUR=0x9 DAYS=0x1b MNTH=0x5 YEAR=0x7da
kfdhdb.grpstmp.lo: 1704339456 ; 0x0e8: USEC=0x0 MSEC=0x18a SECS=0x19 MINS=0x19
kfdhdb.ub4spare[0]: 0 ; 0x0ec: 0x00000000
kfdhdb.ub4spare[1]: 0 ; 0x0f0: 0x00000000
kfdhdb.ub4spare[2]: 0 ; 0x0f4: 0x00000000
kfdhdb.ub4spare[3]: 0 ; 0x0f8: 0x00000000
kfdhdb.ub4spare[4]: 0 ; 0x0fc: 0x00000000
kfdhdb.ub4spare[5]: 0 ; 0x100: 0x00000000
kfdhdb.ub4spare[6]: 0 ; 0x104: 0x00000000
kfdhdb.ub4spare[7]: 0 ; 0x108: 0x00000000
kfdhdb.ub4spare[8]: 0 ; 0x10c: 0x00000000
kfdhdb.ub4spare[9]: 0 ; 0x110: 0x00000000
kfdhdb.ub4spare[10]: 0 ; 0x114: 0x00000000
kfdhdb.ub4spare[11]: 0 ; 0x118: 0x00000000
kfdhdb.ub4spare[12]: 0 ; 0x11c: 0x00000000
kfdhdb.ub4spare[13]: 0 ; 0x120: 0x00000000
kfdhdb.ub4spare[14]: 0 ; 0x124: 0x00000000
kfdhdb.ub4spare[15]: 0 ; 0x128: 0x00000000
kfdhdb.ub4spare[16]: 0 ; 0x12c: 0x00000000
kfdhdb.ub4spare[17]: 0 ; 0x130: 0x00000000
kfdhdb.ub4spare[18]: 0 ; 0x134: 0x00000000
kfdhdb.ub4spare[19]: 0 ; 0x138: 0x00000000
kfdhdb.ub4spare[20]: 0 ; 0x13c: 0x00000000
kfdhdb.ub4spare[21]: 0 ; 0x140: 0x00000000
kfdhdb.ub4spare[22]: 0 ; 0x144: 0x00000000
kfdhdb.ub4spare[23]: 0 ; 0x148: 0x00000000
kfdhdb.ub4spare[24]: 0 ; 0x14c: 0x00000000
kfdhdb.ub4spare[25]: 0 ; 0x150: 0x00000000
kfdhdb.ub4spare[26]: 0 ; 0x154: 0x00000000
kfdhdb.ub4spare[27]: 0 ; 0x158: 0x00000000
kfdhdb.ub4spare[28]: 0 ; 0x15c: 0x00000000
kfdhdb.ub4spare[29]: 0 ; 0x160: 0x00000000
kfdhdb.ub4spare[30]: 0 ; 0x164: 0x00000000
kfdhdb.ub4spare[31]: 0 ; 0x168: 0x00000000
kfdhdb.ub4spare[32]: 0 ; 0x16c: 0x00000000
kfdhdb.ub4spare[33]: 0 ; 0x170: 0x00000000
kfdhdb.ub4spare[34]: 0 ; 0x174: 0x00000000
kfdhdb.ub4spare[35]: 0 ; 0x178: 0x00000000
kfdhdb.ub4spare[36]: 0 ; 0x17c: 0x00000000
kfdhdb.ub4spare[37]: 0 ; 0x180: 0x00000000
kfdhdb.ub4spare[38]: 0 ; 0x184: 0x00000000
kfdhdb.ub4spare[39]: 0 ; 0x188: 0x00000000
kfdhdb.ub4spare[40]: 0 ; 0x18c: 0x00000000
kfdhdb.ub4spare[41]: 0 ; 0x190: 0x00000000
kfdhdb.ub4spare[42]: 0 ; 0x194: 0x00000000
kfdhdb.ub4spare[43]: 0 ; 0x198: 0x00000000
kfdhdb.ub4spare[44]: 0 ; 0x19c: 0x00000000
kfdhdb.ub4spare[45]: 0 ; 0x1a0: 0x00000000
kfdhdb.ub4spare[46]: 0 ; 0x1a4: 0x00000000
kfdhdb.ub4spare[47]: 0 ; 0x1a8: 0x00000000
kfdhdb.ub4spare[48]: 0 ; 0x1ac: 0x00000000
kfdhdb.ub4spare[49]: 0 ; 0x1b0: 0x00000000
kfdhdb.ub4spare[50]: 0 ; 0x1b4: 0x00000000
kfdhdb.ub4spare[51]: 0 ; 0x1b8: 0x00000000
kfdhdb.ub4spare[52]: 0 ; 0x1bc: 0x00000000
kfdhdb.ub4spare[53]: 0 ; 0x1c0: 0x00000000
kfdhdb.ub4spare[54]: 0 ; 0x1c4: 0x00000000
kfdhdb.ub4spare[55]: 0 ; 0x1c8: 0x00000000
kfdhdb.ub4spare[56]: 0 ; 0x1cc: 0x00000000
kfdhdb.ub4spare[57]: 0 ; 0x1d0: 0x00000000
kfdhdb.acdb.aba.seq: 0 ; 0x1d4: 0x00000000
kfdhdb.acdb.aba.blk: 0 ; 0x1d8: 0x00000000
kfdhdb.acdb.ents: 0 ; 0x1dc: 0x0000
kfdhdb.acdb.ub2spare: 0 ; 0x1de: 0x0000

磁碟組可以正常mount:
SQL> alter diskgroup data mount;
Diskgroup altered.

SQL> select name,state from v$asm_diskgroup;

NAME STATE
------ ----------
DATA MOUNTED


3、磁碟頭有使用kfed備份下的恢復:

1)使用kfed備份磁碟頭資訊:
[oracle@p520:/oracle]$kfed read /dev/rhdisk5 > /oracle/hdisk5backup.txt
[oracle@p520:/oracle]$kfed read /dev/rhdisk3 > /oracle/hdisk3backup.txt
-rw-r--r-- 1 oracle oinstall 6607 May 27 11:11 hdisk5backup.txt
-rw-r--r-- 1 oracle oinstall 6607 May 27 11:11 hdisk3backup.txt

2)使用kfed恢復:
使用dd破壞file directory即hdisk5磁碟頭資訊
[oracle@p520:/oracle]$dd if=/dev/zero f=/dev/rhdisk5 bs=4096 count=1
1+0 records in.
1+0 records out.
SQL> alter diskgroup data mount;
alter diskgroup data mount
*
ERROR at line 1:
ORA-15032: not all alterations performed
ORA-15063: ASM discovered an insufficient number of disks for diskgroup "DATA";

因為hdisk5是file directory,所以報上面錯誤資訊,如果是hdisk3磁碟頭損壞,則報:
ERROR at line 1:
ORA-15032: not all alterations performed
ORA-15040: diskgroup is incomplete
ORA-15042: ASM disk "1" is missing

恢復用kfed merge命令
[oracle@p520:/oracle]$kfed merge /dev/rhdisk5 text=/oracle/hdisk5backup.txt

SQL> alter diskgroup data mount;
Diskgroup alter

使用dd破壞hdisk3磁碟頭資訊
[oracle@p520:/oracle]$dd if=/dev/zero f=/dev/rhdisk3 bs=4096 count=1
1+0 records in.
1+0 records out.
SQL> alter diskgroup data mount;
alter diskgroup data mount
*
SQL> alter diskgroup data mount;
alter diskgroup data mount
*
ERROR at line 1:
ORA-15032: not all alterations performed
ORA-15040: diskgroup is incomplete
ORA-15042: ASM disk "1" is missing

恢復用kfed merge命令
[oracle@p520:/oracle]$kfed merge /dev/rhdisk3 text=/oracle/hdisk3backup.txt

SQL> alter diskgroup data mount;
Diskgroup altere


4、磁碟頭沒有進行備份,但不是file directory磁碟頭的資訊丟失的恢復:

1)首先確定磁碟是否為file directory盤;如果我們確定hdisk5 是file directory盤。

2)破壞非file directory盤hdisk3頭資訊:
破壞hdisk3磁碟頭:
[oracle@p520:/oracle]$dd if=/dev/zero f=/dev/rhdisk3 bs=4096 count=1
1+0 records in.
1+0 records out.
[oracle@p520:/oracle]$kfed read /dev/rhdisk3
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: T=0 NUMB=0x0
kfbh.block.obj: 0 ; 0x008: TYPE=0x0 NUMB=0x0
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

檢查diskgroup
SQL> alter diskgroup data mount;
alter diskgroup data mount
*
ERROR at line 1:
ORA-15032: not all alterations performed
ORA-15040: diskgroup is incomplete
ORA-15042: ASM disk "1" is missing

3)根據file directory hdisk5查詢disk directory資訊;可以用select name,path from v$asm_disk查

出。

4)根據disk directory hdisk3找出磁碟資訊;從裡面可以得到hdisk3磁碟資訊
kfddde[1].dsknum: 1 ; 0x1f4: 0x0001
kfddde[1].dskname: DATA_0001 ; 0x1f8: length=9
kfddde[1].fgname: DATA_0001 ; 0x218: length=9
kfddde[1].crestmp.hi: 32937837 ; 0x238: HOUR=0x9 DAYS=0x1b MNTH=0x5 YEAR=0x7da
kfddde[1].crestmp.lo: 1899649024 ; 0x23c: USEC=0x0 MSEC=0x296 SECS=0x13 MINS=0x1c
kfddde[1].size: 1024 ; 0x24c: 0x00000400

5)根據以上資訊生成恢復hdisk3磁碟標頭檔案:
這裡我們可以用hdisk5來修改:
kfed read /dev/rhdisk5 > /oracle/hdisk5.txt
kfbh.block.obj: 2147483648 ; 0x008: TYPE=0x8 NUMB=0x0
kfdhdb.dsknum: 0; 0x024: 0x0000
kfdhdb.dskname: DATA_0000 ; 0x028: length=9
kfdhdb.fgname: DATA_0000 ; 0x068: length=9
kfdhdb.crestmp.hi: 32937833 ; 0x0a8: HOUR=0x9 DAYS=0x1b MNTH=0x5 YEAR=0x7da
kfdhdb.crestmp.lo: 1704514560 ; 0x0ac: USEC=0x0 MSEC=0x235 SECS=0x19 MINS=0x19
kfdhdb.dsksize: 51200 ; 0x0c4: 0x0000c800

將上面值修改為以下值:
kfbh.block.obj: 2147483649 ; 0x008: TYPE=0x8 NUMB=0x0
kfdhdb.dsknum: 1 ; 0x024: 0x0000
kfdhdb.dskname: DATA_0001 ; 0x028: length=9
kfdhdb.fgname: DATA_0001 ; 0x068: length=9
kfdhdb.crestmp.hi: 32937837 ; 0x0a8: HOUR=0x9 DAYS=0x1b MNTH=0x5 YEAR=0x7da
kfdhdb.crestmp.lo: 1899649024; 0x0ac: USEC=0x0 MSEC=0x235 SECS=0x19 MINS=0x19
kfdhdb.dsksize: 1024 ; 0x0c4: 0x0000c800
這個最好用ultraedit編輯,生成hdisk3.txt;

kfed merge進去標頭檔案資訊到hdisk3:
[oracle@p520:/oracle]$kfed merge /dev/rhdisk3 text=/oracle/hdisk3.txt

驗證是否修復成功:
SQL> alter diskgroup data mount;
Diskgroup altered.
並且能夠正確讀取磁碟頭資訊:
[oracle@p520:/oracle]$kfed read /dev/rhdisk3
kfbh.endian: 0 ; 0x000: 0x00
kfbh.hard: 130 ; 0x001: 0x82
kfbh.type: 1 ; 0x002: KFBTYP_DISKHEAD
kfbh.datfmt: 1 ; 0x003: 0x01
kfbh.block.blk: 0 ; 0x004: T=0 NUMB=0x0
kfbh.block.obj: 2147483649 ; 0x008: TYPE=0x8 NUMB=0x1
kfbh.check: 3781987247 ; 0x00c: 0xe16c8baf
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: ORCLDISK ; 0x000: length=8
kfdhdb.driver.reserved[0]: 0 ; 0x008: 0x00000000
kfdhdb.driver.reserved[1]: 0 ; 0x00c: 0x00000000
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: 168820736 ; 0x020: 0x0a100000
kfdhdb.dsknum: 1 ; 0x024: 0x0001
kfdhdb.grptyp: 1 ; 0x026: KFDGTP_EXTERNAL
kfdhdb.hdrsts: 3 ; 0x027: KFDHDR_MEMBER
kfdhdb.dskname: DATA_0001 ; 0x028: length=9
kfdhdb.grpname: DATA ; 0x048: length=4
kfdhdb.fgname: DATA_0001 ; 0x068: length=9
kfdhdb.capname: ; 0x088: length=0
kfdhdb.crestmp.hi: 32937837 ; 0x0a8: HOUR=0x9 DAYS=0x1b MNTH=0x5 YEAR=0x7da
kfdhdb.crestmp.lo: 1899649024 ; 0x0ac: USEC=0x0 MSEC=0x296 SECS=0x13 MINS=0x1c
kfdhdb.mntstmp.hi: 32937834 ; 0x0b0: HOUR=0xa DAYS=0x1b MNTH=0x5 YEAR=0x7da
kfdhdb.mntstmp.lo: 679906304 ; 0x0b4: USEC=0x0 MSEC=0x1a3 SECS=0x8 MINS=0xa
kfdhdb.secsize: 512 ; 0x0b8: 0x0200
kfdhdb.blksize: 4096 ; 0x0ba: 0x1000
kfdhdb.ausize: 1048576 ; 0x0bc: 0x00100000
kfdhdb.mfact: 113792 ; 0x0c0: 0x0001bc80
kfdhdb.dsksize: 1024 ; 0x0c4: 0x00000400
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
kfdhdb.redomirrors[1]: 0 ; 0x0da: 0x0000
kfdhdb.redomirrors[2]: 0 ; 0x0dc: 0x0000
kfdhdb.redomirrors[3]: 0 ; 0x0de: 0x0000
kfdhdb.dbcompat: 168820736 ; 0x0e0: 0x0a100000
kfdhdb.grpstmp.hi: 32937833 ; 0x0e4: HOUR=0x9 DAYS=0x1b MNTH=0x5 YEAR=0x7da
kfdhdb.grpstmp.lo: 1704339456 ; 0x0e8: USEC=0x0 MSEC=0x18a SECS=0x19 MINS=0x19
kfdhdb.ub4spare[0]: 0 ; 0x0ec: 0x00000000
kfdhdb.ub4spare[1]: 0 ; 0x0f0: 0x00000000
kfdhdb.ub4spare[2]: 0 ; 0x0f4: 0x00000000
kfdhdb.ub4spare[3]: 0 ; 0x0f8: 0x00000000
kfdhdb.ub4spare[4]: 0 ; 0x0fc: 0x00000000
kfdhdb.ub4spare[5]: 0 ; 0x100: 0x00000000
kfdhdb.ub4spare[6]: 0 ; 0x104: 0x00000000
kfdhdb.ub4spare[7]: 0 ; 0x108: 0x00000000
kfdhdb.ub4spare[8]: 0 ; 0x10c: 0x00000000
kfdhdb.ub4spare[9]: 0 ; 0x110: 0x00000000
kfdhdb.ub4spare[10]: 0 ; 0x114: 0x00000000
kfdhdb.ub4spare[11]: 0 ; 0x118: 0x00000000
kfdhdb.ub4spare[12]: 0 ; 0x11c: 0x00000000
kfdhdb.ub4spare[13]: 0 ; 0x120: 0x00000000
kfdhdb.ub4spare[14]: 0 ; 0x124: 0x00000000
kfdhdb.ub4spare[15]: 0 ; 0x128: 0x00000000
kfdhdb.ub4spare[16]: 0 ; 0x12c: 0x00000000
kfdhdb.ub4spare[17]: 0 ; 0x130: 0x00000000
kfdhdb.ub4spare[18]: 0 ; 0x134: 0x00000000
kfdhdb.ub4spare[19]: 0 ; 0x138: 0x00000000
kfdhdb.ub4spare[20]: 0 ; 0x13c: 0x00000000
kfdhdb.ub4spare[21]: 0 ; 0x140: 0x00000000
kfdhdb.ub4spare[22]: 0 ; 0x144: 0x00000000
kfdhdb.ub4spare[23]: 0 ; 0x148: 0x00000000
kfdhdb.ub4spare[24]: 0 ; 0x14c: 0x00000000
kfdhdb.ub4spare[25]: 0 ; 0x150: 0x00000000
kfdhdb.ub4spare[26]: 0 ; 0x154: 0x00000000
kfdhdb.ub4spare[27]: 0 ; 0x158: 0x00000000
kfdhdb.ub4spare[28]: 0 ; 0x15c: 0x00000000
kfdhdb.ub4spare[29]: 0 ; 0x160: 0x00000000
kfdhdb.ub4spare[30]: 0 ; 0x164: 0x00000000
kfdhdb.ub4spare[31]: 0 ; 0x168: 0x00000000
kfdhdb.ub4spare[32]: 0 ; 0x16c: 0x00000000
kfdhdb.ub4spare[33]: 0 ; 0x170: 0x00000000
kfdhdb.ub4spare[34]: 0 ; 0x174: 0x00000000
kfdhdb.ub4spare[35]: 0 ; 0x178: 0x00000000
kfdhdb.ub4spare[36]: 0 ; 0x17c: 0x00000000
kfdhdb.ub4spare[37]: 0 ; 0x180: 0x00000000
kfdhdb.ub4spare[38]: 0 ; 0x184: 0x00000000
kfdhdb.ub4spare[39]: 0 ; 0x188: 0x00000000
kfdhdb.ub4spare[40]: 0 ; 0x18c: 0x00000000
kfdhdb.ub4spare[41]: 0 ; 0x190: 0x00000000
kfdhdb.ub4spare[42]: 0 ; 0x194: 0x00000000
kfdhdb.ub4spare[43]: 0 ; 0x198: 0x00000000
kfdhdb.ub4spare[44]: 0 ; 0x19c: 0x00000000
kfdhdb.ub4spare[45]: 0 ; 0x1a0: 0x00000000
kfdhdb.ub4spare[46]: 0 ; 0x1a4: 0x00000000
kfdhdb.ub4spare[47]: 0 ; 0x1a8: 0x00000000
kfdhdb.ub4spare[48]: 0 ; 0x1ac: 0x00000000
kfdhdb.ub4spare[49]: 0 ; 0x1b0: 0x00000000
kfdhdb.ub4spare[50]: 0 ; 0x1b4: 0x00000000
kfdhdb.ub4spare[51]: 0 ; 0x1b8: 0x00000000
kfdhdb.ub4spare[52]: 0 ; 0x1bc: 0x00000000
kfdhdb.ub4spare[53]: 0 ; 0x1c0: 0x00000000
kfdhdb.ub4spare[54]: 0 ; 0x1c4: 0x00000000
kfdhdb.ub4spare[55]: 0 ; 0x1c8: 0x00000000
kfdhdb.ub4spare[56]: 0 ; 0x1cc: 0x00000000
kfdhdb.ub4spare[57]: 0 ; 0x1d0: 0x00000000
kfdhdb.acdb.aba.seq: 0 ; 0x1d4: 0x00000000
kfdhdb.acdb.aba.blk: 0 ; 0x1d8: 0x00000000
kfdhdb.acdb.ents: 0 ; 0x1dc: 0x0000
kfdhdb.acdb.ub2spare: 0 ; 0x1de: 0x0000
修復成功。


5、磁碟組file directory所在的磁碟頭資訊丟失恢復:

1)破壞hdisk5磁碟頭:
[oracle@p520:/oracle]$dd if=/dev/zero f=/dev/rhdisk5 bs=4096 count=1
1+0 records in.
1+0 records out.
[oracle@p520:/oracle]$kfed read /dev/rhdisk5
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: T=0 NUMB=0x0
kfbh.block.obj: 0 ; 0x008: TYPE=0x0 NUMB=0x0
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

檢查diskgroup:
SQL> alter diskgroup data mount;
alter diskgroup data mount
*
ERROR at line 1:
ORA-15032: not all alterations performed
ORA-15063: ASM discovered an insufficient number of disks for diskgroup "DATA"

2)根據file directory hdisk5查詢disk directory資訊:
可以用select name,path from v$asm_disk查出。

3)根據disk directory hdisk3找出磁碟資訊;裡面可以得到以下hdisk5的磁碟頭資訊;
kfddde[0].dsknum: 0 ; 0x034: 0x0000
kfddde[0].dskname: DATA_0000 ; 0x038: length=9
kfddde[0].fgname: DATA_0000 ; 0x058: length=9
kfddde[0].crestmp.hi: 32937833 ; 0x078: HOUR=0x9 DAYS=0x1b MNTH=0x5 YEAR=0x7da
kfddde[0].crestmp.lo: 1704514560 ; 0x07c: USEC=0x0 MSEC=0x235 SECS=0x19 MINS=0x19
kfddde[0].size: 51200 ; 0x08c: 0x0000c800

4)根據info.txt資訊生成恢復hdisk5磁碟標頭檔案:
這裡我們可以用hdisk3磁碟頭資訊檔案來修改:
kfed read /dev/rhdisk3 > /oracle/hdisk3.txt
kfbh.block.obj: 2147483649 ; 0x008: TYPE=0x8 NUMB=0x1
kfdhdb.dsknum: 1; 0x024: 0x0001
kfdhdb.dskname: DATA_0001 ; 0x028: length=9
kfdhdb.fgname: DATA_0001 ; 0x068: length=9
kfdhdb.crestmp.hi: 32937833 ; 0x0a8: HOUR=0x9 DAYS=0x1b MNTH=0x5 YEAR=0x7da
kfdhdb.crestmp.lo: 1704514560 ; 0x0ac: USEC=0x0 MSEC=0x235 SECS=0x19 MINS=0x19
kfdhdb.dsksize: 1024 ; 0x0c4: 0x0000c800

將上面值修改為以下值:
kfbh.block.obj: 2147483648 ; 0x008: TYPE=0x8 NUMB=0x0
kfdhdb.dsknum: 0 ; 0x024: 0x0000
kfdhdb.dskname: DATA_0000 ; 0x028: length=9
kfdhdb.fgname: DATA_0000 ; 0x068: length=9
kfdhdb.crestmp.hi: 32937833 ; 0x0a8: HOUR=0x9 DAYS=0x1b MNTH=0x5 YEAR=0x7da
kfdhdb.crestmp.lo: 1704514560; 0x0ac: USEC=0x0 MSEC=0x235 SECS=0x19 MINS=0x19
kfdhdb.dsksize: 51200 ; 0x0c4: 0x0000c800
這個最好用ultraedit編輯,生成hdisk5.txt。

kfed merge進去標頭檔案資訊到hdisk5:
[oracle@p520:/oracle]$kfed merge /dev/rhdisk3 text=/oracle/hdisk5.txt
驗證是否修復成功
SQL> alter diskgroup data mount;
Diskgroup altered.
並且能夠讀出磁碟頭資訊:
[oracle@p520:/oracle]$kfed read /dev/rhdisk5
kfbh.endian: 0 ; 0x000: 0x00
kfbh.hard: 130 ; 0x001: 0x82
kfbh.type: 1 ; 0x002: KFBTYP_DISKHEAD
kfbh.datfmt: 1 ; 0x003: 0x01
kfbh.block.blk: 0 ; 0x004: T=0 NUMB=0x0
kfbh.block.obj: 2147483648 ; 0x008: TYPE=0x8 NUMB=0x0
kfbh.check: 170969582 ; 0x00c: 0x0a30c9ee
kfbh.fcn.base: 0 ; 0x010: 0x00000242
kfbh.fcn.wrap: 0 ; 0x014: 0x00000000
kfbh.spare1: 0 ; 0x018: 0x00000000
kfbh.spare2: 0 ; 0x01c: 0x00000000
kfdhdb.driver.provstr: ORCLDISK ; 0x000: length=8
kfdhdb.driver.reserved[0]: 0 ; 0x008: 0x00000000
kfdhdb.driver.reserved[1]: 0 ; 0x00c: 0x00000000
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: 168820736 ; 0x020: 0x0a100000
kfdhdb.dsknum: 0 ; 0x024: 0x0000
kfdhdb.grptyp: 1 ; 0x026: KFDGTP_EXTERNAL
kfdhdb.hdrsts: 3 ; 0x027: KFDHDR_MEMBER
kfdhdb.dskname: DATA_0000 ; 0x028: length=9
kfdhdb.grpname: DATA ; 0x048: length=4
kfdhdb.fgname: DATA_0000 ; 0x068: length=9
kfdhdb.capname: ; 0x088: length=0
kfdhdb.crestmp.hi: 32937833 ; 0x0a8: HOUR=0x9 DAYS=0x1b MNTH=0x5 YEAR=0x7da
kfdhdb.crestmp.lo: 1704514560 ; 0x0ac: USEC=0x0 MSEC=0x235 SECS=0x19 MINS=0x19
kfdhdb.mntstmp.hi: 32937834 ; 0x0b0: HOUR=0xa DAYS=0x1b MNTH=0x5 YEAR=0x7da
kfdhdb.mntstmp.lo: 679906304 ; 0x0b4: USEC=0x0 MSEC=0x1a3 SECS=0x8 MINS=0xa
kfdhdb.secsize: 512 ; 0x0b8: 0x0200
kfdhdb.blksize: 4096 ; 0x0ba: 0x1000
kfdhdb.ausize: 1048576 ; 0x0bc: 0x00100000
kfdhdb.mfact: 113792 ; 0x0c0: 0x0001bc80
kfdhdb.dsksize: 51200 ; 0x0c4: 0x0000c800
kfdhdb.pmcnt: 2 ; 0x0c8: 0x00000002
kfdhdb.fstlocn: 1 ; 0x0cc: 0x00000001
kfdhdb.altlocn: 2 ; 0x0d0: 0x00000002
kfdhdb.f1b1locn: 2 ; 0x0d4: 0x00000002
kfdhdb.redomirrors[0]: 0 ; 0x0d8: 0x0000
kfdhdb.redomirrors[1]: 65535 ; 0x0da: 0xffff
kfdhdb.redomirrors[2]: 65535 ; 0x0dc: 0xffff
kfdhdb.redomirrors[3]: 65535 ; 0x0de: 0xffff
kfdhdb.dbcompat: 168820736 ; 0x0e0: 0x0a100000
kfdhdb.grpstmp.hi: 32937833 ; 0x0e4: HOUR=0x9 DAYS=0x1b MNTH=0x5 YEAR=0x7da
kfdhdb.grpstmp.lo: 1704339456 ; 0x0e8: USEC=0x0 MSEC=0x18a SECS=0x19 MINS=0x19
修復成功。


6、磁碟組所有磁碟頭資訊丟失的恢復:

1)破壞磁碟組磁碟頭資訊:
SQL> select DISK_NUMBER,name,path from v$asm_disk where group_number=2;

DISK_NUMBER NAME PATH
----------- -------------------- --------------------
1 DGTEST_0001 /dev/rhdisk7
0 DGTEST_0000 /dev/rhdisk5

[oracle@p520:/oracle/app/oracle]$dd if=/dev/zero f=/dev/rhdisk5 bs=4096 count=1
1+0 records in.
1+0 records out.
[oracle@p520:/oracle/app/oracle]$dd if=/dev/zero f=/dev/rhdisk6 bs=4096 count=1
1+0 records in.
1+0 records out.

SQL> alter diskgroup dgtest mount;
alter diskgroup dgtest mount
*
ERROR at line 1:
ORA-15032: not all alterations performed
ORA-15063: ASM discovered an insufficient number of disks for diskgroup "DGTEST"

2)透過查詢file directory盤來查詢磁碟資訊;

我們確定hdisk5為file directory盤;並用以下命令找到disk directory盤:
可以用select name,path from v$asm_disk查出。

3)根據上面的資訊查詢磁碟組磁碟資訊:
kfed read /dev/rhdisk5 aunum=3 blknum=0|more

得到磁碟hdisk5磁碟頭資訊:
kfddde[0].entry.incarn: 1 ; 0x024: A=1 NUMM=0x0
kfddde[0].entry.hash: 0 ; 0x028: 0x00000000
kfddde[0].entry.refer.number:4294967295 ; 0x02c: 0xffffffff
kfddde[0].entry.refer.incarn: 0 ; 0x030: A=0 NUMM=0x0
kfddde[0].dsknum: 0 ; 0x034: 0x0000
kfddde[0].state: 2 ; 0x036: KFDSTA_NORMAL
kfddde[0].ub1spare: 0 ; 0x037: 0x00
kfddde[0].dskname: DGTEST_0000 ; 0x038: length=11
kfddde[0].fgname: DGTEST_0000 ; 0x058: length=11
kfddde[0].crestmp.hi: 32937866 ; 0x078: HOUR=0xa DAYS=0x1c MNTH=0x5 YEAR=0x7da
kfddde[0].crestmp.lo: 3925069824 ; 0x07c: USEC=0x0 MSEC=0xf4 SECS=0x1f MINS=0x3a
kfddde[0].failstmp.hi: 0 ; 0x080: HOUR=0x0 DAYS=0x0 MNTH=0x0 YEAR=0x0
kfddde[0].failstmp.lo: 0 ; 0x084: USEC=0x0 MSEC=0x0 SECS=0x0 MINS=0x0
kfddde[0].timer: 0 ; 0x088: 0x00000000
kfddde[0].size: 51200 ; 0x08c: 0x0000c800
kfddde[0].spare[0]: 0 ; 0x090: 0x00000000
kfddde[0].spare[1]: 0 ; 0x094: 0x00000000
kfddde[0].spare[2]: 0 ; 0x098: 0x00000000
kfddde[0].spare[3]: 0 ; 0x09c: 0x00000000
kfddde[0].spare[4]: 0 ; 0x0a0: 0x00000000
kfddde[0].zones[0].start: 0 ; 0x0a4: 0x00000000
kfddde[0].zones[0].size: 51200 ; 0x0a8: 0x0000c800
kfddde[0].zones[0].used: 90 ; 0x0ac: 0x0000005a
kfddde[0].zones[0].spare: 0 ; 0x0b0: 0x00000000

得到磁碟hdisk7磁碟頭資訊:
kfddde[1].entry.incarn: 1 ; 0x1e4: A=1 NUMM=0x0
kfddde[1].entry.hash: 1 ; 0x1e8: 0x00000001
kfddde[1].entry.refer.number:4294967295 ; 0x1ec: 0xffffffff
kfddde[1].entry.refer.incarn: 0 ; 0x1f0: A=0 NUMM=0x0
kfddde[1].dsknum: 1 ; 0x1f4: 0x0001
kfddde[1].state: 2 ; 0x1f6: KFDSTA_NORMAL
kfddde[1].ub1spare: 0 ; 0x1f7: 0x00
kfddde[1].dskname: DGTEST_0001 ; 0x1f8: length=11
kfddde[1].fgname: DGTEST_0001 ; 0x218: length=11
kfddde[1].crestmp.hi: 32937866 ; 0x238: HOUR=0xa DAYS=0x1c MNTH=0x5 YEAR=0x7da
kfddde[1].crestmp.lo: 3925069824 ; 0x23c: USEC=0x0 MSEC=0xf4 SECS=0x1f MINS=0x3a
kfddde[1].failstmp.hi: 0 ; 0x240: HOUR=0x0 DAYS=0x0 MNTH=0x0 YEAR=0x0
kfddde[1].failstmp.lo: 0 ; 0x244: USEC=0x0 MSEC=0x0 SECS=0x0 MINS=0x0
kfddde[1].timer: 0 ; 0x248: 0x00000000
kfddde[1].size: 2048 ; 0x24c: 0x00000800
kfddde[1].spare[0]: 0 ; 0x250: 0x00000000
kfddde[1].spare[1]: 0 ; 0x254: 0x00000000
kfddde[1].spare[2]: 0 ; 0x258: 0x00000000
kfddde[1].spare[3]: 0 ; 0x25c: 0x00000000
kfddde[1].spare[4]: 0 ; 0x260: 0x00000000
kfddde[1].zones[0].start: 0 ; 0x264: 0x00000000
kfddde[1].zones[0].size: 2048 ; 0x268: 0x00000800
kfddde[1].zones[0].used: 5 ; 0x26c: 0x00000005
kfddde[1].zones[0].spare: 0 ; 0x270: 0x00000000

4)根據上面資訊,我們重新生成hdisk5和hdisk7的磁碟標頭檔案資訊:
hdisk5磁碟標頭檔案資訊:
kfbh.endian: 0 ; 0x000: 0x00
kfbh.hard: 130 ; 0x001: 0x82
kfbh.type: 1 ; 0x002: KFBTYP_DISKHEAD
kfbh.datfmt: 1 ; 0x003: 0x01
kfbh.block.blk: 0 ; 0x004: T=0 NUMB=0x0
kfbh.block.obj: {2147483648} ; 0x008: TYPE=0x8 NUMB=0x0
kfbh.check: 0 ; 0x00c: 0x750bcb49
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: ORCLDISK ; 0x000: length=8
kfdhdb.driver.reserved[0]: 0 ; 0x008: 0x00000000
kfdhdb.driver.reserved[1]: 0 ; 0x00c: 0x00000000
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: 168820736 ; 0x020: 0x0a100000
kfdhdb.dsknum: {0} ; 0x024: 0x0000
kfdhdb.grptyp: {1} ; 0x026: KFDGTP_EXTERNAL
kfdhdb.hdrsts: {3} ; 0x027: KFDHDR_MEMBER
kfdhdb.dskname: {DGTEST_0000} ; 0x028: length=11
kfdhdb.grpname: {DGTEST} ; 0x048: length=6
kfdhdb.fgname: {DGTEST_0000} ; 0x068: length=11
kfdhdb.capname: ; 0x088: length=0
kfdhdb.crestmp.hi: {32937866} ; 0x0a8: HOUR=0xa DAYS=0x1c MNTH=0x5 YEAR=0x7da
kfdhdb.crestmp.lo: {3925069824} ; 0x0ac: USEC=0x0 MSEC=0xf4 SECS=0x1f MINS=0x3a
kfdhdb.mntstmp.hi: 32937866 ; 0x0b0: HOUR=0xa DAYS=0x1c MNTH=0x5 YEAR=0x7da
kfdhdb.mntstmp.lo: 3933855744 ; 0x0b4: USEC=0x0 MSEC=0x278 SECS=0x27 MINS=0x3a
kfdhdb.secsize: 512 ; 0x0b8: 0x0200
kfdhdb.blksize: 4096 ; 0x0ba: 0x1000
kfdhdb.ausize: 1048576 ; 0x0bc: 0x00100000
kfdhdb.mfact: 113792 ; 0x0c0: 0x0001bc80
kfdhdb.dsksize: {51200} ; 0x0c4: 0x0000c800
kfdhdb.pmcnt: 2 ; 0x0c8: 0x00000002
kfdhdb.fstlocn: 1 ; 0x0cc: 0x00000001
kfdhdb.altlocn: 2 ; 0x0d0: 0x00000002
kfdhdb.f1b1locn: 2 ; 0x0d4: 0x00000002
kfdhdb.redomirrors[0]: 0 ; 0x0d8: 0x0000
kfdhdb.redomirrors[1]: 0 ; 0x0da: 0x0000
kfdhdb.redomirrors[2]: 0 ; 0x0dc: 0x0000
kfdhdb.redomirrors[3]: 0 ; 0x0de: 0x0000
kfdhdb.dbcompat: 168820736 ; 0x0e0: 0x0a100000
kfdhdb.grpstmp.hi: 32937866 ; 0x0e4: HOUR=0xa DAYS=0x1c MNTH=0x5 YEAR=0x7da
kfdhdb.grpstmp.lo: 3924577280 ; 0x0e8: USEC=0x0 MSEC=0x313 SECS=0x1e MINS=0x3a
kfdhdb.ub4spare[0]: 0 ; 0x0ec: 0x00000000
kfdhdb.ub4spare[1]: 0 ; 0x0f0: 0x00000000
kfdhdb.ub4spare[2]: 0 ; 0x0f4: 0x00000000
kfdhdb.ub4spare[3]: 0 ; 0x0f8: 0x00000000
kfdhdb.ub4spare[4]: 0 ; 0x0fc: 0x00000000
kfdhdb.ub4spare[5]: 0 ; 0x100: 0x00000000
kfdhdb.ub4spare[6]: 0 ; 0x104: 0x00000000
kfdhdb.ub4spare[7]: 0 ; 0x108: 0x00000000
kfdhdb.ub4spare[8]: 0 ; 0x10c: 0x00000000
kfdhdb.ub4spare[9]: 0 ; 0x110: 0x00000000
kfdhdb.ub4spare[10]: 0 ; 0x114: 0x00000000
kfdhdb.ub4spare[11]: 0 ; 0x118: 0x00000000
kfdhdb.ub4spare[12]: 0 ; 0x11c: 0x00000000
kfdhdb.ub4spare[13]: 0 ; 0x120: 0x00000000
kfdhdb.ub4spare[14]: 0 ; 0x124: 0x00000000
kfdhdb.ub4spare[15]: 0 ; 0x128: 0x00000000
kfdhdb.ub4spare[16]: 0 ; 0x12c: 0x00000000
kfdhdb.ub4spare[17]: 0 ; 0x130: 0x00000000
kfdhdb.ub4spare[18]: 0 ; 0x134: 0x00000000
kfdhdb.ub4spare[19]: 0 ; 0x138: 0x00000000
kfdhdb.ub4spare[20]: 0 ; 0x13c: 0x00000000
kfdhdb.ub4spare[21]: 0 ; 0x140: 0x00000000
kfdhdb.ub4spare[22]: 0 ; 0x144: 0x00000000
kfdhdb.ub4spare[23]: 0 ; 0x148: 0x00000000
kfdhdb.ub4spare[24]: 0 ; 0x14c: 0x00000000
kfdhdb.ub4spare[25]: 0 ; 0x150: 0x00000000
kfdhdb.ub4spare[26]: 0 ; 0x154: 0x00000000
kfdhdb.ub4spare[27]: 0 ; 0x158: 0x00000000
kfdhdb.ub4spare[28]: 0 ; 0x15c: 0x00000000
kfdhdb.ub4spare[29]: 0 ; 0x160: 0x00000000
kfdhdb.ub4spare[30]: 0 ; 0x164: 0x00000000
kfdhdb.ub4spare[31]: 0 ; 0x168: 0x00000000
kfdhdb.ub4spare[32]: 0 ; 0x16c: 0x00000000
kfdhdb.ub4spare[33]: 0 ; 0x170: 0x00000000
kfdhdb.ub4spare[34]: 0 ; 0x174: 0x00000000
kfdhdb.ub4spare[35]: 0 ; 0x178: 0x00000000
kfdhdb.ub4spare[36]: 0 ; 0x17c: 0x00000000
kfdhdb.ub4spare[37]: 0 ; 0x180: 0x00000000
kfdhdb.ub4spare[38]: 0 ; 0x184: 0x00000000
kfdhdb.ub4spare[39]: 0 ; 0x188: 0x00000000
kfdhdb.ub4spare[40]: 0 ; 0x18c: 0x00000000
kfdhdb.ub4spare[41]: 0 ; 0x190: 0x00000000
kfdhdb.ub4spare[42]: 0 ; 0x194: 0x00000000
kfdhdb.ub4spare[43]: 0 ; 0x198: 0x00000000
kfdhdb.ub4spare[44]: 0 ; 0x19c: 0x00000000
kfdhdb.ub4spare[45]: 0 ; 0x1a0: 0x00000000
kfdhdb.ub4spare[46]: 0 ; 0x1a4: 0x00000000
kfdhdb.ub4spare[47]: 0 ; 0x1a8: 0x00000000
kfdhdb.ub4spare[48]: 0 ; 0x1ac: 0x00000000
kfdhdb.ub4spare[49]: 0 ; 0x1b0: 0x00000000
kfdhdb.ub4spare[50]: 0 ; 0x1b4: 0x00000000
kfdhdb.ub4spare[51]: 0 ; 0x1b8: 0x00000000
kfdhdb.ub4spare[52]: 0 ; 0x1bc: 0x00000000
kfdhdb.ub4spare[53]: 0 ; 0x1c0: 0x00000000
kfdhdb.ub4spare[54]: 0 ; 0x1c4: 0x00000000
kfdhdb.ub4spare[55]: 0 ; 0x1c8: 0x00000000
kfdhdb.ub4spare[56]: 0 ; 0x1cc: 0x00000000
kfdhdb.ub4spare[57]: 0 ; 0x1d0: 0x00000000
kfdhdb.acdb.aba.seq: 0 ; 0x1d4: 0x00000000
kfdhdb.acdb.aba.blk: 0 ; 0x1d8: 0x00000000
kfdhdb.acdb.ents: 0 ; 0x1dc: 0x0000
kfdhdb.acdb.ub2spare: 0 ; 0x1de: 0x0000

hdisk7磁碟標頭檔案資訊

kfbh.endian: 0 ; 0x000: 0x00
kfbh.hard: 130 ; 0x001: 0x82
kfbh.type: 1 ; 0x002: KFBTYP_DISKHEAD
kfbh.datfmt: 1 ; 0x003: 0x01
kfbh.block.blk: 0 ; 0x004: T=0 NUMB=0x0
kfbh.block.obj: {2147483649} ; 0x008: TYPE=0x8 NUMB=0x1
kfbh.check: 1963592522 ; 0x00c: 0x750a0b4a
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: ORCLDISK ; 0x000: length=8
kfdhdb.driver.reserved[0]: 0 ; 0x008: 0x00000000
kfdhdb.driver.reserved[1]: 0 ; 0x00c: 0x00000000
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: 168820736 ; 0x020: 0x0a100000
kfdhdb.dsknum: {1} ; 0x024: 0x0001
kfdhdb.grptyp: {1} ; 0x026: KFDGTP_EXTERNAL
kfdhdb.hdrsts: {3} ; 0x027: KFDHDR_MEMBER
kfdhdb.dskname: {DGTEST_0001} ; 0x028: length=11
kfdhdb.grpname: {DGTEST} ; 0x048: length=6
kfdhdb.fgname: {DGTEST_0001} ; 0x068: length=11
kfdhdb.capname: ; 0x088: length=0
kfdhdb.crestmp.hi: {32937866} ; 0x0a8: HOUR=0xa DAYS=0x1c MNTH=0x5 YEAR=0x7da
kfdhdb.crestmp.lo: {3925069824} ; 0x0ac: USEC=0x0 MSEC=0xf4 SECS=0x1f MINS=0x3a
kfdhdb.mntstmp.hi: 32937866 ; 0x0b0: HOUR=0xa DAYS=0x1c MNTH=0x5 YEAR=0x7da
kfdhdb.mntstmp.lo: 3933855744 ; 0x0b4: USEC=0x0 MSEC=0x278 SECS=0x27 MINS=0x3a
kfdhdb.secsize: 512 ; 0x0b8: 0x0200
kfdhdb.blksize: 4096 ; 0x0ba: 0x1000
kfdhdb.ausize: 1048576 ; 0x0bc: 0x00100000
kfdhdb.mfact: 113792 ; 0x0c0: 0x0001bc80
kfdhdb.dsksize: {2048} ; 0x0c4: 0x00000800
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
kfdhdb.redomirrors[1]: 0 ; 0x0da: 0x0000
kfdhdb.redomirrors[2]: 0 ; 0x0dc: 0x0000
kfdhdb.redomirrors[3]: 0 ; 0x0de: 0x0000
kfdhdb.dbcompat: 168820736 ; 0x0e0: 0x0a100000
kfdhdb.grpstmp.hi: 32937866 ; 0x0e4: HOUR=0xa DAYS=0x1c MNTH=0x5 YEAR=0x7da
kfdhdb.grpstmp.lo: 3924577280 ; 0x0e8: USEC=0x0 MSEC=0x313 SECS=0x1e MINS=0x3a
kfdhdb.ub4spare[0]: 0 ; 0x0ec: 0x00000000
kfdhdb.ub4spare[1]: 0 ; 0x0f0: 0x00000000
kfdhdb.ub4spare[2]: 0 ; 0x0f4: 0x00000000
kfdhdb.ub4spare[3]: 0 ; 0x0f8: 0x00000000
kfdhdb.ub4spare[4]: 0 ; 0x0fc: 0x00000000
kfdhdb.ub4spare[5]: 0 ; 0x100: 0x00000000
kfdhdb.ub4spare[6]: 0 ; 0x104: 0x00000000
kfdhdb.ub4spare[7]: 0 ; 0x108: 0x00000000
kfdhdb.ub4spare[8]: 0 ; 0x10c: 0x00000000
kfdhdb.ub4spare[9]: 0 ; 0x110: 0x00000000
kfdhdb.ub4spare[10]: 0 ; 0x114: 0x00000000
kfdhdb.ub4spare[11]: 0 ; 0x118: 0x00000000
kfdhdb.ub4spare[12]: 0 ; 0x11c: 0x00000000
kfdhdb.ub4spare[13]: 0 ; 0x120: 0x00000000
kfdhdb.ub4spare[14]: 0 ; 0x124: 0x00000000
kfdhdb.ub4spare[15]: 0 ; 0x128: 0x00000000
kfdhdb.ub4spare[16]: 0 ; 0x12c: 0x00000000
kfdhdb.ub4spare[17]: 0 ; 0x130: 0x00000000
kfdhdb.ub4spare[18]: 0 ; 0x134: 0x00000000
kfdhdb.ub4spare[19]: 0 ; 0x138: 0x00000000
kfdhdb.ub4spare[20]: 0 ; 0x13c: 0x00000000
kfdhdb.ub4spare[21]: 0 ; 0x140: 0x00000000
kfdhdb.ub4spare[22]: 0 ; 0x144: 0x00000000
kfdhdb.ub4spare[23]: 0 ; 0x148: 0x00000000
kfdhdb.ub4spare[24]: 0 ; 0x14c: 0x00000000
kfdhdb.ub4spare[25]: 0 ; 0x150: 0x00000000
kfdhdb.ub4spare[26]: 0 ; 0x154: 0x00000000
kfdhdb.ub4spare[27]: 0 ; 0x158: 0x00000000
kfdhdb.ub4spare[28]: 0 ; 0x15c: 0x00000000
kfdhdb.ub4spare[29]: 0 ; 0x160: 0x00000000
kfdhdb.ub4spare[30]: 0 ; 0x164: 0x00000000
kfdhdb.ub4spare[31]: 0 ; 0x168: 0x00000000
kfdhdb.ub4spare[32]: 0 ; 0x16c: 0x00000000
kfdhdb.ub4spare[33]: 0 ; 0x170: 0x00000000
kfdhdb.ub4spare[34]: 0 ; 0x174: 0x00000000
kfdhdb.ub4spare[35]: 0 ; 0x178: 0x00000000
kfdhdb.ub4spare[36]: 0 ; 0x17c: 0x00000000
kfdhdb.ub4spare[37]: 0 ; 0x180: 0x00000000
kfdhdb.ub4spare[38]: 0 ; 0x184: 0x00000000
kfdhdb.ub4spare[39]: 0 ; 0x188: 0x00000000
kfdhdb.ub4spare[40]: 0 ; 0x18c: 0x00000000
kfdhdb.ub4spare[41]: 0 ; 0x190: 0x00000000
kfdhdb.ub4spare[42]: 0 ; 0x194: 0x00000000
kfdhdb.ub4spare[43]: 0 ; 0x198: 0x00000000
kfdhdb.ub4spare[44]: 0 ; 0x19c: 0x00000000
kfdhdb.ub4spare[45]: 0 ; 0x1a0: 0x00000000
kfdhdb.ub4spare[46]: 0 ; 0x1a4: 0x00000000
kfdhdb.ub4spare[47]: 0 ; 0x1a8: 0x00000000
kfdhdb.ub4spare[48]: 0 ; 0x1ac: 0x00000000
kfdhdb.ub4spare[49]: 0 ; 0x1b0: 0x00000000
kfdhdb.ub4spare[50]: 0 ; 0x1b4: 0x00000000
kfdhdb.ub4spare[51]: 0 ; 0x1b8: 0x00000000
kfdhdb.ub4spare[52]: 0 ; 0x1bc: 0x00000000
kfdhdb.ub4spare[53]: 0 ; 0x1c0: 0x00000000
kfdhdb.ub4spare[54]: 0 ; 0x1c4: 0x00000000
kfdhdb.ub4spare[55]: 0 ; 0x1c8: 0x00000000
kfdhdb.ub4spare[56]: 0 ; 0x1cc: 0x00000000
kfdhdb.ub4spare[57]: 0 ; 0x1d0: 0x00000000
kfdhdb.acdb.aba.seq: 0 ; 0x1d4: 0x00000000
kfdhdb.acdb.aba.blk: 0 ; 0x1d8: 0x00000000
kfdhdb.acdb.ents: 0 ; 0x1dc: 0x0000
kfdhdb.acdb.ub2spare: 0 ; 0x1de: 0x0000


5)恢復磁碟頭:
kfed merge磁碟頭資訊:

[oracle@p520:/oracle/app/oracle]$kfed merge /dev/rhdisk5 text=hdisk5.txt
[oracle@p520:/oracle/app/oracle]$kfed merge /dev/rhdisk7 text=hdisk7.txt

SQL> select name,state from v$asm_diskgroup;

name state
---------- ---------------
DGTEST DISMOUNTED

SQL> alter diskgroup dgtest mount;

Diskgroup altered.

修復成功.

四、實驗總結

1、修復磁碟頭資訊思路:
找到file directory ,再根據file directory 找到 disk directory;
根據disk directory找出磁碟資訊,手工編輯磁碟標頭檔案,最後用kfed merge到對應磁碟中,生成磁碟頭

資訊。

2、file directory一般在磁碟組某個磁碟au=2 的位置上,如果對磁碟組做過刪除盤和增加盤的操作,

file directory不一定在au=2的位置上,需要手工去查詢。

3、對有客戶使用asm,建議備份下磁碟頭資訊。

4、客戶生產資料庫還是要做好備份。

5、oracle 11g已經有操作磁碟頭資訊的工具amdu,10g環境如果要使用,需要單獨下載,參考METALINK文件

Placeholder for AMDU binaries and using with ASM 10g [ID 553639.1]。

6、kfed工具使用建議oracle版本在10.2.0.2以上,oracle 10.2.0.1會有bug。

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

相關文章