Oracle … as usual

Oracle by Laurent Leturgez

Dump ASM disk header

If you want to dump ASM disk header, you can use an Oracle internal tool to obtain information about your disk, diskgroup etc. even if the disk is offline.

This tool is named KFED (Kernel File EDitor). It is fitted by default with an Oracle 11g installation, but you’ll need to build it  if you want to use it with Oracle 10g :

[oracle@oel ~]$ make -f $ORACLE_HOME/rdbms/lib/ins_rdbms.mk ikfed

Well, now have a closer look to a feature of this tool.

If you want to read information stored on the ASM Disk header, you can use it like this :

[oracle@oel ~]$ kfed read /dev/oracleasm/disks/ASM3 dsk1.dump

Now, you have in the dsk1.dump file the content of your ASM file header “/dev/oracleasm/disks/ASM3”. This file can be easily read by a text editor

 
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: T=0 NUMB=0x0
kfbh.block.obj:              2147483648 ; 0x008: TYPE=0x8 NUMB=0x0
kfbh.check:                  2930000864 ; 0x00c: 0xaea443e0
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:     ORCLDISKASM3 ; 0x000: length=12
kfdhdb.driver.reserved[0]:    860705601 ; 0x008: 0x334d5341
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:                186646528 ; 0x020: 0x0b200000
kfdhdb.dsknum:                        0 ; 0x024: 0x0000
kfdhdb.grptyp:                        2 ; 0x026: KFDGTP_NORMAL
kfdhdb.hdrsts:                        3 ; 0x027: KFDHDR_MEMBER
kfdhdb.dskname:          MIRROR_DG_0000 ; 0x028: length=14
kfdhdb.grpname:               MIRROR_DG ; 0x048: length=9
kfdhdb.fgname:           MIRROR_DG_0000 ; 0x068: length=14
kfdhdb.capname:                         ; 0x088: length=0
kfdhdb.crestmp.hi:             32959021 ; 0x0a8: HOUR=0xd DAYS=0x11 MNTH=0xa YEAR=0x7db
kfdhdb.crestmp.lo:           3500063744 ; 0x0ac: USEC=0x0 MSEC=0x3af SECS=0x9 MINS=0x34
kfdhdb.mntstmp.hi:             32959382 ; 0x0b0: HOUR=0x16 DAYS=0x1c MNTH=0xa YEAR=0x7db
kfdhdb.mntstmp.lo:            505578496 ; 0x0b4: USEC=0x0 MSEC=0xa1 SECS=0x22 MINS=0x7
kfdhdb.secsize:                     512 ; 0x0b8: 0x0200
kfdhdb.blksize:                    4096 ; 0x0ba: 0x1000
kfdhdb.ausize:                  1048576 ; 0x0bc: 0x00100000
kfdhdb.mfact:                    113792 ; 0x0c0: 0x0001bc80
kfdhdb.dsksize:                    1019 ; 0x0c4: 0x000003fb
kfdhdb.pmcnt:                         2 ; 0x0c8: 0x00000002
kfdhdb.fstlocn:                       1 ; 0x0cc: 0x00000001
kfdhdb.altlocn:                       2 ; 0x0d0: 0x00000002
kfdhdb.f1b1locn:                      2 ; 0x0d4: 0x00000002
kfdhdb.redomirrors[0]:                0 ; 0x0d8: 0x0000
kfdhdb.redomirrors[1]:                0 ; 0x0da: 0x0000
kfdhdb.redomirrors[2]:                0 ; 0x0dc: 0x0000
kfdhdb.redomirrors[3]:                0 ; 0x0de: 0x0000

Now, we can read some information about the file : on the structure “kfdhdb”, at the offset 0x048, and coded on 9 bytes, the name of the diskgroup which owns this ASM disk  file.

Most important information are detailed below :

* kfbh.endian: Endian used on this disk : 1 for little endian.

* kfdhdb.driver.provstr: Provision String used for ASM (which means in our case : ORCL:DISKASM3)

* kfdhdb.grptyp: type of diskgroup the disk is attached to.

* kfdhdb.hdrsts: header status. Here, the disk is a member of the diskgroup.

* kfdhdb.dskname: disk name in the disk group

* kfdhdb.grpname: disk group name

* kfdhdb.fgname: failure group name which owns the disk

* kfdhdb.secsize: sector size

* kfdhdb.blksize:  block size

* kfdhdb.ausize: allocation unit size

If you want to rename the diskgroup the disk belongs to, you can edit the dumpfile and use the “merge” command of KFED to apply changes to the disk header.

[oracle@oel ~]$ kfed merge /dev/oracleasm/disks/ASM3 text=dsk1.dump

Be careful when you use the “merge” command because, it seems the diskgroup name, or disk name is coded with a fixed length, so if you change the name, and this one is based on a 4 bytes word, rename it to a 4 bytes word.

Off course, using kfed is not supported by Oracle.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: