How to Restore the Database Using AMDU after Diskgroup Corruption
Steps:
1. Create pfile of lost database , from database alert.log startup messages.
2. Startup database in nomount
3. Get the controlfile number from db alert log , it will show while starting the database here in this eg. its 256
eg., control_files='+DATA/orcl/controlfile/current.256.709676643'
If you have controlfile backup already in non-asm location edit the pfile to point to location of non-asm and then mount the database
If you dont have controlfile backup then go to step 4 after determining the file# from step 3
4. $ amdu -diskstring -extract DATA.256
5. shutdown the database and change the control_file location to point to the extracted file location
6. startup mount the database
7. once mounted, get the datafile file numbers using "select name from v$datafile"
And get online redo logfile from "select * from v$logfile".
8. Extract all datafiles and redolog files in similar manner
9. alter database rename to < newly extracte location>
10. open the database
2. Startup database in nomount
3. Get the controlfile number from db alert log , it will show while starting the database here in this eg. its 256
eg., control_files='+DATA/orcl/controlfile/current.256.709676643'
If you have controlfile backup already in non-asm location edit the pfile to point to location of non-asm and then mount the database
If you dont have controlfile backup then go to step 4 after determining the file# from step 3
4. $ amdu -diskstring
5. shutdown the database and change the control_file location to point to the extracted file location
6. startup mount the database
7. once mounted, get the datafile file numbers using "select name from v$datafile"
And get online redo logfile from "select * from v$logfile".
8. Extract all datafiles and redolog files in similar manner
9. alter database rename
10. open the database
=======================================================================
ASM tools used by Support : KFOD, KFED, AMDU
DETAILS
1. KFOD - Kernel Files OSM Disk
KFOD utility is used to simulate the disk discovery from the operating system level and it can be found in $GRID_HOME/bin directory (or ASM_HOME/bin in older releases).Note:
1) KFOD is used at installation time as well (by OUI,DBCA or ASMCA) in order to perform disk discovery.
2) In case of a failed installation (e.g no $GRID_HOME/bin existing yet) KFOD can be found under your stage folder:
In such cases you might need to set LD_LIBRARY_PATH to
Help screen can be seen using:
$> kfod help=y
_asm_a/llow_only_raw_disks KFOD allow only raw devices [_asm_allow_only_raw_disks=TRUE/(FALSE)]
_asm_l/ibraries ASM Libraries[_asm_libraries='lib1','lib2',...]
_asms/id ASM Instance[_asmsid=sid]
a/sm_diskstring ASM Diskstring [asm_diskstring='discoverystring', 'discoverystring' ...]
d/isks Disks to discover [disks=raw,asm,all]
g/roup Group discover [group=controlfile]
n/ohdr KFOD header suppression [nohdr=TRUE/(FALSE)]
o/p KFOD options type [OP=DISKS/GROUPS/ALL]
p/file ASM parameter file [pfile='parameterfile']
s/tatus Include disk header status [status=TRUE/(FALSE)]
v/erbose KFOD verbose errors [verbose=TRUE/(FALSE)]
_asm_a/llow_only_raw_disks KFOD allow only raw devices [_asm_allow_only_raw_disks=TRUE/(FALSE)]
_asm_l/ibraries ASM Libraries[_asm_libraries='lib1','lib2',...]
_asms/id ASM Instance[_asmsid=sid]
a/sm_diskstring ASM Diskstring [asm_diskstring='discoverystring', 'discoverystring' ...]
d/isks Disks to discover [disks=raw,asm,all]
g/roup Group discover [group=controlfile]
n/ohdr KFOD header suppression [nohdr=TRUE/(FALSE)]
o/p KFOD options type [OP=DISKS/GROUPS/ALL]
p/file ASM parameter file [pfile='parameterfile']
s/tatus Include disk header status [status=TRUE/(FALSE)]
v/erbose KFOD verbose errors [verbose=TRUE/(FALSE)]
The usual syntax used for disk discovery is:
kfod status=TRUE asm_diskstring='' disk=ALL
$ export LD_LIBRARY_PATH=/u01/stage/11.2.0.1/grid/stage/ext/lib
$ /u01/stage/11.2.0.1/grid/stage/ext/bin/kfod status=TRUE asm_diskstring='/dev/rdsk/*' disk=all dscvgroup=TRUE
--------------------------------------------------------------------------------
Disk Size Header Path Disk Group User Group
================================================================================
1: 10040 Mb MEMBER /dev/rdsk/c0t600144F0E08ACF0000004C2F6FBB0005d0s1 DG oracle oinstall
2: 10040 Mb MEMBER /dev/rdsk/c0t600144F0E08ACF0000004C2F6FBC0006d0s1 DG oracle oinstall
3: 10142 Mb MEMBER /dev/rdsk/c0t600144F0E08ACF0000004C2F6FBE0007d0s1 DG oracle oinstall
4: 10142 Mb MEMBER /dev/rdsk/c0t600144F0E08ACF0000004C2F6FBF0008d0s1 DG oracle oinstall
5: 9734 Mb MEMBER /dev/rdsk/c0t600144F0E08ACF0000004C2F6FC00009d0s1 FRA oracle oinstall
--------------------------------------------------------------------------------
$ /u01/stage/11.2.0.1/grid/stage/ext/bin/kfod status=TRUE asm_diskstring='/dev/rdsk/*' disk=all dscvgroup=TRUE
--------------------------------------------------------------------------------
Disk Size Header Path Disk Group User Group
================================================================================
1: 10040 Mb MEMBER /dev/rdsk/c0t600144F0E08ACF0000004C2F6FBB0005d0s1 DG oracle oinstall
2: 10040 Mb MEMBER /dev/rdsk/c0t600144F0E08ACF0000004C2F6FBC0006d0s1 DG oracle oinstall
3: 10142 Mb MEMBER /dev/rdsk/c0t600144F0E08ACF0000004C2F6FBE0007d0s1 DG oracle oinstall
4: 10142 Mb MEMBER /dev/rdsk/c0t600144F0E08ACF0000004C2F6FBF0008d0s1 DG oracle oinstall
5: 9734 Mb MEMBER /dev/rdsk/c0t600144F0E08ACF0000004C2F6FC00009d0s1 FRA oracle oinstall
--------------------------------------------------------------------------------
2. KFED - Kernel Files metadata EDitor
KFED is a useful tool which allows to analyze ASM disk header information when ASM diskgroups can not be mounted.Note 1180491.1 - KFED Tool For Windows OS. Note 1346190.1 - KFED.PL for diagnosing - ORA-15036 ORA-15042 ORA-15020 ORA-15033 NOTE:
KFED executable comes with installation from 11.1 onwards; for the older version you must build it.
But it is not included the source of the software, therefore it is not available until GI installation completes.
If you need to use it before GI being installed, please refer
Note 1505005.1 - Where to find kfed utility before Oracle Grid Infrastructure is installed
Help screen can be seen using:
$>kfed help=y
as/mlib ASM Library [asmlib='lib']
aun/um AU number to examine or update [AUNUM=number]
aus/z Allocation Unit size in bytes [AUSZ=number]
blkn/um Block number to examine or update [BLKNUM=number]
blks/z Metadata block size in bytes [BLKSZ=number]
ch/ksum Update checksum before each write [CHKSUM=YES/NO]
cn/t Count of AUs to process [CNT=number]
de/v ASM device to examine or update [DEV=string]
dm/pall Don't suppress repeated lines when dumping corrupt blocks [DMPALL=YES/NO]
o/p KFED operation type [OP=READ/WRITE/MERGE/REPAIR/NEW/FORM/FIND/STRUCT]
p/rovnm Name for provisioning purposes [PROVNM=string]
s/eek AU number to seek to [SEEK=number]
te/xt File name for translated block text [TEXT=string]
ty/pe ASM metadata block type number [TYPE=number]
as/mlib ASM Library [asmlib='lib']
aun/um AU number to examine or update [AUNUM=number]
aus/z Allocation Unit size in bytes [AUSZ=number]
blkn/um Block number to examine or update [BLKNUM=number]
blks/z Metadata block size in bytes [BLKSZ=number]
ch/ksum Update checksum before each write [CHKSUM=YES/NO]
cn/t Count of AUs to process [CNT=number]
de/v ASM device to examine or update [DEV=string]
dm/pall Don't suppress repeated lines when dumping corrupt blocks [DMPALL=YES/NO]
o/p KFED operation type [OP=READ/WRITE/MERGE/REPAIR/NEW/FORM/FIND/STRUCT]
p/rovnm Name for provisioning purposes [PROVNM=string]
s/eek AU number to seek to [SEEK=number]
te/xt File name for translated block text [TEXT=string]
ty/pe ASM metadata block type number [TYPE=number]
$> kfed read
$> kfed read /dev/raw/raw1
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: T=0 NUMB=0x0
kfbh.block.obj: 2147483648 ; 0x008: TYPE=0x8 NUMB=0x0
kfbh.check: 2932902794 ; 0x00c: 0xaed08b8a
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: ASM01_0000 ; 0x028: length=10
kfdhdb.grpname: ASM01 ; 0x048: length=5
kfdhdb.fgname: ASM01_0000 ; 0x068: length=10
kfdhdb.capname: ; 0x088: length=0
kfdhdb.crestmp.hi: 32837774 ; 0x0a8: HOUR=0xe DAYS=0x4 MNTH=0x4 YEAR=0x7d4
kfdhdb.crestmp.lo: 1555722240 ; 0x0ac: USEC=0x0 MSEC=0x29c SECS=0xb MINS=0x17
kfdhdb.mntstmp.hi: 32837774 ; 0x0b0: HOUR=0xe DAYS=0x4 MNTH=0x4 YEAR=0x7d4
kfdhdb.mntstmp.lo: 1563864064 ; 0x0b4: USEC=0x0 MSEC=0x1ab SECS=0x13 MINS=0x17
...
kfdhdb.ub4spare[60]: 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
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: T=0 NUMB=0x0
kfbh.block.obj: 2147483648 ; 0x008: TYPE=0x8 NUMB=0x0
kfbh.check: 2932902794 ; 0x00c: 0xaed08b8a
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: ASM01_0000 ; 0x028: length=10
kfdhdb.grpname: ASM01 ; 0x048: length=5
kfdhdb.fgname: ASM01_0000 ; 0x068: length=10
kfdhdb.capname: ; 0x088: length=0
kfdhdb.crestmp.hi: 32837774 ; 0x0a8: HOUR=0xe DAYS=0x4 MNTH=0x4 YEAR=0x7d4
kfdhdb.crestmp.lo: 1555722240 ; 0x0ac: USEC=0x0 MSEC=0x29c SECS=0xb MINS=0x17
kfdhdb.mntstmp.hi: 32837774 ; 0x0b0: HOUR=0xe DAYS=0x4 MNTH=0x4 YEAR=0x7d4
kfdhdb.mntstmp.lo: 1563864064 ; 0x0b4: USEC=0x0 MSEC=0x1ab SECS=0x13 MINS=0x17
...
kfdhdb.ub4spare[60]: 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
1) KFED returns a readable output only when devices are/were part of an ASM diskgroup.
Otherwise (if the device hasn't been added to a diskgroup yet or the disk is not valid anymore) the output looks like:
KFED-00322: Invalid content encountered during block traversal: [kfbtTraverseBlock][Invalid OSM block type][][0]
2) In case of a non-default AU size, you should specify it in the command:
$> kfed read
3. AMDU - ASM Metadata Dump Utility
AMDU is an utility to extract all the available metadata from one or more ASM disks and/or generate formatted printouts of individual blocks.The utility does not require that any diskgroup to be mounted.Oracle Support may ask you to provide AMDU output, especially when facing internal errors related to the ASM metadata
NOTE:
AMDU executable comes with installation from 11.1 onwards. Although this tool was released with 11g, it can be used with ASM 10g as well.
Note 553639.1 - Placeholder for AMDU binaries and using with ASM 10g The usual syntax used for dumping metadata related to a diskgroup is:
$> amdu -diskstring ''
NOTE:Every time AMDU is executed a directory is created on the current location, unless it is override by parameter -directory.
The directory will have the format amdu_YYYY_MM_DD_HH24_MM_SS
The default command will generate following files:
report.txt - include details about the disks scanned
The report.txt file shows the header info of the disks belonging to diskgroup, like below:
EXAMPLE:
$> amdu -diskstring '/dev/raw/raw*' -dump 'DG11'
--------------------------------------------------------------------------------
----------------------------- DISK REPORT N0003 ---------------------------
Disk Path: /dev/raw/raw3
Physical Sector Size: 512 bytes
Disk Size: 977 megabytes
Group Name: DG11
Disk Name: DG11_0000
Failure Group Name: DG11_0000
----------------------------- DISK REPORT N0004 ---------------------------
Disk Path: /dev/raw/raw4
Physical Sector Size: 512 bytes
Disk Size: 978 megabytes
Group Name: DG11
Disk Name: DG11_0001
Failure Group Name: DG11_0001
--------------------------------------------------------------------------------
----------------------------- DISK REPORT N0003 ---------------------------
Disk Path: /dev/raw/raw3
Physical Sector Size: 512 bytes
Disk Size: 977 megabytes
Group Name: DG11
Disk Name: DG11_0000
Failure Group Name: DG11_0000
----------------------------- DISK REPORT N0004 ---------------------------
Disk Path: /dev/raw/raw4
Physical Sector Size: 512 bytes
Disk Size: 978 megabytes
Group Name: DG11
Disk Name: DG11_0001
Failure Group Name: DG11_0001
Vfrigcomtracyu Donald Langford https://wakelet.com/wake/k5JKwuA3kY65VkI4fATVr
ReplyDeletetokaridreels