http://www.killdb.com/2012/12/06/how-to-extract-datafiles-from-asm-diskgroup.html

我们知道从11g开始oracle自身就提供了amdu工具,可以用来抽取asm 磁盘组中的文件。该软件也可以
用于10g版本,我这里来做个演示,并对一些细节进行说明,以回答几个网友的疑问:

[oracle@10gasm ~]$ amdu -diskstring '/dev/sd*' -dump 'DATA01'
amdu_2012_12_06_00_36_55/
[oracle@10gasm ~]$ 
[oracle@10gasm ~]$ 
[oracle@10gasm ~]$ amdu -diskstring '/dev/sd*' -dump 'DATA02'
amdu_2012_12_06_00_37_37/

如下是该磁盘组的map情况:

[oracle@10gasm amdu_2012_12_06_00_36_55]$ cat DATA01.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 A00000005 F00000003 I0 E00000001 U00 C00256 S0001 B0004194304  
N0001 D0000 R00 A00000007 F00000003 I0 E00000003 U00 C00256 S0001 B0005242880  
N0001 D0000 R00 A00000009 F00000003 I0 E00000005 U00 C00256 S0001 B0006291456  
N0001 D0000 R00 A00000011 F00000003 I0 E00000007 U00 C00256 S0001 B0007340032  
N0001 D0000 R00 A00000013 F00000003 I0 E00000009 U00 C00256 S0001 B0008388608  
N0001 D0000 R00 A00000015 F00000003 I0 E00000011 U00 C00256 S0001 B0009437184  
N0001 D0000 R00 A00000017 F00000003 I0 E00000013 U00 C00256 S0001 B0010485760  
N0001 D0000 R00 A00000019 F00000003 I0 E00000015 U00 C00256 S0001 B0011534336  
N0001 D0000 R00 A00000021 F00000003 I0 E00000017 U00 C00256 S0001 B0012582912  
N0001 D0000 R00 A00000023 F00000003 I0 E00000019 U00 C00256 S0001 B0013631488  
N0001 D0000 R00 A00000025 F00000003 I0 E00000021 U00 C00256 S0001 B0014680064  
N0001 D0000 R00 A00000027 F00000003 I0 E00000023 U00 C00256 S0001 B0015728640  
N0001 D0000 R00 A00000029 F00000003 I0 E00000025 U00 C00256 S0001 B0016777216  
N0001 D0000 R00 A00000031 F00000003 I0 E00000027 U00 C00256 S0001 B0017825792  
N0001 D0000 R00 A00000033 F00000003 I0 E00000029 U00 C00256 S0001 B0018874368  
N0001 D0000 R00 A00000035 F00000003 I0 E00000031 U00 C00256 S0001 B0019922944  
N0001 D0000 R00 A00000037 F00000003 I0 E00000033 U00 C00256 S0001 B0020971520  
N0001 D0000 R00 A00000039 F00000003 I0 E00000035 U00 C00256 S0001 B0022020096  
N0001 D0000 R00 A00000041 F00000003 I0 E00000037 U00 C00256 S0001 B0023068672  
N0001 D0000 R00 A00000043 F00000003 I0 E00000039 U00 C00256 S0001 B0024117248  
N0001 D0000 R00 A00000045 F00000003 I0 E00000041 U00 C00256 S0001 B0025165824  
N0001 D0000 R00 A00000047 F00000004 I0 E00000001 U00 C00000 S0001 B0026214400  
N0001 D0000 R00 A00000049 F00000006 I0 E00000000 U00 C00256 S0001 B0026214400  
N0001 D0000 R00 A00000111 F00000256 I1 E00000000 U00 C00001 S0001 B0027262976  
N0001 D0000 R00 A00000376 F00000267 I1 E00000000 U00 C00001 S0001 B0027267072  
N0001 D0000 R00 A00000757 F00000266 I1 E00000000 U00 C00001 S0001 B0027271168  
N0004 D0001 R00 A00000000 F00000000 I0 E00000000 U00 C00256 S0001 B0027275264  
N0004 D0001 R00 A00000001 F00000000 I0 E00000000 U00 C00000 S0001 B0028323840  
N0004 D0001 R00 A00000002 F00000001 I0 E00000001 U00 C00256 S0001 B0028323840  
N0004 D0001 R00 A00000003 F00000003 I0 E00000000 U00 C00256 S0001 B0029372416  
N0004 D0001 R00 A00000004 F00000003 I0 E00000002 U00 C00256 S0001 B0030420992  
N0004 D0001 R00 A00000005 F00000003 I0 E00000004 U00 C00256 S0001 B0031469568  
N0004 D0001 R00 A00000006 F00000003 I0 E00000006 U00 C00256 S0001 B0032518144  
N0004 D0001 R00 A00000007 F00000003 I0 E00000008 U00 C00256 S0001 B0033566720  
N0004 D0001 R00 A00000008 F00000003 I0 E00000010 U00 C00256 S0001 B0034615296  
N0004 D0001 R00 A00000009 F00000003 I0 E00000012 U00 C00256 S0001 B0035663872  
N0004 D0001 R00 A00000010 F00000003 I0 E00000014 U00 C00256 S0001 B0036712448  
N0004 D0001 R00 A00000011 F00000003 I0 E00000016 U00 C00256 S0001 B0037761024  
N0004 D0001 R00 A00000012 F00000003 I0 E00000018 U00 C00256 S0001 B0038809600  
N0004 D0001 R00 A00000013 F00000003 I0 E00000020 U00 C00256 S0001 B0039858176  
N0004 D0001 R00 A00000014 F00000003 I0 E00000022 U00 C00256 S0001 B0040906752  
N0004 D0001 R00 A00000015 F00000003 I0 E00000024 U00 C00256 S0001 B0041955328  
N0004 D0001 R00 A00000016 F00000003 I0 E00000026 U00 C00256 S0001 B0043003904  
N0004 D0001 R00 A00000017 F00000003 I0 E00000028 U00 C00256 S0001 B0044052480  
N0004 D0001 R00 A00000018 F00000003 I0 E00000030 U00 C00256 S0001 B0045101056  
N0004 D0001 R00 A00000019 F00000003 I0 E00000032 U00 C00256 S0001 B0046149632  
N0004 D0001 R00 A00000020 F00000003 I0 E00000034 U00 C00256 S0001 B0047198208  
N0004 D0001 R00 A00000021 F00000003 I0 E00000036 U00 C00256 S0001 B0048246784  
N0004 D0001 R00 A00000022 F00000003 I0 E00000038 U00 C00256 S0001 B0049295360  
N0004 D0001 R00 A00000023 F00000003 I0 E00000040 U00 C00256 S0001 B0050343936  
N0004 D0001 R00 A00000024 F00000004 I0 E00000000 U00 C00010 S0001 B0051392512  
N0004 D0001 R00 A00000025 F00000005 I0 E00000000 U00 C00256 S0001 B0051433472  
N0004 D0001 R00 A00000392 F00000257 I1 E00000000 U00 C00001 S0001 B0052482048

下面来对上面amdu的map文件进行描述:

N0001 D0000 R00 A00000000 F00000000 I0 E00000000 U00 C00256 S0001 B0000000000

第1列:应该是逻辑的disk编号,data01磁盘组包含2个disk,分别是/dev/sdb,/dev/sde所以分别是1和4.
这个你可以从amdu的report.txt看到。
第2列:asm内部定义的disk number号,data01磁盘组包含2个disk,所以/dev/sdb是0,/dev/sde是1. 这里
需要说明的是,asm里面都是从0开始定义的。
第3列:未知
第4列:应该是表示的au号。
第5列:asm内部定义的file number号。这里有一点需要注意的是,asm里面file number 0~6都是元数据。
数据文件的file number都是从256开始的,实际就是对应的kfbh.block.obj。
第6列:未知
第7列:未知
第8列:未知
第9列:表示该au所分配的block大小,我这里block size是4096,由于au size是1m,所以该值基本上都是256。

第10列:未知
第11列:这里是表示的是指针,或者你可以理解为offset。你可以看到后面的每个数据都是我们的au(1m)的整数倍。

虽然上面有部分信息,我们不清楚含义,不过没关系,我们所了解的信息就足够了。

从上面我们可以看到,该磁盘组中有4个datafile,起对应的asm file number分别是:256,257,266,267.

下面我们来进行抽取:

[oracle@10gasm ~]$ amdu -dis '/dev/sd*' -extract data01.256
amdu_2012_12_06_01_28_14/
 
我们来校验一下,看看抽取出来的该文件是否正常:
[oracle@10gasm amdu_2012_12_06_01_28_14]$ dbv file=DATA01_256.f
 
DBVERIFY: Release 10.2.0.1.0 - Production on Thu Dec 6 01:29:22 2012
 
Copyright (c) 1982, 2005, Oracle.  All rights reserved.
 
DBVERIFY - Verification starting : FILE = DATA01_256.f
 
 
DBVERIFY - Verification complete
 
Total Pages Examined         : 62720
Total Pages Processed (Data) : 37115
Total Pages Failing   (Data) : 0
Total Pages Processed (Index): 6909
Total Pages Failing   (Index): 0
Total Pages Processed (Other): 1809
Total Pages Processed (Seg)  : 0
Total Pages Failing   (Seg)  : 0
Total Pages Empty            : 16887
Total Pages Marked Corrupt   : 0
Total Pages Influx           : 0
Highest block SCN            : 3760053 (0.3760053)

到最后,可能还有人会有疑问,假如我的asm 磁盘组无法mount了,需要进行抽取,但是
我如何进行文件的对应呢? 比如这里抽取出来的file 256我怎么知道该文件是什么呢?
是system还是user,还是sysaux(虽然这里我知道是system) ?

我们知道asm alias directory是在第6个位置,所以我直接读取第6个block,如下:

[oracle@10gasm ~]$ kfed read /dev/sdb aun=2 blkn=6| more
kfbh.endian:                          1 ; 0x000: 0x01
kfbh.hard:                          130 ; 0x001: 0x82
kfbh.type:                            4 ; 0x002: KFBTYP_FILEDIR
kfbh.datfmt:                          1 ; 0x003: 0x01
kfbh.block.blk:                       6 ; 0x004: T=0 NUMB=0x6
kfbh.block.obj:                       1 ; 0x008: TYPE=0x0 NUMB=0x1
kfbh.check:                   557399700 ; 0x00c: 0x21393e94
kfbh.fcn.base:                    23581 ; 0x010: 0x00005c1d
kfbh.fcn.wrap:                        0 ; 0x014: 0x00000000
kfbh.spare1:                          0 ; 0x018: 0x00000000
kfbh.spare2:                          0 ; 0x01c: 0x00000000
kfffdb.node.incarn:                   1 ; 0x000: A=1 NUMM=0x0
kfffdb.node.frlist.number:   4294967295 ; 0x004: 0xffffffff
kfffdb.node.frlist.incarn:            0 ; 0x008: A=0 NUMM=0x0
kfffdb.hibytes:                       0 ; 0x00c: 0x00000000
kfffdb.lobytes:                 1048576 ; 0x010: 0x00100000
kfffdb.xtntcnt:                       1 ; 0x014: 0x00000001
kfffdb.xtnteof:                       1 ; 0x018: 0x00000001
kfffdb.blkSize:                    4096 ; 0x01c: 0x00001000
kfffdb.flags:                        65 ; 0x020: O=1 S=0 S=0 D=0 C=0 I=0 R=1 A=0
kfffdb.fileType:                     15 ; 0x021: 0x0f
kfffdb.dXrs:                         17 ; 0x022: SCHE=0x1 NUMB=0x1
kfffdb.iXrs:                         17 ; 0x023: SCHE=0x1 NUMB=0x1
kfffdb.dXsiz[0]:             4294967295 ; 0x024: 0xffffffff
kfffdb.dXsiz[1]:                      0 ; 0x028: 0x00000000
kfffdb.dXsiz[2]:                      0 ; 0x02c: 0x00000000
kfffdb.iXsiz[0]:             4294967295 ; 0x030: 0xffffffff
kfffdb.iXsiz[1]:                      0 ; 0x034: 0x00000000
kfffdb.iXsiz[2]:                      0 ; 0x038: 0x00000000
kfffdb.xtntblk:                       1 ; 0x03c: 0x0001
kfffdb.break:                        60 ; 0x03e: 0x003c
kfffdb.priZn:                         0 ; 0x040: 0x00
kfffdb.secZn:                         0 ; 0x041: 0x00
kfffdb.ub2spare:                      0 ; 0x042: 0x0000
kfffdb.alias[0]:             4294967295 ; 0x044: 0xffffffff
kfffdb.alias[1]:             4294967295 ; 0x048: 0xffffffff
kfffdb.strpwdth:                      0 ; 0x04c: 0x00
kfffdb.strpsz:                        0 ; 0x04d: 0x00
kfffdb.usmsz:                         0 ; 0x04e: 0x0000
kfffdb.crets.hi:               32967761 ; 0x050: HOUR=0x11 DAYS=0x2 MNTH=0x3 YEAR=0x7dc
kfffdb.crets.lo:             3303696384 ; 0x054: USEC=0x0 MSEC=0x29a SECS=0xe MINS=0x31
kfffdb.modts.hi:               32967761 ; 0x058: HOUR=0x11 DAYS=0x2 MNTH=0x3 YEAR=0x7dc
kfffdb.modts.lo:             3303696384 ; 0x05c: USEC=0x0 MSEC=0x29a SECS=0xe MINS=0x31
kfffdb.spare[0]:                      0 ; 0x060: 0x00000000
kfffdb.spare[1]:                      0 ; 0x064: 0x00000000
kfffdb.spare[2]:                      0 ; 0x068: 0x00000000
kfffdb.spare[3]:                      0 ; 0x06c: 0x00000000
kfffdb.spare[4]:                      0 ; 0x070: 0x00000000
kfffdb.spare[5]:                      0 ; 0x074: 0x00000000
kfffdb.spare[6]:                      0 ; 0x078: 0x00000000
kfffdb.spare[7]:                      0 ; 0x07c: 0x00000000
kfffdb.spare[8]:                      0 ; 0x080: 0x00000000
kfffdb.spare[9]:                      0 ; 0x084: 0x00000000
kfffdb.spare[10]:                     0 ; 0x088: 0x00000000
kfffdb.spare[11]:                     0 ; 0x08c: 0x00000000
kfffdb.spare[12]:                     0 ; 0x090: 0x00000000
kfffdb.spare[13]:                     0 ; 0x094: 0x00000000
kfffdb.spare[14]:                     0 ; 0x098: 0x00000000
kfffdb.spare[15]:                     0 ; 0x09c: 0x00000000
kfffdb.usm:                             ; 0x0a0: length=0
kfffde[0].xptr.au:                   49 ; 0x4a0: 0x00000031
kfffde[0].xptr.disk:                  0 ; 0x4a4: 0x0000
kfffde[0].xptr.flags:                 0 ; 0x4a6: L=0 E=0 D=0 C=0 S=0
kfffde[0].xptr.chk:                  27 ; 0x4a7: 0x1b
kfffde[1].xptr.au:           4294967295 ; 0x4a8: 0xffffffff
kfffde[1].xptr.disk:              65535 ; 0x4ac: 0xffff
kfffde[1].xptr.flags:                 0 ; 0x4ae: L=0 E=0 D=0 C=0 S=0
kfffde[1].xptr.chk:                  42 ; 0x4af: 0x2a
kfffde[2].xptr.au:           4294967295 ; 0x4b0: 0xffffffff
.........省略部分信息

从上面信息,我们可以看到,alias directory 信息是存在第49个au里面,ok,我们来看第49个au的信息:

[oracle@10gasm ~]$ kfed read /dev/sdb aun=49 blkn=1| 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:                       1 ; 0x004: T=0 NUMB=0x1
kfbh.block.obj:                       6 ; 0x008: TYPE=0x0 NUMB=0x6
kfbh.check:                   546326305 ; 0x00c: 0x20904721
kfbh.fcn.base:                    22933 ; 0x010: 0x00005995
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:                 1 ; 0x01c: 0x00000001
kffdnd.fstblk.incarn:                 1 ; 0x020: A=1 NUMM=0x0
kfade[0].entry.incarn:                1 ; 0x024: A=1 NUMM=0x0
kfade[0].entry.hash:          710518681 ; 0x028: 0x2a59a799
kfade[0].entry.refer.number:          2 ; 0x02c: 0x00000002
kfade[0].entry.refer.incarn:          1 ; 0x030: A=1 NUMM=0x0
kfade[0].name:                 DATAFILE ; 0x034: length=8
kfade[0].fnum:               4294967295 ; 0x064: 0xffffffff
kfade[0].finc:               4294967295 ; 0x068: 0xffffffff
kfade[0].flags:                       4 ; 0x06c: U=0 S=0 S=1 U=0 F=0
kfade[0].ub1spare:                    0 ; 0x06d: 0x00
kfade[0].ub2spare:                    0 ; 0x06e: 0x0000
kfade[1].entry.incarn:                3 ; 0x070: A=1 NUMM=0x1
kfade[1].entry.hash:         4053320104 ; 0x074: 0xf198c1a8
kfade[1].entry.refer.number:          3 ; 0x078: 0x00000003
kfade[1].entry.refer.incarn:          3 ; 0x07c: A=1 NUMM=0x1
kfade[1].name:              CONTROLFILE ; 0x080: length=11
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:                1 ; 0x0bc: A=1 NUMM=0x0
kfade[2].entry.hash:         2803485489 ; 0x0c0: 0xa719cb31
kfade[2].entry.refer.number:          4 ; 0x0c4: 0x00000004
kfade[2].entry.refer.incarn:          1 ; 0x0c8: A=1 NUMM=0x0
kfade[2].name:                ONLINELOG ; 0x0cc: length=9
kfade[2].fnum:               4294967295 ; 0x0fc: 0xffffffff
kfade[2].finc:               4294967295 ; 0x100: 0xffffffff
kfade[2].flags:                       4 ; 0x104: U=0 S=0 S=1 U=0 F=0
kfade[2].ub1spare:                    0 ; 0x105: 0x00
kfade[2].ub2spare:                    0 ; 0x106: 0x0000
kfade[3].entry.incarn:                1 ; 0x108: A=1 NUMM=0x0
kfade[3].entry.hash:         2905271101 ; 0x10c: 0xad2aeb3d
kfade[3].entry.refer.number:          5 ; 0x110: 0x00000005
kfade[3].entry.refer.incarn:          1 ; 0x114: A=1 NUMM=0x0
kfade[3].name:                 TEMPFILE ; 0x118: length=8
kfade[3].fnum:               4294967295 ; 0x148: 0xffffffff
kfade[3].finc:               4294967295 ; 0x14c: 0xffffffff
kfade[3].flags:                       4 ; 0x150: U=0 S=0 S=1 U=0 F=0
kfade[3].ub1spare:                    0 ; 0x151: 0x00
kfade[3].ub2spare:                    0 ; 0x152: 0x0000
kfade[4].entry.incarn:                5 ; 0x154: A=1 NUMM=0x2
kfade[4].entry.hash:         3261836913 ; 0x158: 0xc26bae71
kfade[4].entry.refer.number:          6 ; 0x15c: 0x00000006
kfade[4].entry.refer.incarn:          5 ; 0x160: A=1 NUMM=0x2
kfade[4].name:            PARAMETERFILE ; 0x164: length=13
kfade[4].fnum:               4294967295 ; 0x194: 0xffffffff
kfade[4].finc:               4294967295 ; 0x198: 0xffffffff
kfade[4].flags:                       4 ; 0x19c: U=0 S=0 S=1 U=0 F=0
kfade[4].ub1spare:                    0 ; 0x19d: 0x00
kfade[4].ub2spare:                    0 ; 0x19e: 0x0000
kfade[5].entry.incarn:                2 ; 0x1a0: A=0 NUMM=0x1
kfade[5].entry.hash:                  0 ; 0x1a4: 0x00000000
kfade[5].entry.refer.number:          0 ; 0x1a8: 0x00000000
kfade[5].entry.refer.incarn:          0 ; 0x1ac: A=0 NUMM=0x0
kfade[5].name:         spfile10gasm.ora ; 0x1b0: length=16
kfade[5].fnum:                      265 ; 0x1e0: 0x00000109
kfade[5].finc:                776886941 ; 0x1e4: 0x2e4e5a9d
kfade[5].flags:                      17 ; 0x1e8: U=1 S=0 S=0 U=0 F=1
kfade[5].ub1spare:                    0 ; 0x1e9: 0x00
kfade[5].ub2spare:                    0 ; 0x1ea: 0x0000
kfade[6].entry.incarn:              666 ; 0x1ec: A=0 NUMM=0x14d
kfade[6].entry.hash:                  0 ; 0x1f0: 0x00000000
kfade[6].entry.refer.number:          0 ; 0x1f4: 0x00000000
kfade[6].entry.refer.incarn:          0 ; 0x1f8: A=0 NUMM=0x0
kfade[6].name:               ARCHIVELOG ; 0x1fc: length=10
kfade[6].fnum:               4294967295 ; 0x22c: 0xffffffff
kfade[6].finc:               4294967295 ; 0x230: 0xffffffff
kfade[6].flags:                       4 ; 0x234: U=0 S=0 S=1 U=0 F=0
kfade[6].ub1spare:                    0 ; 0x235: 0x00
kfade[6].ub2spare:                    0 ; 0x236: 0x0000
kfade[7].entry.incarn:              666 ; 0x238: A=0 NUMM=0x14d
kfade[7].entry.hash:                  0 ; 0x23c: 0x00000000
kfade[7].entry.refer.number:          0 ; 0x240: 0x00000000
kfade[7].entry.refer.incarn:          0 ; 0x244: A=0 NUMM=0x0
kfade[7].name:        1_2_776886834.dbf ; 0x248: length=17
kfade[7].fnum:                      267 ; 0x278: 0x0000010b
kfade[7].finc:                777690117 ; 0x27c: 0x2e5a9c05
kfade[7].flags:                       1 ; 0x280: U=1 S=0 S=0 U=0 F=0
kfade[7].ub1spare:                    0 ; 0x281: 0x00
kfade[7].ub2spare:                    0 ; 0x282: 0x0000
kfade[8].entry.incarn:                2 ; 0x284: A=0 NUMM=0x1
kfade[8].entry.hash:                  0 ; 0x288: 0x00000000
kfade[8].entry.refer.number:          0 ; 0x28c: 0x00000000
kfade[8].entry.refer.incarn:          0 ; 0x290: A=0 NUMM=0x0
kfade[8].name:        1_3_776886834.dbf ; 0x294: length=17
kfade[8].fnum:                      267 ; 0x2c4: 0x0000010b
kfade[8].finc:                777448045 ; 0x2c8: 0x2e56ea6d
kfade[8].flags:                       1 ; 0x2cc: U=1 S=0 S=0 U=0 F=0
........省略部分内容

上面的结果灰常的清楚了,我所需要的就是读取datafile,当然如果是恢复的话,可能还需要抽取redo和archivelog,这里不多说:

[oracle@10gasm ~]$ kfed read /dev/sdb aun=49 blkn=2| grep name|head -10
kfade[0].name:                   SYSTEM ; 0x034: length=6
kfade[1].name:                   SYSAUX ; 0x080: length=6
kfade[2].name:                 UNDOTBS1 ; 0x0cc: length=8
kfade[3].name:                    USERS ; 0x118: length=5
kfade[4].name:                  TESTASM ; 0x164: length=7
kfade[5].name:                          ; 0x1b0: length=0
kfade[6].name:                          ; 0x1fc: length=0
kfade[7].name:                          ; 0x248: length=0
kfade[8].name:                          ; 0x294: length=0
kfade[9].name:                          ; 0x2e0: length=0

我们可以看到,其实我这个测试库仅仅只有上面6个datafile,那每个datafile所对应的file number呢?如下:

[oracle@10gasm ~]$ kfed read /dev/sdb aun=49 blkn=2| 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:                       2 ; 0x004: T=0 NUMB=0x2
kfbh.block.obj:                       6 ; 0x008: TYPE=0x0 NUMB=0x6
kfbh.check:                  3911862032 ; 0x00c: 0xe92a4710
kfbh.fcn.base:                    26333 ; 0x010: 0x000066dd
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:                 1 ; 0x014: 0x00000001
kffdnd.parent.incarn:                 1 ; 0x018: A=1 NUMM=0x0
kffdnd.fstblk.number:                 2 ; 0x01c: 0x00000002
kffdnd.fstblk.incarn:                 1 ; 0x020: A=1 NUMM=0x0
kfade[0].entry.incarn:                1 ; 0x024: A=1 NUMM=0x0
kfade[0].entry.hash:         1500154360 ; 0x028: 0x596a89f8
kfade[0].entry.refer.number: 4294967295 ; 0x02c: 0xffffffff
kfade[0].entry.refer.incarn:          0 ; 0x030: A=0 NUMM=0x0
kfade[0].name:                   SYSTEM ; 0x034: length=6
kfade[0].fnum:                      256 ; 0x064: 0x00000100
kfade[0].finc:                776886753 ; 0x068: 0x2e4e59e1
kfade[0].flags:                      18 ; 0x06c: U=0 S=1 S=0 U=0 F=1
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:         1844822845 ; 0x074: 0x6df5c33d
kfade[1].entry.refer.number: 4294967295 ; 0x078: 0xffffffff
kfade[1].entry.refer.incarn:          0 ; 0x07c: A=0 NUMM=0x0
kfade[1].name:                   SYSAUX ; 0x080: length=6
kfade[1].fnum:                      257 ; 0x0b0: 0x00000101
kfade[1].finc:                776886753 ; 0x0b4: 0x2e4e59e1
kfade[1].flags:                      18 ; 0x0b8: U=0 S=1 S=0 U=0 F=1
kfade[1].ub1spare:                    0 ; 0x0b9: 0x00
kfade[1].ub2spare:                    0 ; 0x0ba: 0x0000
kfade[2].entry.incarn:                1 ; 0x0bc: A=1 NUMM=0x0
kfade[2].entry.hash:         1403943050 ; 0x0c0: 0x53ae788a
kfade[2].entry.refer.number: 4294967295 ; 0x0c4: 0xffffffff
kfade[2].entry.refer.incarn:          0 ; 0x0c8: A=0 NUMM=0x0
kfade[2].name:                 UNDOTBS1 ; 0x0cc: length=8
kfade[2].fnum:                      258 ; 0x0fc: 0x00000102
kfade[2].finc:                776886753 ; 0x100: 0x2e4e59e1
kfade[2].flags:                      18 ; 0x104: U=0 S=1 S=0 U=0 F=1
kfade[2].ub1spare:                    0 ; 0x105: 0x00
kfade[2].ub2spare:                    0 ; 0x106: 0x0000
kfade[3].entry.incarn:                1 ; 0x108: A=1 NUMM=0x0
kfade[3].entry.hash:          979599379 ; 0x10c: 0x3a638013
kfade[3].entry.refer.number: 4294967295 ; 0x110: 0xffffffff
kfade[3].entry.refer.incarn:          0 ; 0x114: A=0 NUMM=0x0
kfade[3].name:                    USERS ; 0x118: length=5
kfade[3].fnum:                      259 ; 0x148: 0x00000103
kfade[3].finc:                776886755 ; 0x14c: 0x2e4e59e3
kfade[3].flags:                      18 ; 0x150: U=0 S=1 S=0 U=0 F=1
kfade[3].ub1spare:                    0 ; 0x151: 0x00
kfade[3].ub2spare:                    0 ; 0x152: 0x0000
kfade[4].entry.incarn:                3 ; 0x154: A=1 NUMM=0x1
kfade[4].entry.hash:          152063294 ; 0x158: 0x09104d3e
kfade[4].entry.refer.number: 4294967295 ; 0x15c: 0xffffffff
kfade[4].entry.refer.incarn:          0 ; 0x160: A=0 NUMM=0x0
kfade[4].name:                  TESTASM ; 0x164: length=7
kfade[4].fnum:                      267 ; 0x194: 0x0000010b
kfade[4].finc:                785448525 ; 0x198: 0x2ed0fe4d
kfade[4].flags:                      18 ; 0x19c: U=0 S=1 S=0 U=0 F=1
kfade[4].ub1spare:                    0 ; 0x19d: 0x00
kfade[4].ub2spare:                    0 ; 0x19e: 0x0000
kfade[5].entry.incarn:                0 ; 0x1a0: A=0 NUMM=0x0
kfade[5].entry.hash:                  0 ; 0x1a4: 0x00000000
kfade[5].entry.refer.number:          0 ; 0x1a8: 0x00000000
kfade[5].entry.refer.incarn:          0 ; 0x1ac: A=0 NUMM=0x0
kfade[5].name:                          ; 0x1b0: length=0
kfade[5].fnum:                        0 ; 0x1e0: 0x00000000
kfade[5].finc:                        0 ; 0x1e4: 0x00000000
kfade[5].flags:                       0 ; 0x1e8: U=0 S=0 S=0 U=0 F=0
kfade[5].ub1spare:                    0 ; 0x1e9: 0x00
kfade[5].ub2spare:                    0 ; 0x1ea: 0x0000
kfade[6].entry.incarn:                0 ; 0x1ec: A=0 NUMM=0x0
kfade[6].entry.hash:                  0 ; 0x1f0: 0x00000000
kfade[6].entry.refer.number:          0 ; 0x1f4: 0x00000000
kfade[6].entry.refer.incarn:          0 ; 0x1f8: A=0 NUMM=0x0
kfade[6].name:                          ; 0x1fc: length=0
kfade[6].fnum:                        0 ; 0x22c: 0x00000000
kfade[6].finc:                        0 ; 0x230: 0x00000000
kfade[6].flags:                       0 ; 0x234: U=0 S=0 S=0 U=0 F=0
kfade[6].ub1spare:                    0 ; 0x235: 0x00
kfade[6].ub2spare:                    0 ; 0x236: 0x0000
kfade[7].entry.incarn:                0 ; 0x238: A=0 NUMM=0x0
kfade[7].entry.hash:                  0 ; 0x23c: 0x00000000
.......省略部分内容

这里以system为例,你在asm看到的该file名实际上是:system.256.776886753。当你知道了
所有的datafile对应关系之后,那么一切就非常简单了。 如果你的asm 实例无法mount,那么需要恢复时,
可以手工用amdu将datafile全部抽取出来,然后找到上面的asm alias对应关系,将文件逐一重命名,最后
重建controlfile即可,当然,你可以可以直接抽取controlfile。

最后,如果是要实现最大程度的恢复,可能你还需要抽取redo和archivelog,方法都是一样的,不多说。

补充:
1. 实际上,只有你能把文件都抽取处理啊,将数据库mount以后,即使不知道文件名,也是可以进行rename操作的。
2. 目前odu是支持asm的,可以直接抽取数据文件,貌似比amdu更强悍一些,由于admu本身对数据的要求较高,某些情况下
可能使用amdu是无法抽取的,使用odu反而可以。
3. dul10 目前也是支持asm 的,大家可以测试一下。

你可能感兴趣的:(Oracle)