Oracle AMDU- ASM Metadata Dump Utility

ASM Metadata Dump Utility,即ASM元数据导出工具,它的简写amdu更被人所熟知,常被Oracle技术支持人员和Oracle开发人员用来诊断和解决ASM故障。它能输出ASM的元数据信息并且从ASM磁盘组中抽取元数据和数据文件。 amdu工具不依赖于ASM实例或者ASM磁盘组的状态,所以它能在ASM实例关闭和磁盘组未挂载的情况下正常使用,它甚至能在ASM磁盘出现故障或者不可见的场景下使用。

使用amdu从mounted磁盘组中抽取控制文件
在接下来的第一个例子中,我们将以一个处于mount状态的磁盘组为例,使用amdu提取数据库jyrac的一个控制文件。通过asmcmd的find命令结合–type参数,指定查找文件类型为controlfile的文件,以下输出列出了所有找到的控制文件的位置

[grid@jyrac1 ~]$  asmcmd find --type controlfile + "*"
+DATADG/JYRAC/CONTROLFILE/current.257.930412709

以上输出我们可以知道,在DATADG磁盘组存放了JYRAC数据库控制文件的一个副本。这里以提取DATA磁盘组的current.257.930412709控制文件为例。首先我们看下DATA磁盘组有哪些磁盘:

[grid@jyrac1 ~]$ asmcmd lsdsk -G DATADG
Path
/dev/raw/raw10
/dev/raw/raw11
/dev/raw/raw3
/dev/raw/raw4

DATADG磁盘组共有四块磁盘/dev/raw/raw10,/dev/raw/raw11,/dev/raw/raw3和/dev/raw/raw4,如果名字都是以ORCL为前缀,那么磁盘是ASMLIB磁盘。严格意义上,并不需要知道具体的磁盘名,只需要查找ASM_DISKSTRING参数值所定义的目录即可。我们接着用amdu工具将控制文件从DATA磁盘组提取到文件系统上:

[grid@jyrac1 ~]$ amdu -diskstring="/dev/raw/*" -extract DATADG.257 -output control.257 -noreport -nodir
AMDU-00204: Disk N0003 is in currently mounted diskgroup DATADG
AMDU-00201: Disk N0003: '/dev/raw/raw11'
AMDU-00204: Disk N0009 is in currently mounted diskgroup DATADG
AMDU-00201: Disk N0009: '/dev/raw/raw4'
AMDU-00204: Disk N0008 is in currently mounted diskgroup DATADG
AMDU-00201: Disk N0008: '/dev/raw/raw3'


[grid@jyrac1 ~]$ ls -lrt control.257 
-rw-r--r-- 1 grid oinstall 18595840 Jan  5 16:03 control.257

此命令相关参数的含义如下:
diskstring: 使用磁盘的全路径或者是ASM_DISKSTRING参数值
extract: 磁盘组名.ASM文件序号
output:提取的输出文件(当前目录下)
noreport:不输出amdu的执行过程
nodir:不创建dump目录

使用amdu从dismounted磁盘组中抽取数据文件
上例中从一个已挂载的磁盘组上提取控制文件的过程简单明了。但在实际工作中,可能有客户提出要求从一个未挂载的磁盘组中提取一个重要数据文件,同时并不知道数据文件名,也没有备份。以下是一个具体的例子,演示了整个操作和分析过程。本例的目标是使用amdu工具从一个不能被挂载的DATA磁盘组中提取一个数据文件,文件名字中包含NSA。这首先意味着在这里sqlplus和asmcmd工具都不能使用。首先使用amdu工具对DATA磁盘组做一份元数据的完整dump。

[grid@jyrac1 ~]$  amdu -dump DATADG -noimage
amdu_2017_01_05_16_09_47/
AMDU-00204: Disk N0003 is in currently mounted diskgroup DATADG
AMDU-00201: Disk N0003: '/dev/raw/raw11'
AMDU-00204: Disk N0009 is in currently mounted diskgroup DATADG
AMDU-00201: Disk N0009: '/dev/raw/raw4'
AMDU-00204: Disk N0008 is in currently mounted diskgroup DATADG
AMDU-00201: Disk N0008: '/dev/raw/raw3'

[grid@jyrac1 ~]$ cd amdu_2017_01_05_16_09_47/
[grid@jyrac1 amdu_2017_01_05_16_09_47]$ 

[grid@jyrac1 amdu_2017_01_05_16_09_47]$ ls -lrt
total 44
-rw-r--r-- 1 grid oinstall 16222 Jan  5 16:09 report.txt
-rw-r--r-- 1 grid oinstall 27520 Jan  5 16:09 DATADG.map

在本例中amdu创建了dump目录并产生了两个文件。report.txt文件包含主机、amdu命令及使用的参数、DATADG磁盘组可能的成员磁盘和这些磁盘上的AU信息。report.txt文件内容如下:

[grid@jyrac1 amdu_2017_01_05_16_09_47]$ more report.txt 
-*-amdu-*-

******************************* AMDU Settings ********************************
ORACLE_HOME = /u01/app/product/11.2.0/crs
System name:    Linux
Node name:      jyrac1
Release:        2.6.18-164.el5
Version:        #1 SMP Tue Aug 18 15:51:48 EDT 2009
Machine:        x86_64
amdu run:       05-JAN-17 16:09:47
Endianess:      1

--------------------------------- Operations ---------------------------------
       -dump DATADG

------------------------------- Disk Selection -------------------------------
 -diskstring ''

------------------------------ Reading Control -------------------------------

------------------------------- Output Control -------------------------------
    -noimage

********************************* DISCOVERY **********************************

----------------------------- DISK REPORT N0001 ------------------------------
                Disk Path: /dev/raw/raw1
           Unique Disk ID: 
               Disk Label: 
     Physical Sector Size: 512 bytes
                Disk Size: 5120 megabytes
               Group Name: CRSDG
                Disk Name: CRSDG_0000
       Failure Group Name: CRSDG_0000
              Disk Number: 0
            Header Status: 3
       Disk Creation Time: 2016/11/22 18:24:35.358000
          Last Mount Time: 2016/12/14 17:02:09.327000
    Compatibility Version: 0x0b200000(11020000)
         Disk Sector Size: 512 bytes
         Disk size in AUs: 5120 AUs
         Group Redundancy: 1
      Metadata Block Size: 4096 bytes
                  AU Size: 1048576 bytes
                   Stride: 113792 AUs
      Group Creation Time: 2016/11/22 18:24:35.079000
  File 1 Block 1 location: AU 2
              OCR Present: YES

----------------------------- DISK REPORT N0002 ------------------------------
                Disk Path: /dev/raw/raw10
           Unique Disk ID: 
               Disk Label: 
     Physical Sector Size: 512 bytes
                Disk Size: 5120 megabytes
               Group Name: DATADG
                Disk Name: DATADG_0000
       Failure Group Name: DATADG_0000
              Disk Number: 3
            Header Status: 3
       Disk Creation Time: 2016/12/12 15:36:39.090000
          Last Mount Time: 2017/01/03 11:54:18.454000
    Compatibility Version: 0x0b200000(11020000)
         Disk Sector Size: 512 bytes
         Disk size in AUs: 5120 AUs
         Group Redundancy: 2
      Metadata Block Size: 4096 bytes
                  AU Size: 1048576 bytes
                   Stride: 113792 AUs
      Group Creation Time: 2016/12/12 15:36:38.488000
  File 1 Block 1 location: AU 0
              OCR Present: NO

----------------------------- DISK REPORT N0003 ------------------------------
                Disk Path: /dev/raw/raw11
           Unique Disk ID: 
               Disk Label: 
     Physical Sector Size: 512 bytes
                Disk Size: 5120 megabytes
               Group Name: DATADG
                Disk Name: DATADG_0001
       Failure Group Name: DATADG_0001
              Disk Number: 0
            Header Status: 3
       Disk Creation Time: 2016/12/12 15:36:39.090000
          Last Mount Time: 2016/12/14 17:02:10.127000
    Compatibility Version: 0x0b200000(11020000)
         Disk Sector Size: 512 bytes
         Disk size in AUs: 5120 AUs
         Group Redundancy: 2
      Metadata Block Size: 4096 bytes
                  AU Size: 1048576 bytes
                   Stride: 113792 AUs
      Group Creation Time: 2016/12/12 15:36:38.488000
  File 1 Block 1 location: AU 2
              OCR Present: NO

----------------------------- DISK REPORT N0004 ------------------------------
                Disk Path: /dev/raw/raw12
           Unique Disk ID: 
               Disk Label: 
     Physical Sector Size: 512 bytes
                Disk Size: 5120 megabytes
               Group Name: USD
                Disk Name: USD_0001
       Failure Group Name: USD_0001
              Disk Number: 1
            Header Status: 3
       Disk Creation Time: 2016/12/30 14:58:59.434000
          Last Mount Time: 2017/01/03 09:57:50.397000
    Compatibility Version: 0x0b200000(11020000)
         Disk Sector Size: 512 bytes
         Disk size in AUs: 5120 AUs
         Group Redundancy: 2
      Metadata Block Size: 4096 bytes
                  AU Size: 1048576 bytes
                   Stride: 113792 AUs
      Group Creation Time: 2016/12/30 14:58:59.213000
  File 1 Block 1 location: AU 1344
              OCR Present: NO

----------------------------- DISK REPORT N0005 ------------------------------
                Disk Path: /dev/raw/raw13
           Unique Disk ID: 
               Disk Label: 
     Physical Sector Size: 512 bytes
                Disk Size: 5120 megabytes
               Group Name: TESTDG
                Disk Name: TESTDG_0004
       Failure Group Name: TESTDG_0004
              Disk Number: 4
            Header Status: 4
       Disk Creation Time: 2016/12/28 16:04:46.242000
          Last Mount Time: 2016/12/28 16:04:57.102000
    Compatibility Version: 0x0a100000(10010000)
         Disk Sector Size: 512 bytes
         Disk size in AUs: 5120 AUs
         Group Redundancy: 2
      Metadata Block Size: 4096 bytes
                  AU Size: 1048576 bytes
                   Stride: 113792 AUs
      Group Creation Time: 2016/12/28 16:04:45.574000
  File 1 Block 1 location: AU 0
              OCR Present: NO

----------------------------- DISK REPORT N0006 ------------------------------
                Disk Path: /dev/raw/raw14
           Unique Disk ID: 
               Disk Label: 
     Physical Sector Size: 512 bytes
                Disk Size: 5120 megabytes
               Group Name: TESTDG
                Disk Name: TESTDG_0005
       Failure Group Name: TESTDG_0005
              Disk Number: 5
            Header Status: 4
       Disk Creation Time: 2016/12/28 16:04:46.242000
          Last Mount Time: 2016/12/28 16:04:57.102000
    Compatibility Version: 0x0a100000(10010000)
         Disk Sector Size: 512 bytes
         Disk size in AUs: 5120 AUs
         Group Redundancy: 2
      Metadata Block Size: 4096 bytes
                  AU Size: 1048576 bytes
                   Stride: 113792 AUs
      Group Creation Time: 2016/12/28 16:04:45.574000
  File 1 Block 1 location: AU 0
              OCR Present: NO

----------------------------- DISK REPORT N0007 ------------------------------
                Disk Path: /dev/raw/raw2
           Unique Disk ID: 
               Disk Label: 
     Physical Sector Size: 512 bytes
                Disk Size: 5120 megabytes
               Group Name: ARCHDG
                Disk Name: ARCHDG_0000
       Failure Group Name: ARCHDG_0000
              Disk Number: 0
            Header Status: 3
       Disk Creation Time: 2016/11/22 19:18:27.892000
          Last Mount Time: 2016/12/14 17:02:08.754000
    Compatibility Version: 0x0b200000(11020000)
         Disk Sector Size: 512 bytes
         Disk size in AUs: 5120 AUs
         Group Redundancy: 2
      Metadata Block Size: 4096 bytes
                  AU Size: 1048576 bytes
                   Stride: 113792 AUs
      Group Creation Time: 2016/11/22 19:18:27.619000
  File 1 Block 1 location: AU 2
              OCR Present: NO

----------------------------- DISK REPORT N0008 ------------------------------
                Disk Path: /dev/raw/raw3
           Unique Disk ID: 
               Disk Label: 
     Physical Sector Size: 512 bytes
                Disk Size: 5120 megabytes
               Group Name: DATADG
                Disk Name: DATADG_0002
       Failure Group Name: DATADG_0002
              Disk Number: 2
            Header Status: 3
       Disk Creation Time: 2016/12/12 15:36:39.090000
          Last Mount Time: 2016/12/14 17:02:10.127000
    Compatibility Version: 0x0b200000(11020000)
         Disk Sector Size: 512 bytes
         Disk size in AUs: 5120 AUs
         Group Redundancy: 2
      Metadata Block Size: 4096 bytes
                  AU Size: 1048576 bytes
                   Stride: 113792 AUs
      Group Creation Time: 2016/12/12 15:36:38.488000
  File 1 Block 1 location: AU 2
              OCR Present: NO

----------------------------- DISK REPORT N0009 ------------------------------
                Disk Path: /dev/raw/raw4
           Unique Disk ID: 
               Disk Label: 
     Physical Sector Size: 512 bytes
                Disk Size: 5120 megabytes
               Group Name: DATADG
                Disk Name: DATADG_0003
       Failure Group Name: DATADG_0003
              Disk Number: 1
            Header Status: 3
       Disk Creation Time: 2016/12/12 15:36:39.090000
          Last Mount Time: 2016/12/14 17:02:10.127000
    Compatibility Version: 0x0b200000(11020000)
         Disk Sector Size: 512 bytes
         Disk size in AUs: 5120 AUs
         Group Redundancy: 2
      Metadata Block Size: 4096 bytes
                  AU Size: 1048576 bytes
                   Stride: 113792 AUs
      Group Creation Time: 2016/12/12 15:36:38.488000
  File 1 Block 1 location: AU 2
              OCR Present: NO

----------------------------- DISK REPORT N0010 ------------------------------
                Disk Path: /dev/raw/raw5
           Unique Disk ID: 
               Disk Label: 
     Physical Sector Size: 512 bytes
                Disk Size: 5120 megabytes
               Group Name: ACFS
                Disk Name: ACFS_0000
       Failure Group Name: ACFS_0000
              Disk Number: 0
            Header Status: 3
       Disk Creation Time: 2016/12/30 09:09:30.242000
          Last Mount Time: 2016/12/30 09:09:41.395000
    Compatibility Version: 0x0b200000(11020000)
         Disk Sector Size: 512 bytes
         Disk size in AUs: 5120 AUs
         Group Redundancy: 2
      Metadata Block Size: 4096 bytes
                  AU Size: 1048576 bytes
                   Stride: 113792 AUs
      Group Creation Time: 2016/12/30 09:09:29.830000
  File 1 Block 1 location: AU 2
              OCR Present: NO

----------------------------- DISK REPORT N0011 ------------------------------
                Disk Path: /dev/raw/raw6
           Unique Disk ID: 
               Disk Label: 
     Physical Sector Size: 512 bytes
                Disk Size: 5120 megabytes
               Group Name: ACFS
                Disk Name: ACFS_0001
       Failure Group Name: ACFS_0001
              Disk Number: 1
            Header Status: 3
       Disk Creation Time: 2016/12/30 09:09:30.242000
          Last Mount Time: 2016/12/30 09:09:41.395000
    Compatibility Version: 0x0b200000(11020000)
         Disk Sector Size: 512 bytes
         Disk size in AUs: 5120 AUs
         Group Redundancy: 2
      Metadata Block Size: 4096 bytes
                  AU Size: 1048576 bytes
                   Stride: 113792 AUs
      Group Creation Time: 2016/12/30 09:09:29.830000
  File 1 Block 1 location: AU 2
              OCR Present: NO

----------------------------- DISK REPORT N0012 ------------------------------
                Disk Path: /dev/raw/raw7
           Unique Disk ID: 
               Disk Label: 
     Physical Sector Size: 512 bytes
                Disk Size: 5120 megabytes
               Group Name: USD
                Disk Name: USD_0000
       Failure Group Name: USD_0000
              Disk Number: 0
            Header Status: 3
       Disk Creation Time: 2016/12/30 14:58:59.434000
          Last Mount Time: 2016/12/30 14:59:10.816000
    Compatibility Version: 0x0b200000(11020000)
         Disk Sector Size: 512 bytes
         Disk size in AUs: 5120 AUs
         Group Redundancy: 2
      Metadata Block Size: 4096 bytes
                  AU Size: 1048576 bytes
                   Stride: 113792 AUs
      Group Creation Time: 2016/12/30 14:58:59.213000
  File 1 Block 1 location: AU 2
              OCR Present: NO

----------------------------- DISK REPORT N0013 ------------------------------
                Disk Path: /dev/raw/raw8
           Unique Disk ID: 
               Disk Label: 
     Physical Sector Size: 512 bytes
                Disk Size: 5120 megabytes
               Group Name: CRSDG
                Disk Name: CRSDG_0001
       Failure Group Name: CRSDG_0001
              Disk Number: 1
            Header Status: 3
       Disk Creation Time: 2016/11/22 18:24:35.358000
          Last Mount Time: 2016/12/14 17:02:09.327000
    Compatibility Version: 0x0b200000(11020000)
         Disk Sector Size: 512 bytes
         Disk size in AUs: 5120 AUs
         Group Redundancy: 1
      Metadata Block Size: 4096 bytes
                  AU Size: 1048576 bytes
                   Stride: 113792 AUs
      Group Creation Time: 2016/11/22 18:24:35.079000
  File 1 Block 1 location: AU 0
              OCR Present: NO

----------------------------- DISK REPORT N0014 ------------------------------
                Disk Path: /dev/raw/raw9
           Unique Disk ID: 
               Disk Label: 
     Physical Sector Size: 512 bytes
                Disk Size: 5120 megabytes
               Group Name: ARCHDG
                Disk Name: ARCHDG_0001
       Failure Group Name: ARCHDG_0001
              Disk Number: 1
            Header Status: 3
       Disk Creation Time: 2016/11/22 19:18:27.892000
          Last Mount Time: 2016/12/14 17:02:08.754000
    Compatibility Version: 0x0b200000(11020000)
         Disk Sector Size: 512 bytes
         Disk size in AUs: 5120 AUs
         Group Redundancy: 2
      Metadata Block Size: 4096 bytes
                  AU Size: 1048576 bytes
                   Stride: 113792 AUs
      Group Creation Time: 2016/11/22 19:18:27.619000
  File 1 Block 1 location: AU 2
              OCR Present: NO

***************** Slept for 6 seconds waiting for heartbeats *****************

************************* SCANNING DISKGROUP DATADG **************************
            Creation Time: 2016/12/12 15:36:38.488000
         Disks Discovered: 4
               Redundancy: 2
                  AU Size: 1048576 bytes
      Metadata Block Size: 4096 bytes
     Physical Sector Size: 512 bytes
          Metadata Stride: 113792 AU
   Duplicate Disk Numbers: 0


---------------------------- SCANNING DISK N0003 -----------------------------
Disk N0003: '/dev/raw/raw11'
AMDU-00204: Disk N0003 is in currently mounted diskgroup DATADG
AMDU-00201: Disk N0003: '/dev/raw/raw11'
** HEARTBEAT DETECTED **
           Allocated AU's: 1737
                Free AU's: 3383
       AU's read for dump: 83
       Block images saved: 19712
        Map lines written: 83
          Heartbeats seen: 1
  Corrupt metadata blocks: 0
        Corrupt AT blocks: 0


---------------------------- SCANNING DISK N0009 -----------------------------
Disk N0009: '/dev/raw/raw4'
AMDU-00204: Disk N0009 is in currently mounted diskgroup DATADG
AMDU-00201: Disk N0009: '/dev/raw/raw4'
** HEARTBEAT DETECTED **
           Allocated AU's: 1734
                Free AU's: 3386
       AU's read for dump: 85
       Block images saved: 20488
        Map lines written: 85
          Heartbeats seen: 1
  Corrupt metadata blocks: 0
        Corrupt AT blocks: 0


---------------------------- SCANNING DISK N0008 -----------------------------
Disk N0008: '/dev/raw/raw3'
AMDU-00204: Disk N0008 is in currently mounted diskgroup DATADG
AMDU-00201: Disk N0008: '/dev/raw/raw3'
** HEARTBEAT DETECTED **
           Allocated AU's: 1733
                Free AU's: 3387
       AU's read for dump: 89
       Block images saved: 21256
        Map lines written: 89
          Heartbeats seen: 1
  Corrupt metadata blocks: 0
        Corrupt AT blocks: 0


---------------------------- SCANNING DISK N0002 -----------------------------
Disk N0002: '/dev/raw/raw10'
           Allocated AU's: 1740
                Free AU's: 3380
       AU's read for dump: 87
       Block images saved: 20487
        Map lines written: 87
          Heartbeats seen: 0
  Corrupt metadata blocks: 0
        Corrupt AT blocks: 0


------------------------ SUMMARY FOR DISKGROUP DATADG ------------------------
           Allocated AU's: 6944
                Free AU's: 13536
       AU's read for dump: 344
       Block images saved: 81943
        Map lines written: 344
          Heartbeats seen: 3
  Corrupt metadata blocks: 0
        Corrupt AT blocks: 0


******************************* END OF REPORT ********************************


[grid@jyrac1 amdu_2017_01_05_16_09_47]$ more DATADG.map
...
N0008 D0002 R00 A00000069 F00000003 I0 E00000241 U00 C00256 S0000 B0000000000  
N0008 D0002 R00 A00000070 F00000003 I0 E00000244 U00 C00256 S0000 B0000000000  
N0008 D0002 R00 A00000071 F00000003 I0 E00000248 U00 C00256 S0000 B0000000000  
N0008 D0002 R00 A00000072 F00000003 I0 E00000249 U00 C00256 S0000 B0000000000  
N0008 D0002 R00 A00000073 F00000004 I0 E00000012 U00 C00000 S0000 B0000000000  
N0008 D0002 R00 A00000074 F00000004 I0 E00000017 U00 C00000 S0000 B0000000000  
N0008 D0002 R00 A00000075 F00000004 I0 E00000019 U00 C00000 S0000 B0000000000  
N0008 D0002 R00 A00000076 F00000004 I0 E00000022 U00 C00000 S0000 B0000000000  
N0008 D0002 R00 A00000077 F00000001 I0 E00000004 U00 C00256 S0000 B0000000000  
N0008 D0002 R00 A00000094 F00000257 I1 E00000002 U00 C00256 S0000 B0000000000  
N0008 D0002 R00 A00000111 F00000258 I1 E00000001 U00 C00256 S0000 B0000000000  
N0008 D0002 R00 A00000641 F00000259 I1 E00000000 U00 C00256 S0000 B0000000000  
N0008 D0002 R00 A00001022 F00000260 I1 E00000001 U00 C00256 S0000 B0000000000  
N0008 D0002 R00 A00001197 F00000261 I1 E00000002 U00 C00256 S0000 B0000000000  
N0008 D0002 R00 A00001272 F00000262 I1 E00000000 U00 C00256 S0000 B0000000000  
N0008 D0002 R00 A00001328 F00000264 I1 E00000000 U00 C00256 S0000 B0000000000  
N0008 D0002 R00 A00001356 F00000265 I1 E00000001 U00 C00256 S0000 B0000000000  
N0008 D0002 R00 A00001380 F00000266 I1 E00000000 U00 C00256 S0000 B0000000000  
N0008 D0002 R00 A00001453 F00000270 I1 E00000000 U00 C00256 S0000 B0000000000  
N0008 D0002 R00 A00001707 F00000012 I0 E00000001 U00 C00256 S0000 B0000000000  
...

上面感觉有价值的内容是A和F起始的两列。比如,A00000094代表本行是关于AU 94. F00000257代表本行与序号257的ASM文件相关。重新回到查找NSA数据文件的目标。ASM序号6的元数据文件是alias别名目录,这是查找目标的起点。通过DATADG.map文件,能找到序号6的ASM元数据文件的所有AU。

[grid@jyrac1 amdu_2017_01_05_16_09_47]$  grep F00000006 DATADG.map
N0009 D0001 R00 A00000036 F00000006 I0 E00000002 U00 C00256 S0000 B0000000000  
N0008 D0002 R00 A00000038 F00000006 I0 E00000000 U00 C00256 S0000 B0000000000  
N0002 D0003 R00 A00000037 F00000006 I0 E00000001 U00 C00256 S0000 B0000000000  

通过查找定位到与该元数据文件相关的AU记录有三行。同时别名目录元数据文件存放在磁盘1(D0001)的AU 36(A00000036),磁盘2(D0002)的AU 38(A00000038)和磁盘3(D0003)的AU 37(A00000037)。 从前面report.txt的记录中知道,磁盘1指的是’/dev/raw/raw4’并且它的AU大小是1MB。通过kfed工具来查看alias目录文件。

[grid@jyrac1 amdu_2017_01_05_16_09_47]$ kfed read /dev/raw/raw4 aun=36 | more
kfbh.endian:                          1 ; 0x000: 0x01
kfbh.hard:                          130 ; 0x001: 0x82
kfbh.type:                           11 ; 0x002: KFBTYP_ALIASDIR
kfbh.datfmt:                          1 ; 0x003: 0x01
kfbh.block.blk:                       0 ; 0x004: blk=0
kfbh.block.obj:                       6 ; 0x008: file=6
kfbh.check:                  2235498606 ; 0x00c: 0x853f006e
kfbh.fcn.base:                     3565 ; 0x010: 0x00000ded
kfbh.fcn.wrap:                        0 ; 0x014: 0x00000000
kfbh.spare1:                          0 ; 0x018: 0x00000000
kfbh.spare2:                          0 ; 0x01c: 0x00000000
kffdnd.bnode.incarn:                  1 ; 0x000: A=1 NUMM=0x0
kffdnd.bnode.frlist.number:  4294967295 ; 0x004: 0xffffffff
kffdnd.bnode.frlist.incarn:           0 ; 0x008: A=0 NUMM=0x0
kffdnd.overfl.number:        4294967295 ; 0x00c: 0xffffffff
kffdnd.overfl.incarn:                 0 ; 0x010: A=0 NUMM=0x0
kffdnd.parent.number:                 0 ; 0x014: 0x00000000
kffdnd.parent.incarn:                 1 ; 0x018: A=1 NUMM=0x0
kffdnd.fstblk.number:                 0 ; 0x01c: 0x00000000
kffdnd.fstblk.incarn:                 1 ; 0x020: A=1 NUMM=0x0
kfade[0].entry.incarn:                1 ; 0x024: A=1 NUMM=0x0
kfade[0].entry.hash:         2990280982 ; 0x028: 0xb23c1116
kfade[0].entry.refer.number:          1 ; 0x02c: 0x00000001
kfade[0].entry.refer.incarn:          1 ; 0x030: A=1 NUMM=0x0
kfade[0].name:                    JYRAC ; 0x034: length=5
kfade[0].fnum:               4294967295 ; 0x064: 0xffffffff
kfade[0].finc:               4294967295 ; 0x068: 0xffffffff
kfade[0].flags:                       8 ; 0x06c: U=0 S=0 S=0 U=1 F=0
kfade[0].ub1spare:                    0 ; 0x06d: 0x00
kfade[0].ub2spare:                    0 ; 0x06e: 0x0000
kfade[1].entry.incarn:                1 ; 0x070: A=1 NUMM=0x0
kfade[1].entry.hash:         3585957073 ; 0x074: 0xd5bd5cd1
kfade[1].entry.refer.number:          9 ; 0x078: 0x00000009
kfade[1].entry.refer.incarn:          1 ; 0x07c: A=1 NUMM=0x0
kfade[1].name:               DB_UNKNOWN ; 0x080: length=10
kfade[1].fnum:               4294967295 ; 0x0b0: 0xffffffff
kfade[1].finc:               4294967295 ; 0x0b4: 0xffffffff
kfade[1].flags:                       4 ; 0x0b8: U=0 S=0 S=1 U=0 F=0
kfade[1].ub1spare:                    0 ; 0x0b9: 0x00
kfade[1].ub2spare:                    0 ; 0x0ba: 0x0000
kfade[2].entry.incarn:                3 ; 0x0bc: A=1 NUMM=0x1
kfade[2].entry.hash:         1585230659 ; 0x0c0: 0x5e7cb343
kfade[2].entry.refer.number: 4294967295 ; 0x0c4: 0xffffffff
kfade[2].entry.refer.incarn:          0 ; 0x0c8: A=0 NUMM=0x0
...

kfed的输出信息中kfbh.type验证了这是一个alias目录文件。下一步查找名字包含SYS的数据文件

[grid@jyrac1 amdu_2017_01_05_16_09_47]$ vi getfilename.sh

for (( i=0; i<256; i++ ))
do
kfed read /dev/raw/raw4 aun=36 blkn=$i | grep -1 SYS
done

[grid@jyrac1 amdu_2017_01_05_16_09_47]$ chmod 777 getfilename.sh 
[grid@jyrac1 amdu_2017_01_05_16_09_47]$ ./getfilename.sh 
kfade[0].entry.refer.incarn:          0 ; 0x030: A=0 NUMM=0x0
kfade[0].name:                   SYSAUX ; 0x034: length=6
kfade[0].fnum:                      258 ; 0x064: 0x00000102
--
kfade[1].entry.refer.incarn:          0 ; 0x07c: A=0 NUMM=0x0
kfade[1].name:                   SYSTEM ; 0x080: length=6
kfade[1].fnum:                      259 ; 0x0b0: 0x00000103

名字包含SYS的数据文件是SYSTEM,SYSAUX,它们的ASM文件序号是258,259.接下来可以进一步提取数据文件

[grid@jyrac1 amdu_2017_01_05_16_09_47]$ amdu -diskstring="/dev/raw/*" -extract DATADG.258 -output SYSAUX.258 -noreport -nodir
AMDU-00204: Disk N0003 is in currently mounted diskgroup DATADG
AMDU-00201: Disk N0003: '/dev/raw/raw11'
AMDU-00204: Disk N0009 is in currently mounted diskgroup DATADG
AMDU-00201: Disk N0009: '/dev/raw/raw4'
AMDU-00204: Disk N0008 is in currently mounted diskgroup DATADG
AMDU-00201: Disk N0008: '/dev/raw/raw3'
[grid@jyrac1 amdu_2017_01_05_16_09_47]$ amdu -diskstring="/dev/raw/*" -extract DATADG.259 -output SYSTEM.259 -noreport -nodir
AMDU-00204: Disk N0003 is in currently mounted diskgroup DATADG
AMDU-00201: Disk N0003: '/dev/raw/raw11'
AMDU-00204: Disk N0009 is in currently mounted diskgroup DATADG
AMDU-00201: Disk N0009: '/dev/raw/raw4'
AMDU-00204: Disk N0008 is in currently mounted diskgroup DATADG
AMDU-00201: Disk N0008: '/dev/raw/raw3'
[grid@jyrac1 amdu_2017_01_05_16_09_47]$ ls -lrt SYS*
-rw-r--r-- 1 grid oinstall 1625300992 Jan  5 16:44 SYSAUX.258
-rw-r--r-- 1 grid oinstall  796925952 Jan  5 16:46 SYSTEM.259

提取其它数据文件的操作与提取system,sysaux数据文件类似,如果能提取到数据库控制文件,system和sysaux系统表空间及其它数据文件,就可以用这些文件来打开数据库。还可能把这个文件“迁移”到别的数据库。需要注意是amdu提取的可能是有损坏或者是已破坏的文件,这取决于文件本身是否有损坏。对于那些由于元信息损坏或者丢失儿导致的不能呗mount的磁盘组,也有可能数据文件是好的,这样情况下同样可以使用amdu来抽取到完好的数据文件。

发表评论

电子邮件地址不会被公开。