【ASM数据恢复】如何修复ASM Disk header_status=FORMER的磁盘重新加入Diskgroup ORA-15017 ORA-15063 ORA-15032

存在以下这种情况, 由于误DROP DISKGROUP或者误将DISK DROP 出原Diskgroup,或者因为Bug 13331814: ASM DISKS TURNED INTO FORMER WHILE DISKGROUP IS MOUNTED, 导致ASM DISK的header_status=FORMER,而非正常的MEMBER状态。

 

如果自己搞不定可以找诗檀软件专业ORACLE数据库修复团队成员帮您恢复!

诗檀软件专业数据库修复团队

服务热线 : 13764045638   QQ号:47079569    邮箱:service@parnassusdata.com

 

举例来说如下面的例子

 

 

[oracle@mlab2 ~]$ sqlplus  / as sysasm

SQL*Plus: Release 11.2.0.3.0 Production on Tue Nov 19 21:55:09 2013

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

Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - 64bit Production
With the Automatic Storage Management option

SQL>  create diskgroup maclean external redundancy disk '/dev/asm-disk9';

Diskgroup created.

SQL> select group_number,name,state from v$asm_diskgroup;

GROUP_NUMBER NAME                           STATE
------------ ------------------------------ -----------
           1 DATA                           MOUNTED
           2 MACLEAN                        MOUNTED

SQL> col path for a40
SQL> select name,path,header_status from v$asm_disk where group_number=2;

NAME                           PATH
------------------------------ ----------------------------------------
HEADER_STATU
------------
MACLEAN_0000                   /dev/asm-disk9
MEMBER

 

 

这里我们将diskgroup drop一次:

 

 

SQL> drop diskgroup maclean;

Diskgroup dropped.

SQL> alter diskgroup maclean mount;
alter diskgroup maclean mount
*
ERROR at line 1:
ORA-15032: not all alterations performed
ORA-15017: diskgroup "MACLEAN" cannot be mounted
ORA-15063: ASM discovered an insufficient number of disks for diskgroup
"MACLEAN"

SQL> select name,path,header_status from v$asm_disk where path='/dev/asm-disk9';

NAME                           PATH
------------------------------ ----------------------------------------
HEADER_STATU
------------
                               /dev/asm-disk9
FORMER

 

 

 

使用kfed查看 ASM disk header metadata

 

 

[oracle@mlab2 ~]$ kfed read /dev/asm-disk9 |head -25
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:              2147483648 ; 0x008: disk=0
kfbh.check:                   554377417 ; 0x00c: 0x210b20c9
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=11
kfdhdb.driver.reserved[0]:        65796 ; 0x008: 0x00010104
kfdhdb.driver.reserved[1]:            1 ; 0x00c: 0x00000001
kfdhdb.driver.reserved[2]:      4206569 ; 0x010: 0x00402fe9
kfdhdb.driver.reserved[3]:      3367865 ; 0x014: 0x003363b9
kfdhdb.driver.reserved[4]:    196018176 ; 0x018: 0x0baf0000
kfdhdb.driver.reserved[5]:    390595073 ; 0x01c: 0x17480201
kfdhdb.compat:                168820736 ; 0x020: 0x0a100000
kfdhdb.dsknum:                        0 ; 0x024: 0x0000
kfdhdb.grptyp:                        1 ; 0x026: KFDGTP_EXTERNAL
kfdhdb.hdrsts:                        4 ; 0x027: KFDHDR_FORMER
kfdhdb.dskname:            MACLEAN_0000 ; 0x028: length=12
kfdhdb.grpname:                 MACLEAN ; 0x048: length=7
kfdhdb.fgname:             MACLEAN_0000 ; 0x068: length=12

 

 

 

这里的kfdhdb.hdrsts: 4 ; 0x027: KFDHDR_FORMER 说明了该DISK的状态为FORMER

 

 

首先备份对应 ASM DISK的header

 

[oracle@mlab2 ~]$ mkdir /tmp/asm
[oracle@mlab2 ~]$ dd if=/dev/asm-disk9 of=/tmp/asm/asm-disk9-header bs=1024k count=20

[oracle@mlab2 ~]$ kfed read /dev/asm-disk9 > /tmp/asm/asm-disk9-meta

[oracle@mlab2 ~]$ ls -l /tmp/asm/asm-disk9-meta
-rw-r--r-- 1 oracle oinstall 6597 Nov 20 01:26 /tmp/asm/asm-disk9-meta

修改asm-disk9-meta这个文本中的内容

kfdhdb.hdrsts: 4 ; 0x027: KFDHDR_FORMER

修改为

kfdhdb.hdrsts: 3 ; 0x027: KFDHDR_MEMBER

 

 

 

如下面2图所示的变更:

 

hdrsts

 

 

 

 

 

 

 

 

 

 

 

hdrsts2

 

 

之后可以使用修改好的元数据信息文本来patch ASM DISK了,具体命令如下:

 

 

[oracle@mlab2 ~]$ kfed merge /dev/asm-disk9 text=/tmp/asm/asm-disk9-meta

再次确认 

[oracle@mlab2 ~]$ kfed read /dev/asm-disk9 |grep hdrsts
kfdhdb.hdrsts:                        3 ; 0x027: KFDHDR_MEMBER

 

 

最后尝试MOUNT该DISK对应的DISKGROUP:

 

SQL> alter diskgroup maclean mount;

Diskgroup altered.

SQL> select name,state from v$asm_diskgroup;

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

关注dbDao.com的新浪微博

扫码关注dbDao.com 微信公众号:

Speak Your Mind

TEL/電話+86 13764045638
Email service@parnassusdata.com
QQ 47079569