在數據庫運維中,總會遇到一些粗枝大葉的DBA,一不當心刪除一些東西,這裏舉例講解在誤刪除ASM磁盤以後,若是用KFED工具進行恢復:sql
[grid@RAC1 ~]$ sqlplus / as sysasm SQL*Plus: Release 11.2.0.4.0 Production on Thu Jan 5 00:06:04 2017 Copyright (c) 1982, 2013, Oracle. All rights reserved. Connected to: Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production With the Real Application Clusters and Automatic Storage Management options SQL> col path format a30 SQL> select name,path,header_status from v$asm_disk; NAME PATH HEADER_STATU ------------------------------ ------------------------------ ------------ DATA_0001 /dev/mapper/mpathc MEMBER DATA_0004 /dev/mapper/mpathd MEMBER DATA_0003 /dev/mapper/mpathf MEMBER DATA_0000 /dev/mapper/mpathb MEMBER DATA1_0001 /dev/mapper/mpathh MEMBER DATA_0002 /dev/mapper/mpathg MEMBER DATA1_0002 /dev/mapper/mpathi MEMBER DATA1_0000 /dev/mapper/mpathe MEMBER 8 rows selected. SQL> drop diskgroup DATA; drop diskgroup DATA * ERROR at line 1: ORA-15039: diskgroup not dropped ORA-15053: diskgroup "DATA" contains existing files SQL> drop diskgroup DATA including contents; drop diskgroup DATA including contents * ERROR at line 1: ORA-15039: diskgroup not dropped ORA-15027: active use of diskgroup "DATA" precludes its dismount ------------------------------------------------------------------------------------------------------------------------ 關閉數據鏈接: SQL> alter diskgroup DATA dismount force; Diskgroup altered. SQL> drop diskgroup DATA force including contents; drop diskgroup DATA force including contents * ERROR at line 1: ORA-15039: diskgroup not dropped ORA-15073: diskgroup DATA is mounted by another ASM instance
dismount 須要兩邊都dismount SQL> drop diskgroup DATA force including contents; Diskgroup dropped. SQL> select name,path,header_status from v$asm_disk; NAME PATH HEADER_STATU ------------------------------ ------------------------------ ------------ /dev/mapper/mpathc FORMER /dev/mapper/mpathd FORMER /dev/mapper/mpathf FORMER /dev/mapper/mpathb FORMER /dev/mapper/mpathg FORMER DATA1_0001 /dev/mapper/mpathh MEMBER DATA1_0002 /dev/mapper/mpathi MEMBER DATA1_0000 /dev/mapper/mpathe MEMBER 8 rows selected. [grid@RAC1 ~]$ crs_stat -t CRS-0184: Cannot communicate with the CRS daemon. ############################################################################################################### 使用kfed進行恢復 [grid@RAC1 ~]$ kfed read /dev/mapper/mpathc > /tmp/mpathc-meta [root@RAC1 tmp]# vi mpathc-meta
用vi打開生成的文件,修改下面一行數據 kfdhdb.hdrsts: 4 ; 0x027: KFDHDR_FORMER 修改成: kfdhdb.hdrsts: 3 ; 0x027: KFDHDR_MEMBER [grid@RAC1 ~]$ kfed merge /dev/mapper/mpathc text=/tmp/mpathc-meta 將全部5塊磁盤進行一樣的操做。 SQL> select name,path,header_status from v$asm_disk; NAME PATH HEADER_STATU ------------------------------ ------------------------------ ------------ /dev/mapper/mpathc MEMBER /dev/mapper/mpathd MEMBER /dev/mapper/mpathf MEMBER /dev/mapper/mpathb MEMBER /dev/mapper/mpathg MEMBER DATA1_0001 /dev/mapper/mpathh MEMBER DATA1_0002 /dev/mapper/mpathi MEMBER DATA1_0000 /dev/mapper/mpathe MEMBER SQL> alter diskgroup DATA mount; Diskgroup altered. 兩個節點都須要進行mount。 SQL> select name,path,header_status from v$asm_disk; NAME PATH HEADER_STATU ------------------------------ ------------------------------ ------------ DATA_0001 /dev/mapper/mpathc MEMBER DATA_0004 /dev/mapper/mpathd MEMBER DATA_0003 /dev/mapper/mpathf MEMBER DATA_0000 /dev/mapper/mpathb MEMBER DATA1_0001 /dev/mapper/mpathh MEMBER DATA_0002 /dev/mapper/mpathg MEMBER DATA1_0002 /dev/mapper/mpathi MEMBER DATA1_0000 /dev/mapper/mpathe MEMBER 8 rows selected. [grid@RAC1 ~]$ crs_stat -tName Type Target State Host ------------------------------------------------------------ora.DATA.dg ora....up.type ONLINE ONLINE rac1 ora.DATA1.dg ora....up.type ONLINE ONLINE rac1 ora....ER.lsnr ora....er.type ONLINE ONLINE rac1 ora....N1.lsnr ora....er.type ONLINE ONLINE rac1 ora.asm ora.asm.type ONLINE ONLINE rac1 ora.cvu ora.cvu.type ONLINE OFFLINE ora.gsd ora.gsd.type OFFLINE OFFLINE ora....network ora....rk.type ONLINE ONLINE rac1 ora.oc4j ora.oc4j.type ONLINE OFFLINE ora.ons ora.ons.type ONLINE ONLINE rac1 ora....SM1.asm application ONLINE ONLINE rac1 ora....C1.lsnr application ONLINE ONLINE rac1 ora.rac1.gsd application OFFLINE OFFLINE ora.rac1.ons application ONLINE ONLINE rac1 ora.rac1.vip ora....t1.type ONLINE ONLINE rac1 ora.rac2.vip ora....t1.type ONLINE OFFLINE ora....ry.acfs ora....fs.type ONLINE ONLINE rac1 ora.scan1.vip ora....ip.type ONLINE ONLINE rac1