Focus On Oracle

Installing, Backup & Recovery, Performance Tuning,
Troubleshooting, Upgrading, Patching

Oracle Engineered System


当前位置: 首页 » 技术文章 » ASM

How to use kfed(Kernel Files metadata Editor)

kfed(Kernel Files metadata Editor),从11.1开始oracle提供了这个工具,如果在bin目录下没有找到,可以手工编译(仅限10.2以上的版本)。可以用来读写ASM元数据,当磁盘无法mount时,可以用来分析ASM磁盘头部信息。在写模式情况下,虽说很强大但也是一个具有危险性的工具,除非你足够自信。


$cd $ORACLE_HOME/rdbms/lib

$make -f ins_rdbms.mk ikfed

kfed帮助信息   
[orgrid@ohs1 ~]$ kfed
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]
v/erb           Verbose execution [verbose=YES|NO]
[orgrid@ohs1 ~]$
[orgrid@ohs1 ~]$
aun    --要读取的AU number,默认是AU0或者是磁盘的开始位置
aus    --AU大小,默认是1048576(1MB)。如果AU的大小不是默认的大小需指定
blkn   --要读取的块编号,默认是0

注意如果AU大小不是默认值,需要指定AU大小

kfed read <your_device> AUSZ=<au_size>


kfed读取ASM磁盘头部
[orgrid@ohs1 ~]$ kfed read /dev/oracleasm/disks/ASM1
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: blk=0
kfbh.block.obj:              2147483648 ; 0x008: disk=0
kfbh.check:                   555685456 ; 0x00c: 0x211f1650
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:     ORCLDISKASM1 ; 0x000: length=12
kfdhdb.driver.reserved[0]:    827151169 ; 0x008: 0x314d5341
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:                202375168 ; 0x020: 0x0c100000
kfdhdb.dsknum:                        0 ; 0x024: 0x0000
kfdhdb.grptyp:                        1 ; 0x026: KFDGTP_EXTERNAL
kfdhdb.hdrsts:                        3 ; 0x027: KFDHDR_MEMBER
kfdhdb.dskname:                    ASM1 ; 0x028: length=4
kfdhdb.grpname:                SYSTEMDG ; 0x048: length=8
kfdhdb.fgname:                     ASM1 ; 0x068: length=4
kfdhdb.capname:                         ; 0x088: length=0
kfdhdb.crestmp.hi:             33039490 ; 0x0a8: HOUR=0x2 DAYS=0x4 MNTH=0x9 YEAR=0x7e0
kfdhdb.crestmp.lo:           1108346880 ; 0x0ac: USEC=0x0 MSEC=0x2 SECS=0x21 MINS=0x10
kfdhdb.mntstmp.hi:             33039521 ; 0x0b0: HOUR=0x1 DAYS=0x5 MNTH=0x9 YEAR=0x7e0
kfdhdb.mntstmp.lo:           2443356160 ; 0x0b4: USEC=0x0 MSEC=0xaa SECS=0x1a MINS=0x24
kfdhdb.secsize:                     512 ; 0x0b8: 0x0200
kfdhdb.blksize:                    4096 ; 0x0ba: 0x1000
kfdhdb.ausize:                  1048576 ; 0x0bc: 0x00100000
kfdhdb.mfact:                    113792 ; 0x0c0: 0x0001bc80
kfdhdb.dsksize:                    8189 ; 0x0c4: 0x00001ffd
kfdhdb.pmcnt:                         3 ; 0x0c8: 0x00000003
kfdhdb.fstlocn:                       1 ; 0x0cc: 0x00000001
kfdhdb.altlocn:                       2 ; 0x0d0: 0x00000002
kfdhdb.f1b1locn:                     10 ; 0x0d4: 0x0000000a
kfdhdb.redomirrors[0]:                0 ; 0x0d8: 0x0000
kfdhdb.redomirrors[1]:                0 ; 0x0da: 0x0000
kfdhdb.redomirrors[2]:                0 ; 0x0dc: 0x0000
kfdhdb.redomirrors[3]:                0 ; 0x0de: 0x0000
kfdhdb.dbcompat:              168820736 ; 0x0e0: 0x0a100000
kfdhdb.grpstmp.hi:             33039490 ; 0x0e4: HOUR=0x2 DAYS=0x4 MNTH=0x9 YEAR=0x7e0
kfdhdb.grpstmp.lo:           1108274176 ; 0x0e8: USEC=0x0 MSEC=0x3bb SECS=0x20 MINS=0x10
kfdhdb.vfstart:                     224 ; 0x0ec: 0x000000e0
kfdhdb.vfend:                       256 ; 0x0f0: 0x00000100
kfdhdb.spfile:                       59 ; 0x0f4: 0x0000003b
kfdhdb.spfflg:                        1 ; 0x0f8: 0x00000001
kfdhdb.flags:                         1 ; 0x0fc: 0x00000001
kfdhdb.f1b1fcn.base:                  0 ; 0x100: 0x00000000
kfdhdb.f1b1fcn.wrap:                  0 ; 0x104: 0x00000000
kfdhdb.ub4spare[0]:                   0 ; 0x108: 0x00000000
kfdhdb.ub4spare[1]:                   0 ; 0x10c: 0x00000000
kfdhdb.ub4spare[2]:                   0 ; 0x110: 0x00000000
...
kfdhdb.ub4spare[50]:                  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
[orgrid@ohs1 ~]$ 

kfed读取指定的AU和块
[orgrid@ohs1 ~]$ kfed read dev=/dev/oracleasm/disks/ASM1 aunum=256 blknum=3
kfbh.endian:                          1 ; 0x000: 0x01
kfbh.hard:                          130 ; 0x001: 0x82
kfbh.type:                            8 ; 0x002: KFBTYP_CHNGDIR
kfbh.datfmt:                          1 ; 0x003: 0x01
kfbh.block.blk:                   11267 ; 0x004: blk=11267
kfbh.block.obj:                       3 ; 0x008: file=3
kfbh.check:                    17346484 ; 0x00c: 0x0108afb4
kfbh.fcn.base:                      951 ; 0x010: 0x000003b7
kfbh.fcn.wrap:                        0 ; 0x014: 0x00000000
kfbh.spare1:                          0 ; 0x018: 0x00000000
kfbh.spare2:                          0 ; 0x01c: 0x00000000
kfracdb.aba.seq:                      0 ; 0x000: 0x00000000
kfracdb.aba.blk:                    514 ; 0x004: 0x00000202
kfracdb.ents:                         0 ; 0x008: 0x0000
kfracdb.ub2spare:                     0 ; 0x00a: 0x0000
[orgrid@ohs1 ~]$ 

kfed异常的输出
只有当设备是ASM磁盘组的成员时,才会输出正确的格式,下面的输出是读取还未使用的盘
[orgrid@ohs1 ~]$ kfed read /dev/oracleasm/disks/ASM4
kfbh.endian:                          0 ; 0x000: 0x00
kfbh.hard:                            0 ; 0x001: 0x00
kfbh.type:                            0 ; 0x002: KFBTYP_INVALID
kfbh.datfmt:                          0 ; 0x003: 0x00
kfbh.block.blk:                       0 ; 0x004: blk=0
kfbh.block.obj:                       0 ; 0x008: file=0
kfbh.check:                   877482817 ; 0x00c: 0x344d5341
kfbh.fcn.base:                        0 ; 0x010: 0x00000000
kfbh.fcn.wrap:                        0 ; 0x014: 0x00000000
kfbh.spare1:                          0 ; 0x018: 0x00000000
kfbh.spare2:                          0 ; 0x01c: 0x00000000
000000000 00000000 00000000 00000000 344D5341  [............ASM4]
000000010 00000000 00000000 00000000 00000000  [................]
000000020 4C43524F 4B534944 344D5341 00000000  [ORCLDISKASM4....]
000000030 00000000 00000000 00000000 00000000  [................]
  Repeat 252 times
KFED-00322: Invalid content encountered during block traversal: [kfbtTraverseBlock][Invalid OSM block type][][0]
[orgrid@ohs1 ~]$ 

kfed write
[orgrid@ohs1 ~]$ kfed read /dev/oracleasm/disks/ASM1 text=ASM_HD.txt
[orgrid@ohs1 ~]$ kfed form /dev/oracleasm/disks/ASM1
[orgrid@ohs1 ~]$ kfed read /dev/oracleasm/disks/ASM1
kfbh.endian:                          0 ; 0x000: 0x00
kfbh.hard:                            0 ; 0x001: 0x00
kfbh.type:                            0 ; 0x002: KFBTYP_INVALID
kfbh.datfmt:                          0 ; 0x003: 0x00
kfbh.block.blk:                       0 ; 0x004: blk=0
kfbh.block.obj:                       0 ; 0x008: file=0
kfbh.check:                           0 ; 0x00c: 0x00000000
kfbh.fcn.base:                        0 ; 0x010: 0x00000000
kfbh.fcn.wrap:                        0 ; 0x014: 0x00000000
kfbh.spare1:                          0 ; 0x018: 0x00000000
kfbh.spare2:                          0 ; 0x01c: 0x00000000
000000000 00000000 00000000 00000000 00000000  [................]
  Repeat 255 times
KFED-00322: Invalid content encountered during block traversal: [kfbtTraverseBlock][Invalid OSM block type][][0]
[orgrid@ohs1 ~]$ kfed write /dev/oracleasm/disks/ASM1 text=ASM_HD.txt
[orgrid@ohs1 ~]$ kfed merge /dev/oracleasm/disks/ASM1 text=ASM_HD.txt
这里用kfed write或kfed merge都可以
[orgrid@ohs1 ~]$ kfed read /dev/oracleasm/disks/ASM1|more
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: blk=0
kfbh.block.obj:              2147483648 ; 0x008: disk=0
kfbh.check:                  2058004035 ; 0x00c: 0x7aaaa643
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:     ORCLDISKASM1 ; 0x000: length=12
kfdhdb.driver.reserved[0]:    827151169 ; 0x008: 0x314d5341
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:                202375168 ; 0x020: 0x0c100000
kfdhdb.dsknum:                        0 ; 0x024: 0x0000
kfdhdb.grptyp:                        1 ; 0x026: KFDGTP_EXTERNAL
kfdhdb.hdrsts:                        3 ; 0x027: KFDHDR_MEMBER
kfdhdb.dskname:                    ASM1 ; 0x028: length=4
kfdhdb.grpname:                SYSTEMDG ; 0x048: length=8
kfdhdb.fgname:                     ASM1 ; 0x068: length=4
kfdhdb.capname:                         ; 0x088: length=0
kfdhdb.crestmp.hi:             33039490 ; 0x0a8: HOUR=0x2 DAYS=0x4 MNTH=0x9 YEAR=0x7e0
kfdhdb.crestmp.lo:           1108346880 ; 0x0ac: USEC=0x0 MSEC=0x2 SECS=0x21 MINS=0x10
kfdhdb.mntstmp.hi:             33039538 ; 0x0b0: HOUR=0x12 DAYS=0x5 MNTH=0x9 YEAR=0x7e0
kfdhdb.mntstmp.lo:           3390511104 ; 0x0b4: USEC=0x0 MSEC=0x1c6 SECS=0x21 MINS=0x32
kfdhdb.secsize:                     512 ; 0x0b8: 0x0200
kfdhdb.blksize:                    4096 ; 0x0ba: 0x1000
kfdhdb.ausize:                  1048576 ; 0x0bc: 0x00100000
kfdhdb.mfact:                    113792 ; 0x0c0: 0x0001bc80
kfdhdb.dsksize:                    8189 ; 0x0c4: 0x00001ffd
kfdhdb.pmcnt:                         3 ; 0x0c8: 0x00000003
kfdhdb.fstlocn:                       1 ; 0x0cc: 0x00000001
kfdhdb.altlocn:                       2 ; 0x0d0: 0x00000002
kfdhdb.f1b1locn:                     10 ; 0x0d4: 0x0000000a
kfdhdb.redomirrors[0]:                0 ; 0x0d8: 0x0000
kfdhdb.redomirrors[1]:                0 ; 0x0da: 0x0000
kfdhdb.redomirrors[2]:                0 ; 0x0dc: 0x0000
kfdhdb.redomirrors[3]:                0 ; 0x0de: 0x0000
kfdhdb.dbcompat:              168820736 ; 0x0e0: 0x0a100000
[orgrid@ohs1 ~]$ 

kfed find
用来诊断并输出指定AU中的块的类型
[orgrid@ohs1 ~]$ kfed find /dev/oracleasm/disks/ASM1 aun=0
Block 0 has type 1
[orgrid@ohs1 ~]$ kfed find /dev/oracleasm/disks/ASM1 aun=1
Block 256 has type 17
Block 257 has type 17
...
...
...
Block 507 has type 13
Block 508 has type 13
Block 509 has type 13
Block 510 has type 1
Block 511 has type 19
[orgrid@ohs1 ~]$ kfed find /dev/oracleasm/disks/ASM1 aun=2
Block 512 has type 6
Block 513 has type 6
...

kfed struct
这个可以查看type和struct的
[orgrid@ohs1 ~]$ kfed struct
type     null             size    0 bytes    align 0 bytes
type     oratext          size    1 bytes    align 1 bytes
type     ub1              size    1 bytes    align 1 bytes
type     ub2              size    2 bytes    align 2 bytes
type     ub4              size    4 bytes    align 4 bytes
type     sb1              size    1 bytes    align 1 bytes
type     sb2              size    2 bytes    align 2 bytes
type     sb4              size    4 bytes    align 4 bytes
struct   kfcn             size    8 bytes    align 4 bytes
type     kfrs             size    1 bytes    align 1 bytes
type     kftslo           size    4 bytes    align 4 bytes
type     kftshi           size    4 bytes    align 4 bytes
struct   kfts             size    8 bytes    align 4 bytes
type     kfsts            size    4 bytes    align 4 bytes
type     kfgpconttype     size    1 bytes    align 1 bytes
type     kfcop            size    2 bytes    align 2 bytes
type     kfobj            size    4 bytes    align 4 bytes
type     kfblk            size    4 bytes    align 4 bytes
struct   kfbl             size    8 bytes    align 4 bytes
type     kfbtyp           size    1 bytes    align 1 bytes
struct   kfblnk           size    4 bytes    align 2 bytes
type     kfxpf            size    1 bytes    align 1 bytes
struct   kfxp             size    8 bytes    align 4 bytes
struct   kfbh             size   32 bytes    align 4 bytes
struct   kfraba           size    8 bytes    align 4 bytes
struct   kfracdb          size   12 bytes    align 4 bytes
type     kfrts            size    4 bytes    align 4 bytes
struct   kfracdb2         size   20 bytes    align 4 bytes
struct   kfracdc          size   84 bytes    align 4 bytes
type     kfrvbyte         size    1 bytes    align 1 bytes
struct   kfrlge           size   12 bytes    align 4 bytes
struct   kfrvan           size   12 bytes    align 4 bytes
struct   kfrvbn           size    8 bytes    align 4 bytes
type     kfrcdf           size    2 bytes    align 2 bytes
struct   kfrbcd           size   28 bytes    align 4 bytes
struct   kfrbwr           size   16 bytes    align 4 bytes
struct   kfrbwr1          size   24 bytes    align 4 bytes
struct   kfrbwr2          size   32 bytes    align 4 bytes
struct   kfrbwr3          size   40 bytes    align 4 bytes
struct   kfrcbg           size   12 bytes    align 4 bytes
type     bgdata           size    0 bytes    align 0 bytes
struct   kfrcrb10         size   12 bytes    align 4 bytes
struct   kfrcrb           size    2 bytes    align 2 bytes
struct   kfrcdt           size    8 bytes    align 4 bytes
struct   kfrcrbv          size   16 bytes    align 4 bytes
struct   kfrcrdt          size    4 bytes    align 2 bytes
type     kffbin           size    4 bytes    align 4 bytes
struct   kffban           size    8 bytes    align 4 bytes
type     kffdin           size    4 bytes    align 4 bytes
struct   kffdan           size    8 bytes    align 4 bytes
struct   kffbnd           size   12 bytes    align 4 bytes
struct   kffdnd           size   36 bytes    align 4 bytes
struct   kffden           size   16 bytes    align 4 bytes
struct   kffvda           size   20 bytes    align 4 bytes
type     kffdhf           size    1 bytes    align 1 bytes
struct   kffdhb           size   16 bytes    align 4 bytes
struct   kffdhe           size   12 bytes    align 4 bytes
struct   kfzdan           size    4 bytes    align 2 bytes
type     kfdisk           size    2 bytes    align 2 bytes
type     kfdmask          size    1 bytes    align 1 bytes
type     kfsphflg         size    4 bytes    align 4 bytes
type     kfdmode          size    1 bytes    align 1 bytes
type     kfdhdr           size    1 bytes    align 1 bytes
type     kfdsta           size    1 bytes    align 1 bytes
type     kfdgtp           size    1 bytes    align 1 bytes
type     kfdasz           size    1 bytes    align 1 bytes
type     kfdvasz          size    1 bytes    align 1 bytes
type     kfdcl            size    1 bytes    align 1 bytes
type     kfdzn            size    1 bytes    align 1 bytes
struct   kfddrb           size   32 bytes    align 4 bytes
struct   kfdhdb           size  480 bytes    align 4 bytes
type     kfdat0           size    4 bytes    align 4 bytes
type     kfdat1           size    4 bytes    align 4 bytes
type     kfdat2           size    4 bytes    align 4 bytes
struct   kfdata           size    8 bytes    align 4 bytes
struct   kfdatf           size    8 bytes    align 4 bytes
union    kfdate           size    8 bytes    align 4 bytes
struct   kfdatt           size    4 bytes    align 2 bytes
struct   kfdatt10         size    8 bytes    align 2 bytes
struct   kfdatb           size   40 bytes    align 4 bytes
struct   kfdatb10         size   40 bytes    align 4 bytes
type     kfdfsf           size    1 bytes    align 1 bytes
struct   kfdatrbk         size    8 bytes    align 4 bytes
struct   kfdfsb           size   24 bytes    align 4 bytes
struct   kfdfsb10         size    8 bytes    align 4 bytes
type     kfdfse0          size    1 bytes    align 1 bytes
struct   kfdfse           size    1 bytes    align 1 bytes
struct   kfdfse10         size    4 bytes    align 2 bytes
struct   kfdcls           size   16 bytes    align 4 bytes
struct   kfdzon           size   80 bytes    align 4 bytes
struct   kfdsLoc          size   12 bytes    align 4 bytes
struct   kfdsDdLoc        size   16 bytes    align 4 bytes
type     kfddchfl         size    1 bytes    align 1 bytes
struct   kfddde           size  448 bytes    align 4 bytes
struct   kfdvan           size   52 bytes    align 4 bytes
struct   kfdvaa           size   24 bytes    align 4 bytes
struct   kfdval           size   28 bytes    align 4 bytes
struct   kfdvap           size    8 bytes    align 4 bytes
struct   kfdvav           size    4 bytes    align 2 bytes
struct   kfdvaz           size    8 bytes    align 4 bytes
struct   kfdvfn           size   12 bytes    align 4 bytes
struct   kfdvfv           size    4 bytes    align 2 bytes
struct   kfdvfc           size   12 bytes    align 4 bytes
struct   kfdvfz           size    4 bytes    align 2 bytes
struct   kfdvda           size  132 bytes    align 4 bytes
struct   kfdvdad          size  136 bytes    align 4 bytes
struct   kfdvdads         size  140 bytes    align 4 bytes
struct   kfdvdu           size   16 bytes    align 4 bytes
struct   kfdvdz           size   12 bytes    align 4 bytes
struct   kfdvdt           size    8 bytes    align 4 bytes
struct   kfdvdsl          size   20 bytes    align 4 bytes
struct   kfdvdut          size    8 bytes    align 4 bytes
struct   kfdvdrt          size    8 bytes    align 4 bytes
struct   kfdvdrd          size   12 bytes    align 4 bytes
struct   kfdvrtm          size   12 bytes    align 4 bytes
struct   kfdvdslot        size    4 bytes    align 2 bytes
struct   kfdvdcf          size    4 bytes    align 2 bytes
struct   kfdase           size   28 bytes    align 2 bytes
struct   kfdasc           size   40 bytes    align 4 bytes
struct   kfdDrtimerCod    size 1260 bytes    align 4 bytes
type     kffile           size    4 bytes    align 4 bytes
struct   kffn             size    8 bytes    align 4 bytes
type     kfffdf           size    1 bytes    align 1 bytes
struct   kfffdb           size 1184 bytes    align 4 bytes
struct   kfffde           size    8 bytes    align 4 bytes
struct   kffixb           size   12 bytes    align 4 bytes
struct   kffixe           size    8 bytes    align 4 bytes
struct   kfflhe           size   28 bytes    align 4 bytes
type     kfdscf           size    1 bytes    align 1 bytes
struct   kfdscd           size    8 bytes    align 4 bytes
struct   kfdsc            size   16 bytes    align 4 bytes
type     kfdpoco          size    1 bytes    align 1 bytes
struct   kfdpoce          size   24 bytes    align 4 bytes
struct   kfdpoc           size   24 bytes    align 4 bytes
type     kffrbkf          size    2 bytes    align 2 bytes
struct   kffrbk10         size   32 bytes    align 4 bytes
struct   kffrbk           size   72 bytes    align 4 bytes
struct   kffvbn           size   16 bytes    align 4 bytes
struct   kffvba           size   20 bytes    align 4 bytes
struct   kffvdn           size   44 bytes    align 4 bytes
struct   kffvdo           size   16 bytes    align 4 bytes
struct   kffvdp           size    8 bytes    align 4 bytes
struct   kffvfn           size   24 bytes    align 4 bytes
struct   kffvfa           size   68 bytes    align 4 bytes
struct   kffvfax          size   72 bytes    align 4 bytes
struct   kffvfaxl         size   76 bytes    align 4 bytes
struct   kffvfaxl2        size  120 bytes    align 4 bytes
struct   kffvpa           size   40 bytes    align 4 bytes
struct   kffvfs           size   16 bytes    align 4 bytes
struct   kffvfu           size   12 bytes    align 4 bytes
struct   kffvfw           size    8 bytes    align 4 bytes
struct   kffvfx           size   12 bytes    align 4 bytes
struct   kffvln           size    4 bytes    align 4 bytes
struct   kffvlu           size   32 bytes    align 4 bytes
struct   kffvin           size    8 bytes    align 4 bytes
struct   kffvix           size    8 bytes    align 2 bytes
type     kffvalf          size    1 bytes    align 1 bytes
struct   kffval           size   12 bytes    align 4 bytes
struct   kffvcm           size    8 bytes    align 4 bytes
struct   kffvum           size    8 bytes    align 4 bytes
struct   kffvbs           size    4 bytes    align 4 bytes
struct   kffvxs           size   40 bytes    align 4 bytes
struct   kffvfz           size   12 bytes    align 4 bytes
struct   kffvzn           size    4 bytes    align 2 bytes
struct   kffzrbk          size   16 bytes    align 4 bytes
struct   kffvfmtsz        size    4 bytes    align 4 bytes
struct   kffvreuse        size   12 bytes    align 4 bytes
type     kftmdf           size    4 bytes    align 4 bytes
struct   kftmta           size  120 bytes    align 4 bytes
struct   kftmde           size  136 bytes    align 4 bytes
struct   kftvta           size   92 bytes    align 4 bytes
struct   kftvtu           size   48 bytes    align 4 bytes
type     kfadef           size    1 bytes    align 1 bytes
type     kfaflg           size    1 bytes    align 1 bytes
struct   kfanm            size  258 bytes    align 2 bytes
struct   kfade            size   76 bytes    align 4 bytes
struct   kfavent          size   84 bytes    align 4 bytes
struct   kfavcmt          size    4 bytes    align 4 bytes
struct   kfacrb           size  528 bytes    align 4 bytes
type     kfeflags         size    2 bytes    align 2 bytes
struct   kfede            size  372 bytes    align 4 bytes
struct   kfevadd          size  344 bytes    align 4 bytes
struct   kfevupd          size    8 bytes    align 2 bytes
struct   kfevcv           size    4 bytes    align 4 bytes
struct   kfsb8            size   12 bytes    align 4 bytes
struct   kfdusde          size   24 bytes    align 4 bytes
struct   kfdusvd          size   28 bytes    align 4 bytes
type     kfdvasn          size    4 bytes    align 4 bytes
struct   kfdvale          size    8 bytes    align 4 bytes
struct   kfdvalh          size   12 bytes    align 4 bytes
struct   kfdvavlu         size    8 bytes    align 4 bytes
struct   kfdvath          size   12 bytes    align 4 bytes
struct   kfdvatac         size    8 bytes    align 4 bytes
struct   kfdvavtan        size    8 bytes    align 4 bytes
struct   kfdvavtac        size   44 bytes    align 4 bytes
struct   kfdvavtas        size    4 bytes    align 2 bytes
struct   kfdvavtfu        size    4 bytes    align 2 bytes
struct   kfdvavtfd        size    8 bytes    align 2 bytes
struct   kfdvavtfs        size    4 bytes    align 2 bytes
struct   kfdsde           size 3956 bytes    align 4 bytes
struct   kfdvsde          size 3960 bytes    align 4 bytes
struct   kfzude11         size 4028 bytes    align 4 bytes
struct   kfzude           size 4028 bytes    align 4 bytes
struct   kfzudeuv         size  308 bytes    align 4 bytes
struct   kfzudeav         size  328 bytes    align 4 bytes
struct   kfzgde           size 4028 bytes    align 4 bytes
struct   kfzgdeav         size   92 bytes    align 4 bytes
struct   kfzgdeuv         size  140 bytes    align 4 bytes
type     kfvvdes          size    1 bytes    align 1 bytes
struct   kfvvde           size 2220 bytes    align 4 bytes
struct   kfvdav           size  148 bytes    align 4 bytes
struct   kfvduv           size 1140 bytes    align 4 bytes
struct   kfcvlm           size    8 bytes    align 4 bytes
struct   kfdpHdrBv0       size   36 bytes    align 4 bytes
struct   kfdpHdrBv1       size  132 bytes    align 4 bytes
type     pstFlag_kfdpHdrBv1 size    4 bytes    align 4 bytes
struct   kfdpHdrPairBv1   size  264 bytes    align 4 bytes
type     kfdpDtaIdx       size    4 bytes    align 4 bytes
type     kfdpDtaStatv0    size    4 bytes    align 4 bytes
struct   kfdpDtaEv0       size   48 bytes    align 4 bytes
type     kfdpDtaStatv1    size    2 bytes    align 2 bytes
type     kfdpDtaPart      size    2 bytes    align 2 bytes
struct   kfdpDtaEv1       size   48 bytes    align 4 bytes
struct   kfdpHbeatB       size   28 bytes    align 4 bytes
struct   kfdsHdrB         size   12 bytes    align 4 bytes
type     kfgrbs           size    1 bytes    align 1 bytes
struct   kfgrb            size   12 bytes    align 4 bytes
struct   kfspbals         size  268 bytes    align 4 bytes
struct   kfsphcv          size    8 bytes    align 4 bytes
struct   kfddhcv          size   32 bytes    align 1 bytes
struct   kfzpdb           size 4064 bytes    align 4 bytes
struct   kfzpvba          size   32 bytes    align 4 bytes
struct   kfzpvbu          size  528 bytes    align 4 bytes
struct   kfzpfbu          size   12 bytes    align 4 bytes

kfed form,kfed repair
这个会把磁盘头部格式化掉,op=repair可以修复磁盘组的头部
[orgrid@ohs1 ~]$ kfed form /dev/oracleasm/disks/ASM1
[orgrid@ohs1 ~]$ kfed read /dev/oracleasm/disks/ASM1
kfbh.endian:                          0 ; 0x000: 0x00
kfbh.hard:                            0 ; 0x001: 0x00
kfbh.type:                            0 ; 0x002: KFBTYP_INVALID
kfbh.datfmt:                          0 ; 0x003: 0x00
kfbh.block.blk:                       0 ; 0x004: blk=0
kfbh.block.obj:                       0 ; 0x008: file=0
kfbh.check:                           0 ; 0x00c: 0x00000000
kfbh.fcn.base:                        0 ; 0x010: 0x00000000
kfbh.fcn.wrap:                        0 ; 0x014: 0x00000000
kfbh.spare1:                          0 ; 0x018: 0x00000000
kfbh.spare2:                          0 ; 0x01c: 0x00000000
000000000 00000000 00000000 00000000 00000000  [................]
  Repeat 255 times
KFED-00322: Invalid content encountered during block traversal: [kfbtTraverseBlock][Invalid OSM block type][][0]
[orgrid@ohs1 ~]$ kfed repair /dev/oracleasm/disks/ASM1
[orgrid@ohs1 ~]$ kfed read /dev/oracleasm/disks/ASM1|more
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: blk=0
kfbh.block.obj:              2147483648 ; 0x008: disk=0
kfbh.check:                  2058004035 ; 0x00c: 0x7aaaa643
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:     ORCLDISKASM1 ; 0x000: length=12
kfdhdb.driver.reserved[0]:    827151169 ; 0x008: 0x314d5341
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:                202375168 ; 0x020: 0x0c100000
kfdhdb.dsknum:                        0 ; 0x024: 0x0000
kfdhdb.grptyp:                        1 ; 0x026: KFDGTP_EXTERNAL
kfdhdb.hdrsts:                        3 ; 0x027: KFDHDR_MEMBER
kfdhdb.dskname:                    ASM1 ; 0x028: length=4
kfdhdb.grpname:                SYSTEMDG ; 0x048: length=8
kfdhdb.fgname:                     ASM1 ; 0x068: length=4
kfdhdb.capname:                         ; 0x088: length=0
kfdhdb.crestmp.hi:             33039490 ; 0x0a8: HOUR=0x2 DAYS=0x4 MNTH=0x9 YEAR=0x7e0
kfdhdb.crestmp.lo:           1108346880 ; 0x0ac: USEC=0x0 MSEC=0x2 SECS=0x21 MINS=0x10
kfdhdb.mntstmp.hi:             33039538 ; 0x0b0: HOUR=0x12 DAYS=0x5 MNTH=0x9 YEAR=0x7e0
kfdhdb.mntstmp.lo:           3390511104 ; 0x0b4: USEC=0x0 MSEC=0x1c6 SECS=0x21 MINS=0x32
kfdhdb.secsize:                     512 ; 0x0b8: 0x0200
kfdhdb.blksize:                    4096 ; 0x0ba: 0x1000
kfdhdb.ausize:                  1048576 ; 0x0bc: 0x00100000
kfdhdb.mfact:                    113792 ; 0x0c0: 0x0001bc80
kfdhdb.dsksize:                    8189 ; 0x0c4: 0x00001ffd
kfdhdb.pmcnt:                         3 ; 0x0c8: 0x00000003
kfdhdb.fstlocn:                       1 ; 0x0cc: 0x00000001
kfdhdb.altlocn:                       2 ; 0x0d0: 0x00000002
kfdhdb.f1b1locn:                     10 ; 0x0d4: 0x0000000a
kfdhdb.redomirrors[0]:                0 ; 0x0d8: 0x0000
kfdhdb.redomirrors[1]:                0 ; 0x0da: 0x0000
kfdhdb.redomirrors[2]:                0 ; 0x0dc: 0x0000
kfdhdb.redomirrors[3]:                0 ; 0x0de: 0x0000
kfdhdb.dbcompat:              168820736 ; 0x0e0: 0x0a100000
[orgrid@ohs1 ~]$
读取目录信息
kfed read /dev/oracleasm/disks/ASM1 aunum=10 blknum=1 (这个块是File Directory的信息)


更新chksum

这个在chksum值不对的时候可以用来纠正

kfed read /dev/oracleasm/disks/ASM1 aun=0 blkn=2 text=/tmp/ASM1_aun0_blkn2.kfed
kfed write  /dev/oracleasm/disks/ASM1  aun=0 blkn=2 text=/tmp/ASM1_aun0_blkn2.kfed chksum=yes

kfed使dropped的磁盘组online

SQL> select name,path from v$asm_disk;
NAME                           PATH
------------------------------ --------------------
                               ORCL:ASM4
ASM1                           ORCL:ASM1
ASM2                           ORCL:ASM2
ASM3                           ORCL:ASM3
ASM5                           ORCL:ASM5
SQL>
SQL> drop diskgroup fra_pgold;
Diskgroup dropped.
SQL> !asmcmd
ASMCMD> lsdg
State    Type    Rebal  Sector  Block       AU  Total_MB  Free_MB  Req_mir_free_MB  Usable_file_MB  Offline_disks  Voting_files  Name
MOUNTED  NORMAL  N         512   4096  1048576     16362     9458                0            4729              0             N  DATA_PGOLD/
MOUNTED  EXTERN  N         512   4096  1048576      8189     3712                0            3712              0             Y  SYSTEMDG/
ASMCMD> exit
SQL> select name,path from v$asm_disk;
NAME                           PATH
------------------------------ --------------------
                               ORCL:ASM4
                               ORCL:ASM2
ASM1                           ORCL:ASM1
ASM3                           ORCL:ASM3
ASM5                           ORCL:ASM5
[orgrid@ohs1 ~]$ grep kfdhdb.hdrsts FRA_PGOLD.txt
kfdhdb.hdrsts:                        4 ; 0x027: KFDHDR_FORMER
[orgrid@ohs1 ~]$

编辑FRA_PGOLD.txt文件,修改头部状态

变更前

kfdhdb.hdrsts:                        4 ; 0x027: KFDHDR_FORMER

变更后

kfdhdb.hdrsts:                        3 ; 0x027: KFDHDR_MEMBER
检查头部状态
[orgrid@ohs1 ~]$ grep kfdhdb.hdrsts FRA_PGOLD.txt
kfdhdb.hdrsts:                        3 ; 0x027: KFDHDR_MEMBER
[orgrid@ohs1 ~]$
SQL> col name for a20
SQL> col path for a20
SQL> select name,path,header_status from v$asm_disk;
NAME                 PATH                 HEADER_STATU
-------------------- -------------------- ------------
                     ORCL:ASM4            CANDIDATE
                     ORCL:ASM2            MEMBER
ASM1                 ORCL:ASM1            MEMBER
ASM3                 ORCL:ASM3            MEMBER
ASM5                 ORCL:ASM5            MEMBER
SQL> alter diskgroup FRA_PGOLD mount;
Diskgroup altered.
SQL> select name,path,header_status from v$asm_disk;
NAME                 PATH                 HEADER_STATU
-------------------- -------------------- ------------
                     ORCL:ASM4            CANDIDATE
ASM1                 ORCL:ASM1            MEMBER
ASM2                 ORCL:ASM2            MEMBER
ASM3                 ORCL:ASM3            MEMBER
ASM5                 ORCL:ASM5            MEMBER
SQL> !asmcmd lsdg
State    Type    Rebal  Sector  Block       AU  Total_MB  Free_MB  Req_mir_free_MB  Usable_file_MB  Offline_disks  Voting_files  Name
MOUNTED  NORMAL  N         512   4096  1048576     16362     9458                0            4729              0             N  DATA_PGOLD/
MOUNTED  EXTERN  N         512   4096  1048576      4102     4006                0            4006              0             N  FRA_PGOLD/
MOUNTED  EXTERN  N         512   4096  1048576      8189     3712                0            3712              0             Y  SYSTEMDG/
SQL>
[orgrid@ohs1 ~]$ oracleasm querydisk -p ASM2
Disk "ASM2" is a valid ASM disk
[orgrid@ohs1 ~]$

Reference

Note 1180491.1 - KFED Tool For Windows OS.
Note 1346190.1 - KFED.PL for diagnosing - ORA-15036 ORA-15042 ORA-15020 ORA-15033

NOTE:553639.1 - Placeholder for AMDU binaries and using with ASM 10g


关键词:asm 

相关文章

12c 如何将Standard ASM转化为Flex ASM
How to use amdu(ASM Metadata Dump Utility)
How to use kfed(Kernel Files metadata Editor)
How to use kfod(Kernel Files OSM Disk)
如何计算ASM磁盘头自动备份的位置
What is disk_repair_time?
Find block in ASM
12c新特性ASMFD
asmcmd之文件访问控制管理
asmcmd之卷管理
asmcmd之模板管理
asmcmd之磁盘组管理

联系我们

Top
Cell186-9589-1286
QQ 375349564
E-mail ohsdba@qq.com