Method of completely corrupting recovery of ASM disk Header in Oracle

Source: Internet
Author: User
Tags character set reserved

Test preparation
Create a new table space, create a T_xifenfei test table

The code is as follows Copy Code
sql> Create tablespace Xifenfei datafile ' +xifenfei ' SIZE 50m;





Tablespace created.





sql> CREATE TABLE T_xifenfei tablespace Xifenfei


2 as SELECT * from Dba_objects;





Table created.





Sql> SELECT COUNT (*) from T_xifenfei;





COUNT (*)


----------


50031





Sql> select Ts#,rfile#,bytes/1024/1024,blocks,name from V$datafile;





ts# rfile# bytes/1024/1024 BLOCKS NAME


---------- ---------- --------------- ---------- --------------------------------------------------


0 1 61440 +xifenfei/asm10g/datafile/system.256.845260203


1 2 3200 +xifenfei/asm10g/datafile/undotbs1.258.845260205


2 3 32000 +xifenfei/asm10g/datafile/sysaux.257.845260203


4 4 5 640 +xifenfei/asm10g/datafile/users.259.845260205


6 5 6400 +xifenfei/asm10g/datafile/xifenfei.266.845262139





Sql> select Group_number,disk_number,state,total_mb,free_mb,name,path from V$asm_disk;





Group_number disk_number State total_mb free_mb NAME PATH


------------ ----------- -------- ---------- ---------- -------------------- ------------------


1 0 NORMAL 2048 0 xifenfei_0000/dev/raw/raw1


1 1 NORMAL 784 0 xifenfei_0001/dev/raw/raw2


1 2 NORMAL 7059 0 xifenfei_0002/dev/raw/raw3





--Close the database


sql> shutdown immediate;


Database closed.


Database dismounted.


ORACLE instance shut down.





--Close ASM


sql> shutdown Immediate


ASM diskgroups dismounted


ASM instance shutdown


View the disk for the bare device

The code is as follows Copy Code
[Oracle@xifenfei dul]$ More/etc/sysconfig/rawdevices
/dev/raw/raw1/dev/sdc
/dev/raw/raw2/dev/sdd1
/dev/raw/raw3/dev/sdd2

DD Disk Header

The code is as follows Copy Code
DD ASM Disk Front 10M, completely destroy ASM disk
[Oracle@xifenfei ~]$ dd if=/dev/zero of=/dev/raw/raw1 bs=1m count=10 conv=notrunc
10+0 Records in
10+0 Records out
10485760 bytes (MB) copied, 0.175424 seconds, 59.8 MB/s
[Oracle@xifenfei ~]$ dd if=/dev/zero of=/dev/raw/raw2 bs=1m count=10 conv=notrunc
10+0 Records in
10+0 Records out
10485760 bytes (MB) copied, 0.11584 seconds, 90.5 MB/s
[Oracle@xifenfei ~]$ dd if=/dev/zero of=/dev/raw/raw3 bs=1m count=10 conv=notrunc
10+0 Records in
10+0 Records out
10485760 bytes (MB) copied, 0.353435 seconds, 29.7 MB/s

kfed View Disk
Make sure all ASM disk headers are completely corrupted

The code is as follows Copy Code
[Oracle@xifenfei dul]$ kfed READ/DEV/RAW/RAW1


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


[Oracle@xifenfei dul]$ kfed READ/DEV/RAW/RAW2


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


[Oracle@xifenfei dul]$ kfed READ/DEV/RAW/RAW3


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


Dul view completely corrupted ASM disk header
Test if the ASM disk header is completely corrupted, Dul is also able to implement the extract data from the ASM disks Group

The code is as follows Copy Code
[oracle@xifenfei dul]$./dul
 
Data unloader:10.2.0.5.28-internal only-on Sat Apr 04:02:02 2014
with 64-bit IO fun Ctions
 
Copyright (c) 1994 2014 Bernard van Duijnen All rights reserved.
 
 strictly Oracl e Internal use only
 
 
DUL:Warning:block 0 are not a disk header blocks
DUL:Error:Block is no T in-use
DUL:Error:Block type mismatch (seen 0 expect 1) when parsing block 0 of Disk/dev/raw/raw1
 
DUL:Warning:block 0 is isn't a disk header block
DUL:Error:Block isn't in use
DUL:Error:Block type mismatch ( Seen 0 expect 1) when parsing blocks 0 of disk/dev/raw/raw2
 
DUL:Warning:block 0 is not a disk header Blo CK
DUL:Error:Block isn't in use
DUL:Error:Block type mismatch (seen 0 expect 1) when parsing block 0 of disk /DEV/RAW/RAW3

As can be seen here, when the ASM disk header is completely abnormal, the dul is not recognized by the ASM set of disks (in which case Dul does not operate properly)

To scan a disk with a tool to extract blocks of data

The code is as follows Copy Code
Cpfl> Scan DISK/DEV/RAW/RAW1


Scanning disk/dev/raw/raw1, at 2014-04-19 04:05:11


Completed disk/dev/raw/raw1, at 2014-04-19 04:05:56





Cpfl> Scan DISK/DEV/RAW/RAW1


Scanning disk/dev/raw/raw1, at 2014-04-19 04:05:56


Completed disk/dev/raw/raw1, at 2014-04-19 04:06:15





Cpfl> Scan DISK/DEV/RAW/RAW1


Scanning disk/dev/raw/raw1, at 2014-04-19 04:06:15


Completed disk/dev/raw/raw1, at 2014-04-19 04:07:44





Cpfl> list Datafiles


Tablespace:system file:1 blocks:61440


TABLESPACE:UNDOTBS1 File:2 blocks:3200


Tablespace:sysaux File:3 blocks:32000


Tablespace:users File:4 blocks:640


Tablespace:xifenfei File:5 blocks:6400





cpfl> copy datafile 1 to/u01/oracle/oradata/asmfile/1.dbf


Copy datafile start:2014-04-19 04:10:35


Copy datafile 1 have blocks 61440


Copy datafile completed:2014-04-19 04:11:18





cpfl> Copy datafile 2 to/u01/oracle/oradata/asmfile/2.dbf


Copy datafile start:2014-04-19 04:11:52


Copy datafile 2 have blocks 3200


Copy datafile completed:2014-04-19 04:11:54





Cpfl> copy datafile 3 to/u01/oracle/oradata/asmfile/3.dbf


Copy datafile start:2014-04-19 04:12:03


Copy datafile 3 have blocks 32000


Copy datafile completed:2014-04-19 04:12:27





cpfl> copy datafile 4 to/u01/oracle/oradata/asmfile/4.dbf


Copy datafile start:2014-04-19 04:13:07


Copy datafile 4 have blocks 640


Copy datafile completed:2014-04-19 04:13:08





cpfl> copy datafile 5 to/u01/oracle/oradata/asmfile/5.dbf


Copy datafile start:2014-04-19 04:13:18


Copy datafile 5 have blocks 6400


Copy datafile completed:2014-04-19 04:13:19


View using tools to extract data files

The code is as follows Copy Code
[Oracle@xifenfei asmfile]$ Ls-l
Total 830320
-rw-r--r--1 Oracle oinstall 503324672 APR 04:34 1.dbf
-rw-r--r--1 Oracle oinstall 26222592 APR 04:34 2.dbf
-rw-r--r--1 Oracle oinstall 262152192 APR 04:34 3.dbf
-rw-r--r--1 Oracle oinstall 5251072 APR 04:34 4.dbf
-rw-r--r--1 Oracle oinstall 52436992 APR 04:34 5.dbf

Dul Verification Extract File

The code is as follows Copy Code
[Oracle@xifenfei dul]$./dul





Data unloader:10.2.0.5.28-internal only-on Sat APR 19 06:56:09 2014


With 64-bit IO functions





Copyright (c) 1994 2014 Bernard van Duijnen all rights reserved.





Strictly Oracle Internal Use only








DUL:Warning:Recreating file "Dul.log"


Found db_id = 181793355


Found db_name = asm10g





Dul> show Datafiles;


ts# rf# Start blocks offs Open Err file name


0 1 0 61440 0 1 0/u01/oracle/oradata/asmfile/1.dbf


1 2 0 3200 0 1 0/u01/oracle/oradata/asmfile/2.dbf


2 3 0 32000 0 1 0/u01/oracle/oradata/asmfile/3.dbf


4 4 0 640 0 1 0/u01/oracle/oradata/asmfile/4.dbf


6 5 0 6400 0 1 0/u01/oracle/oradata/asmfile/5.dbf


Dul> Bootstrap;


Probing file = 1, block = 377


. Unloading table bootstrap$


DUL:Warning:block number is non zero but marked deferred trying to process it anyhow


Rows unloaded


DUL:Warning:Dictionary Cache Dc_bootstrap is empty


Reading BOOTSTRAP.dat Entries Loaded


Parsing bootstrap$ Contents


DUL:Warning:Recreating file "Dict.ddl"


Generating DICT.DDL for version 10


obj$: Segobjno, file 1 Block 121


tab$: Segobjno 2, tabno 1, file 1 Block 25


col$: Segobjno 2, tabno 5, file 1 Block 25


user$: Segobjno, tabno 1, file 1 block 89


Running generated file "@dict. DDL" to unload the dictionary tables


. Unloading table obj$ 51171 rows unloaded


. Unloading table tab$ 1576 rows unloaded


. Unloading table col$ 55264 rows unloaded


. Unloading table user$ rows unloaded


Reading USER.dat Entries Loaded


Reading OBJ.dat 51171 entries loaded and sorted 51171 entries


Reading TAB.dat 1576 Entries loaded


Reading COL.dat 55264 entries loaded and sorted 55264 entries


Reading BOOTSTRAP.dat Entries Loaded





DUL:Warning:Recreating file "Dict.ddl"


Generating DICT.DDL for version 10


obj$: Segobjno, file 1 Block 121


tab$: Segobjno 2, tabno 1, file 1 Block 25


col$: Segobjno 2, tabno 5, file 1 Block 25


user$: Segobjno, tabno 1, file 1 block 89


tabpart$: Segobjno 266, file 1 block 2121


indpart$: Segobjno 271, file 1 block 2161


tabcompart$: Segobjno, file 1 Block 2297


indcompart$: Segobjno 293, file 1 block 2345


tabsubpart$: Segobjno 278, file 1 block 2217


indsubpart$: Segobjno 283, file 1 Block 2257


ind$: Segobjno 2, tabno 3, file 1 Block 25


icol$: Segobjno 2, tabno 4, file 1 Block 25


lob$: Segobjno 2, tabno 6, file 1 Block 25


coltype$: Segobjno 2, tabno 7, file 1 Block 25


type$: Segobjno 181, Tabno 1, file 1 block 1297


collection$: Segobjno 181, Tabno 2, file 1 block 1297


attribute$: Segobjno 181, Tabno 3, file 1 block 1297


lobfrag$: Segobjno 299, file 1 block 2393


lobcomppart$: Segobjno 302, file 1 block 2425


undo$: Segobjno, file 1 Block 105


ts$: Segobjno 6, Tabno 2, file 1 Block 57


props$: Segobjno, file 1 block 721


Running generated file "@dict. DDL" to unload the dictionary tables


. Unloading table Www.111cn.net obj$


DUL:Warning:Recreating file "Obj.ctl"


51171 rows unloaded


. Unloading table tab$


DUL:Warning:Recreating file "Tab.ctl"


1576 rows unloaded


. Unloading table col$


DUL:Warning:Recreating file "Col.ctl"


55264 Rows unloaded


. Unloading table user$


DUL:Warning:Recreating file "User.ctl"


Unloaded rows


. Unloading table tabpart$ rows unloaded


. Unloading table indpart$ rows unloaded


. Unloading table tabcompart$ 0 rows unloaded


. Unloading table indcompart$ 0 rows unloaded


. Unloading table tabsubpart$ 0 rows unloaded


. Unloading table indsubpart$ 0 rows unloaded


. Unloading table ind$ 2231 rows unloaded


. Unloading table icol$ 3650 rows unloaded


. Unloading table lob$ 530 rows unloaded


. Unloading table coltype$ 1701 rows unloaded


. Unloading table type$ 1945 rows unloaded


. Unloading table collection$ 555 rows unloaded


. Unloading table attribute$ 7275 rows unloaded


. Unloading table lobfrag$ 1 row unloaded


. Unloading table lobcomppart$ 0 rows unloaded


. Unloading table undo$ rows unloaded


. Unloading table ts$ 7 rows unloaded


. Unloading table props$ rows unloaded


Reading USER.dat Entries Loaded


Reading OBJ.dat 51171 entries loaded and sorted 51171 entries


Reading TAB.dat 1576 Entries loaded


Reading COL.dat 55264 entries loaded and sorted 55264 entries


Reading TABPART.dat entries loaded and sorted entries


Reading TABCOMPART.dat 0 Entries loaded and sorted 0 entries


Reading TABSUBPART.dat 0 Entries loaded and sorted 0 entries


Reading INDPART.dat entries loaded and sorted entries


Reading INDCOMPART.dat 0 Entries loaded and sorted 0 entries


Reading INDSUBPART.dat 0 Entries loaded and sorted 0 entries


Reading IND.dat 2231 Entries loaded


Reading LOB.dat 530 Entries loaded


Reading ICOL.dat 3650 Entries loaded


Reading COLTYPE.dat 1701 Entries loaded


Reading TYPE.dat 1945 Entries loaded


Reading ATTRIBUTE.dat 7275 Entries loaded


Reading COLLECTION.dat 555 Entries loaded


Reading BOOTSTRAP.dat Entries Loaded


Reading LOBFRAG.dat 1 entries loaded and sorted 1 entries


Reading LOBCOMPPART.dat 0 Entries loaded and sorted 0 entries


Reading UNDO.dat Entries Loaded


Reading TS.dat 7 Entries loaded


Reading PROPS.dat Entries Loaded


Database Character Set is ZHS16GBK


Database national Character set is AL16UTF16


dul> unload table Sys.t_xifenfei;


. Unloading table T_xifenfei 50031 rows unloaded


It can be found here that we create the test data is 50,031, Dul read extracted data files in the corresponding table data bar number is also 50,031; proof: When the ASM disk header is completely damaged, you can scan the data file to find the datafile in the disk. Block implementation full recovery data [can be recovered by this method as long as the data in your ASM is not overwritten]

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.