kfed Recovery mistakenly delete disk group in Oracle

Source: Internet
Author: User
Tags reserved sqlplus


In some cases, may be due to misoperation, not small first drop diskgroup, this time do not be nervous, such a failure, can be a perfect recovery through kfed (data 0 lost). If the related ASM disk is further damaged, then the subsequent recovery is cumbersome, You may need to use the Dul scan disk for salvage recovery and may cause data loss.
Create a Test disk group Xifenfei
[Grid@xifenfei ~]$ Sqlplus/as sysasm

Sql*plus:release 11.2.0.4.0 Production on Thu APR 30 15:12:08 2015

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 Automatic Storage Management option

Sql> select Name,path,header_status from V$asm_disk;

NAME PATH Header_statu
------------------------------ ------------------------------ ------------
/DEV/ASM-DISK3 candidate
DATA_0000/DEV/ASM-DISK1 Member
DATA_0001/DEV/ASM-DISK2 Member

sql> Create DiskGroup Xifenfei external redundancy disk '/DEV/ASM-DISK3 ';

DiskGroup created.

Sql> select Name,path,header_status from V$asm_disk;

NAME PATH Header_statu
------------------------------ ------------------------------ ------------
XIFENFEI_0000/DEV/ASM-DISK3 Member
DATA_0000/DEV/ASM-DISK1 Member
DATA_0001/DEV/ASM-DISK2 Member
Create a disk group using the/DEV/ASM-DISK3 disk Xifenfei

Create a table, stored in a Xifenfei disk group
[Oracle@xifenfei ~]$ Sqlplus/as SYSDBA

Sql*plus:release 11.2.0.4.0 Production on Thu APR 30 15:14:55 2015

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 partitioning, Automatic Storage Management, OLAP, Data Mining
and real Application testing options

sql> Create tablespace Xifenfei datafile ' +xifenfei ' size 100M;

Tablespace created.

Sql> select name from V$datafile;

NAME
--------------------------------------------------------------------------------
+data/xifenfei/datafile/system.256.878224279
+data/xifenfei/datafile/sysaux.257.878224279
+data/xifenfei/datafile/undotbs1.258.878224279
+data/xifenfei/datafile/users.259.878224279
+xifenfei/xifenfei/datafile/xifenfei.256.878397315

Sql> CREATE TABLE T_xifenfei tablespace Xifenfei
2 AS SELECT * from Dba_objects;

Table created.

Sql> Select COUNT (*) from T_xifenfei;

COUNT (*)
----------
86259
To implement table Xifenfei in a test disk group by creating a table space in a disk group

Attempt to delete a disk group Xifenfei
sql> drop DiskGroup Xifenfei;
Drop DiskGroup Xifenfei
*
ERROR at line 1:
Ora-15039:diskgroup not dropped
Ora-15053:diskgroup "Xifenfei" contains existing files

Sql> drop DiskGroup Xifenfei including contents;
Drop DiskGroup Xifenfei including contents
*
ERROR at line 1:
Ora-15039:diskgroup not dropped
Ora-15027:active Use the DiskGroup "Xifenfei" precludes its dismount


[Grid@xifenfei ~]$ Asmcmd
Asmcmd> lsof
Db_name instance_name Path
Xifenfei Xifenfei +data/xifenfei/controlfile/current.260.878224379
Xifenfei Xifenfei +data/xifenfei/datafile/sysaux.257.878224279
Xifenfei Xifenfei +data/xifenfei/datafile/system.256.878224279
Xifenfei Xifenfei +data/xifenfei/datafile/undotbs1.258.878224279
Xifenfei Xifenfei +data/xifenfei/datafile/users.259.878224279
Xifenfei Xifenfei +data/xifenfei/onlinelog/group_1.261.878224381
Xifenfei Xifenfei +data/xifenfei/onlinelog/group_2.262.878224383
Xifenfei Xifenfei +data/xifenfei/onlinelog/group_3.263.878224385
Xifenfei Xifenfei +data/xifenfei/tempfile/temp.264.878224395
Xifenfei Xifenfei +xifenfei/xifenfei/datafile/xifenfei.256.878397315
The disk group could not be deleted because the Xifenfei disk group was used by the instance, reporting ORA-15027 error
The disk group could not be deleted because there are files in the Xifenfei disk group, ORA-15053 error
If these two prevent you from accidentally deleting a disk group warning still can't save you, then I'm not good enough to say what, can just as I continue down

Close the database instance and delete the disk group
sql> shutdown Immediate
Database closed.
Database dismounted.
ORACLE instance shut down.

sql> drop DiskGroup Xifenfei;
Drop DiskGroup Xifenfei
*
ERROR at line 1:
Ora-15039:diskgroup not dropped
Ora-15053:diskgroup "Xifenfei" contains existing files


Sql> drop DiskGroup Xifenfei including contents;

DiskGroup dropped.


Sql> select Name,path,header_status from V$asm_disk;

NAME PATH Header_statu
------------------------------ ------------------------------ ------------
/DEV/ASM-DISK3 FORMER
DATA_0000/DEV/ASM-DISK1 Member
DATA_0001/DEV/ASM-DISK2 Member

Sql> alter DiskGroup Xifenfei Mount;
Alter DiskGroup Xifenfei Mount
*
ERROR at line 1:
Ora-15032:not all alterations performed
Ora-15017:diskgroup "Xifenfei" cannot be mounted
Ora-15063:asm discovered a insufficient number of disks for DiskGroup
"Xifenfei"
After the disk group has been drop, the Mount,mount times ORA-15063 not work.

kfed Recovery Delete Disk Group
[Grid@xifenfei ~]$ kfed read/dev/asm-disk3 >/tmp/disk3-0-0
[Grid@xifenfei ~]$ kfed read/dev/asm-disk3 blkn=1 >/tmp/disk3-0-1
[Grid@xifenfei ~]$ kfed read/dev/asm-disk3 aun=1 >/tmp/disk3-1-0
Modify the partial values in these/tmp/disk3-* by VI
[Grid@xifenfei ~]$ kfed merge/dev/asm-disk3 text=/tmp/disk3-0-0
[Grid@xifenfei ~]$ kfed merge/dev/asm-disk3 blkn=1 text=/tmp/disk3-0-1
[Grid@xifenfei ~]$ kfed merge/dev/asm-disk3 aun=1 text=/tmp/disk3-1-0
Query for ASM disk after repair
Sql> Col path for A30
Sql> Set Lines 150
Sql> select Name,path,header_status from V$asm_disk;

NAME PATH Header_statu
------------------------------ ------------------------------ ------------
/DEV/ASM-DISK3 Member
DATA_0000/DEV/ASM-DISK1 Member
DATA_0001/DEV/ASM-DISK2 Member
Try Mount Xifenfei Disk Group
Sql> alter DiskGroup Xifenfei Mount;

DiskGroup altered.

Sql> select Name,path,header_status from V$asm_disk;

NAME PATH Header_statu
------------------------------ ------------------------------ ------------
XIFENFEI_0000/DEV/ASM-DISK3 Member
DATA_0000/DEV/ASM-DISK1 Member
DATA_0001/DEV/ASM-DISK2 Member
Test disk group after recovery
Sql> Startup
ORACLE instance started.

Total System Global area 952020992 bytes
Fixed Size 2258960 bytes
Variable Size 306186224 bytes
Database buffers 637534208 bytes
Redo buffers 6041600 bytes
Database mounted.
Database opened.
Sql> Select COUNT (*) from T_xifenfei;

COUNT (*)
----------
86259
This shows that when the disk group is mistakenly deleted, immediately stop further damage, you can through the kfed for a perfect recovery

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.