« Oracle数据恢复:异常中断的操作都很危险 | Blog首页 | Reconnect device Samsung Kies (PC studio) mode »
Oracle数据恢复:AMDU恢复ASM磁盘组数据
链接:https://www.eygle.com/archives/2012/03/asm_amdu_recovery.html
在Oracle 10g中,ASM磁盘组的信息需要在Mount之后才能通过内部视图查询,如果磁盘组因为故障无法正常加载,那么信息将不可用,这为诊断带来了诸多不便。
从Oracle 11g开始,Oracle提供了一个工具AMDU用于协助诊断,通过这个工具可以在磁盘组加载之前将ASM的元数据抽取出来,用于数据库诊断,这个工具可以向后兼容,引入到10g中。AMDU工具也可以用于直接从ASM磁盘组中抽取数据文件,这位ASM的数据恢复提供了极大的便利。我们最近使用这个工具帮助用户挽救了崩溃的数据库。当ASM出现故障时,AMDU就开始大有用武之地。
从MOS上可以下载Oracle 10g版本的AMDU ( Note: 553639.1 ) 工具。
Platform |
|
---|---|
Linux X86 (Platform 46) |
amdu_lnx_32.zip |
Linux X86-64 AMD64/EM64T (Platform 226) |
amdu_lnx_X86-64.zip |
Solaris 10 Sparc 64bit (Platform 23) |
amdu_solaris10_64.zip |
Solaris 9 Sparc 64bit (Platform 23) |
amdu_solaris9_64.zip |
HP-UX PA-RISC 64bits (Platform 59) |
amdu_HP-PARISC.zip |
HP-UX Itanium (Platform 197) |
amdu_hp_itanium.zip |
AIX |
amdu_aix.zip |
通过amdu -h可以查看详细的帮助说明,缺省的调用amdu,会自动生成一个以时间命名的目录,该目录下生成的报告文件会记录磁盘组的相关信息:
- [oracle@enmou1 ~]$ amdu
- amdu_2011_03_29_10_28_41/
- [oracle@enmou1 ~]$ cd amdu_2011_03_29_10_28_41/
- [oracle@enmou1 amdu_2011_03_29_10_28_41]$ ls
- report.txt
该报告的主要内容如下:
- [oracle@enmou1 amdu_2011_03_29_10_28_41]$ more report.txt
- -*-amdu-*-
- ******************************* AMDU Settings
********************************- ORACLE_HOME = /u01/app/db/11.2.0
- System name: Linux
- Node name: enmou1
- Release: 2.6.18-128.el5
- Version: #1 SMP Wed Dec 17 11:41:38 EST 2008
- Machine: x86_64
- amdu run: 29-MAR-11 10:28:41
- Endianess: 1
- --------------------------------- Operations
---------------------------------- ********************************* DISCOVERY *
*********************************- ----------------------------- DISK REPORT N0001
------------------------------- Disk Path: ORCL:VOL1
- Unique Disk ID:
- Disk Label: VOL1
- Physical Sector Size: 512 bytes
- Disk Size: 1954 megabytes
- Group Name: CRSDG
- Disk Name: VOL1
- Failure Group Name: VOL1
- Disk Number: 0
- Header Status: 3
- Disk Creation Time: 2011/03/17 11:39:10.772000
- Last Mount Time: 2011/03/29 09:21:38.608000
- Compatibility Version: 0x0b200000(11020000)
- Disk Sector Size: 512 bytes
- Disk size in AUs: 1954 AUs
- Group Redundancy: 1
- Metadata Block Size: 4096 bytes
-〉元数据块大小,4K- AU Size: 1048576 bytes -〉AU大小:1M
- Stride: 113792 AUs
- Group Creation Time: 2011/03/17 11:39:10.671000
- File 1 Block 1 location: AU 2
-〉文件使用,从AU 2开始- OCR Present: NO
- ******************************* END OF REPORT **
******************************
定义特定的参数可以获得ASM磁盘组内部的区间分配等详细信息。以下命令指定转储CRSDG的磁盘组信息,除了报告文件外,还生成了map和img信息文件:
- [oracle@enmou1 ~]$ amdu -diskstring '/
dev/oracleasm/disks/VOL*' -dump 'CRSDG'- amdu_2011_03_29_10_36_03/
- [oracle@enmou1 ~]$ cd amdu_2011_03_29_10_36_03/
- [oracle@enmou1 amdu_2011_03_29_10_36_03]$ ls
- CRSDG_0001.img CRSDG.map report.txt
这里MAP文件的信息如下,其内容描述了ASM元数据在磁盘组中的位置,最后部分就是指针信息:
而IMG文件则是元数据块的镜像转储,为二进制文件,这些文件在ASM出现故障时,可以用于收集信息,分析故障。
- [oracle@enmou1 amdu_2011_03_29_10_36_03]$ more CRSDG.map
- N0001 D0000 R00 A00000000 F00000000 I0 E00000000
U00 C00256 S0001 B0000000000- N0001 D0000 R00 A00000001 F00000000 I0 E00000000
U00 C00256 S0001 B0001048576- N0001 D0000 R00 A00000002 F00000001 I0 E00000000
U00 C00256 S0001 B0002097152- N0001 D0000 R00 A00000003 F00000002 I0 E00000000
U00 C00256 S0001 B0003145728- N0001 D0000 R00 A00000004 F00000003 I0 E00000000
U00 C00256 S0001 B0004194304
使用AMDU恢复ASM磁盘组中的文件,只需要一个命令:
extr/act Files to extract指定磁盘组和文件号即可恢复ASM磁盘组中的文件,以下是为用户恢复数据的过程日志记录:
-extract <diskgroup>.<file_number>: This extracts the numbered file
from the named diskgroup, case insensitive. This option may be
specified multiple times to extract multiple files. The extracted
file is placed in the dump directory under the name
<diskgroup>_<number>.f where <diskgroup> is the diskgroup name
in uppercase, and <number> is the file number. The -output option
may be used to write the file to any location. The extracted file
will appear to have the same contents it would have if accessed
through the database. If some portion of the file is unavailable
then that portion of the output file will be filled with
0xBADFDA7A, and a message will appear on stderr.
[grid@svr06 /amdu_data]$ amdu -extract DG_DATA.271有效的使用extract选项,Oracle ASM的恢复不再复杂。
amdu_2012_02_21_17_53_49/
[grid@svr06 /amdu_data]$ amdu -extract DG_DATA.272
amdu_2012_02_21_17_54_00/
[grid@svr06 /amdu_data]$ amdu -extract DG_DATA.273
amdu_2012_02_21_17_54_29/
[grid@svr06 /amdu_data]$ amdu -extract DG_DATA.274
amdu_2012_02_21_17_55_01/
[grid@svr06 /amdu_data]$ amdu -extract DG_DATA.276
amdu_2012_02_21_17_55_12/
[grid@svr06 /amdu_data]$ amdu -extract DG_DATA.275
amdu_2012_02_21_17_55_23/
[grid@svr06 /amdu_data]$ amdu -extract DG_DATA.277
amdu_2012_02_21_17_55_33/
[grid@svr06 /amdu_data]$ amdu -extract DG_DATA.278
amdu_2012_02_21_17_55_47/
[grid@svr06 /amdu_data]$ amdu -extract DG_DATA.279
amdu_2012_02_21_17_56_01/
[grid@svr06 /amdu_data]$cd amdu_2012_02_21_17_56_01
[grid@svr06 /amdu_data/amdu_2012_02_21_17_56_01]$ls -lt
total 205036
-rw-r--r-- 1 grid oinstall 209723392 Feb 21 17:56 DG_DATA_279.f
-rw-r--r-- 1 grid oinstall 13889 Feb 21 17:56 report.txt
同事曾经记录过的内容:
http://blog.csdn.net/marvelyu/article/details/7296524
历史上的今天...
>> 2011-03-07文章:
>> 2010-03-07文章:
>> 2009-03-07文章:
>> 2008-03-07文章:
>> 2007-03-07文章:
>> 2005-03-07文章:
By eygle on 2012-03-07 08:05 | Comments (0) | Backup&Recovery | 2962 |