ASM系列工具之二:AMDU恢复ASM磁盘组数据

已有 1646 次阅读2012-8-7 18:29 | 工具

在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
* Additional platforms will be added

通过amdu -h可以查看详细的帮助说明,缺省的调用amdu,会自动生成一个以时间命名的目录,该目录下生成的报告文件会记录磁盘组的相关信息:

  1. [oracle@enmou1 ~]$ amdu
  2. amdu_2011_03_29_10_28_41/
  3. [oracle@enmou1 ~]$ cd amdu_2011_03_29_10_28_41/
  4. [oracle@enmou1 amdu_2011_03_29_10_28_41]$ ls
  5. report.txt

该报告的主要内容如下:

  1. [oracle@enmou1 amdu_2011_03_29_10_28_41]$ more report.txt
  2. -*-amdu-*-
  3. ******************************* AMDU Settings
    ********************************
  4. ORACLE_HOME = /u01/app/db/11.2.0
  5. System name: Linux
  6. Node name: enmou1
  7. Release: 2.6.18-128.el5
  8. Version: #1 SMP Wed Dec 17 11:41:38 EST 2008
  9. Machine: x86_64
  10. amdu run: 29-MAR-11 10:28:41
  11. Endianess: 1
  12. --------------------------------- Operations
    ---------------------------------
  13. ********************************* DISCOVERY *
    *********************************
  14. ----------------------------- DISK REPORT N0001
    ------------------------------
  15. Disk Path: ORCL:VOL1
  16. Unique Disk ID:
  17. Disk Label: VOL1
  18. Physical Sector Size: 512 bytes
  19. Disk Size: 1954 megabytes
  20. Group Name: CRSDG
  21. Disk Name: VOL1
  22. Failure Group Name: VOL1
  23. Disk Number: 0
  24. Header Status: 3
  25. Disk Creation Time: 2011/03/17 11:39:10.772000
  26. Last Mount Time: 2011/03/29 09:21:38.608000
  27. Compatibility Version: 0x0b200000(11020000)
  28. Disk Sector Size: 512 bytes
  29. Disk size in AUs: 1954 AUs
  30. Group Redundancy: 1
  31. Metadata Block Size: 4096 bytes
    -〉元数据块大小,4K
  32. AU Size: 1048576 bytes -〉AU大小:1M
  33. Stride: 113792 AUs
  34. Group Creation Time: 2011/03/17 11:39:10.671000
  35. File 1 Block 1 location: AU 2
    -〉文件使用,从AU 2开始
  36. OCR Present: NO
  37. ******************************* END OF REPORT **
    ******************************

定义特定的参数可以获得ASM磁盘组内部的区间分配等详细信息。以下命令指定转储CRSDG的磁盘组信息,除了报告文件外,还生成了map和img信息文件:

  1. [oracle@enmou1 ~]$ amdu -diskstring '/
    dev/oracleasm/disks/VOL*' -dump 'CRSDG'
  2. amdu_2011_03_29_10_36_03/
  3. [oracle@enmou1 ~]$ cd amdu_2011_03_29_10_36_03/
  4. [oracle@enmou1 amdu_2011_03_29_10_36_03]$ ls
  5. CRSDG_0001.img CRSDG.map report.txt

这里MAP文件的信息如下,其内容描述了ASM元数据在磁盘组中的位置,最后部分就是指针信息:

  1. [oracle@enmou1 amdu_2011_03_29_10_36_03]$ more CRSDG.map
  2. N0001 D0000 R00 A00000000 F00000000 I0 E00000000
    U00 C00256 S0001 B0000000000
  3. N0001 D0000 R00 A00000001 F00000000 I0 E00000000
    U00 C00256 S0001 B0001048576
  4. N0001 D0000 R00 A00000002 F00000001 I0 E00000000
    U00 C00256 S0001 B0002097152
  5. N0001 D0000 R00 A00000003 F00000002 I0 E00000000
    U00 C00256 S0001 B0003145728
  6. N0001 D0000 R00 A00000004 F00000003 I0 E00000000
    U00 C00256 S0001 B0004194304
而IMG文件则是元数据块的镜像转储,为二进制文件,这些文件在ASM出现故障时,可以用于收集信息,分析故障。

使用AMDU恢复ASM磁盘组中的文件,只需要一个命令:

extr/act Files to extract
-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.

 

指定磁盘组和文件号即可恢复ASM磁盘组中的文件,以下是为用户恢复数据的过程日志记录:

[grid@svr06 /amdu_data]$ amdu -extract DG_DATA.271
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
有效的使用extract选项,Oracle ASM的恢复不再复杂。

路过

鸡蛋

鲜花

握手

雷人

评论 (0 个评论)

facelist

您需要登录后才可以评论 登录 | 加入社区

他的关注

暂无数据
意见
反馈