Thursday, January 29, 2009

kfed... 11g tool


kfed utility was built on 11G... If using 10gR2 above, that can built:

$ cd $ORACLE_HOME/rdbms/lib
$ make -f ins_rdbms.mk ikfed 

Linking KFED utility (kfed)
rm -f $ORACLE_HOME/rdbms/lib/kfed
gcc -o $ORACLE_HOME/rdbms/lib/kfed -L$ORACLE_HOME/rdbms/lib/ -L$ORACLE_HOME/lib/ -L$ORACLE_HOME/lib/stubs/  $ORACLE_HOME/lib/s0main.o $ORACLE_HOME/rdbms/lib/sskfeded.o $ORACLE_HOME/rdbms/lib/skfedpt.o  $ORACLE_HOME/rdbms/lib/defopt.o -ldbtools10 -lclntsh  `cat $ORACLE_HOME/lib/ldflags`    -lnsslb10 -lncrypt10 -lnsgr10 -lnzjs10 -ln10 -lnnz10 -lnl10 -lnro10 `cat $ORACLE_HOME/lib/ldflags`    -lnsslb10 -lncrypt10 -lnsgr10 -lnzjs10 -ln10 -lnnz10 -lnl10 -lclient10 -lnnetd10  -lvsn10 -lcommon10 -lgeneric10 -lmm -lsnls10 -lnls10  -lcore10 -lsnls10 -lnls10 -lcore10 -lsnls10 -lnls10 -lxml10 -lcore10 -lunls10 -lsnls10 -lnls10 -lcore10 -lnls10 `cat $ORACLE_HOME/lib/ldflags`    -lnsslb10 -lncrypt10 -lnsgr10 -lnzjs10 -ln10 -lnnz10 -lnl10 -lnro10 `cat $ORACLE_HOME/lib/ldflags`    -lnsslb10 -lncrypt10 -lnsgr10 -lnzjs10 -ln10 -lnnz10 -lnl10 -lclient10 -lnnetd10  -lvsn10 -lcommon10 -lgeneric10   -lsnls10 -lnls10  -lcore10 -lsnls10 -lnls10 -lcore10 -lsnls10 -lnls10 -lxml10 -lcore10 -lunls10 -lsnls10 -lnls10 -lcore10 -lnls10 -lclient10 -lnnetd10  -lvsn10 -lcommon10 -lgeneric10 -lsnls10 -lnls10  -lcore10 -lsnls10 -lnls10 -lcore10 -lsnls10 -lnls10 -lxml10 -lcore10 -lunls10 -lsnls10 -lnls10 -lcore10 -lnls10   `cat $ORACLE_HOME/lib/sysliblist` -Wl,-rpath,$ORACLE_HOME/lib -lm    `cat $ORACLE_HOME/lib/sysliblist` -ldl -lm   -L$ORACLE_HOME/lib
mv -f $ORACLE_HOME/bin/kfed $ORACLE_HOME/bin/kfedO
mv: cannot stat `$ORACLE_HOME/bin/kfed': No such file or directory
make: [ikfed] Error 1 (ignored)
mv $ORACLE_HOME/rdbms/lib/kfed $ORACLE_HOME/bin/kfed
chmod 751 $ORACLE_HOME/bin/kfed
$ kfed -h

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]
d/ev            ASM device to examine or update [DEV=string]
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]

KFED, that can edit contents of ASM blocks and get informations about ASM.

If using ASMLIB:
$ cd /dev/oracleasm/disks/

$ ls
DATA1

$ kfed read DATA1 
.
.
.
kfdhdb.grptyp:                        1 ; 0x026: KFDGTP_EXTERNAL
kfdhdb.hdrsts:                        3 ; 0x027: KFDHDR_MEMBER
kfdhdb.dskname:                    DATA1 ; 0x028: length=4
kfdhdb.grpname:                    DATA ; 0x048: length=4
kfdhdb.fgname:                     DATA1 ; 0x068: length=4
.
.
.
Disk name = DATA1 on DATA(EXTERNAL Redundancy) diskgroup.

If using RAW DEVICE:
$ kfed read /dev/raw/raw1
.
.
.
kfdhdb.dsknum:                        0 ; 0x024: 0x0000
kfdhdb.grptyp:                        1 ; 0x026: KFDGTP_EXTERNAL
kfdhdb.hdrsts:                        3 ; 0x027: KFDHDR_MEMBER
kfdhdb.dskname:              DATA1_0000 ; 0x028: length=10
kfdhdb.grpname:                   DATA1 ; 0x048: length=5
kfdhdb.fgname:               DATA1_0000 ; 0x068: length=10
.
.
.
Disk name = DATA1_0000 on DATA1(EXTERNAL Redundancy) diskgroup.

If  found,
$ kfed  read /dev/emcpowera1 
KFED-00303: unable to open file ''

$ ls -l  /dev/emcpowera1
brw-------  1 root root 120, 1 Jan 23 16:52 /dev/emcpowera1

Because "oracle" user didn't have permission on this file.

Anyway "KFED-00303: unable to open file ''" Error, that can su to "root" user and ...
# $ORACLE_HOME/bin/kfed  read /dev/emcpowera1
.
.
.
kfdhdb.dsknum:                        0 ; 0x024: 0x0000
kfdhdb.grptyp:                        1 ; 0x026: KFDGTP_EXTERNAL
kfdhdb.hdrsts:                        3 ; 0x027: KFDHDR_MEMBER
kfdhdb.dskname:                    DATA1 ; 0x028: length=4
kfdhdb.grpname:                    DATA ; 0x048: length=4
kfdhdb.fgname:                     DATA1 ; 0x068: length=4
.
.
.

If that devicename 's not member on any diskgroups, that didn't find anything:

Example:
# kfed   read /dev/emcpowerb1 
kfbh.endian:                          0 ; 0x000: 0x00
kfbh.hard:                          130 ; 0x001: 0x82
kfbh.type:                            0 ; 0x002: KFBTYP_INVALID
kfbh.datfmt:                          0 ; 0x003: 0x00
kfbh.block.blk:              4290772992 ; 0x004: T=1 NUMB=0x7fc00000
kfbh.block.obj:                       0 ; 0x008: TYPE=0x0 NUMB=0x0
kfbh.check:                           0 ; 0x00c: 0x00000000
kfbh.fcn.base:                    39657 ; 0x010: 0x00009ae9
kfbh.fcn.wrap:                     4096 ; 0x014: 0x00001000
kfbh.spare1:                      61743 ; 0x018: 0x0000f12f
kfbh.spare2:                 2054913149 ; 0x01c: 0x7a7b7c7d
Actually kfed utility's Oracle Support tool.

Perhaps can read header and then save on text file.

$ kfed op=read  dev=/dev/raw/raw1  text=/tmp/raw1.text

No comments: