ASM support utilities
Some examples and comments on the use of ASM support utilies, in particular
kfed and
amdu.
These utilities allow troubleshooting of ASM diskgroups also with
unmounted diskgroups. Beware, kfed in write mode can corrupt your ASM config too.
Note: when ASM diskgroups can be mounted similar info are available in X$ tables as shown in
ASM_Internals.
Oracle support note ID 553639.1 has useful info on amdu and kfed.
AMDU
- Allows to dump ASM contents without opening diskgroups, allows to check ASM file mirroring when using normal redundancy
- powerful tool for troubleshooting, introduced in 11g, usable in 10g too.
- amdu run creates a directory with a
report.tx
file and the .map (and .img dump files (for metadata nad data, output dependson switches in the commandline )
- a few examples of interest:
# displays online help for the utility
$ amdu -help
# extracts file 267 from ASM diskgroup TEST4_DATADG1
# Note: works as asmcmd cp but olso on dismounted disk groups!
$ amdu -dis '/dev/mapper/itsto*p1' -extract TEST4_DATADG1.267
# compares primary and mirror extents in normal redundancy disk groups
# Useful to check for potential corruption issues
# results in the report.txt file
$ amdu -dis '/dev/mapper/itsto*p1' -compare -extract TEST4_DATADG1.267 -noextract
# dump contents of a given diskgroup and does not create image file
# the .map file reports on all files found (column number 5 prefixed by the letter F)
$ amdu -dis '/dev/mapper/itsto*p1' -noimage -dump TEST4_DATADG1
# print 10 blocks for the first extent of file 267
$ amdu -dis '/dev/mapper/itsto*p1' -print TEST4_DATADG1.F267.X1.B1.C10
Example: how to retrieve DB files from an unmounted diskgroup
KFED
- kfed can be used to read and write ASM metadata. In particular disk headers and ASM (hidden) metadata files.
- note: kfed in write mode is a powerful but potentially dangerous tool
# displays online help for the utility
$ kfed -help
# reads the disk header to stdout
$ kfed op=read dev=/dev/mapper/itstor741_11p1
# reads the specified AU and block into file /tmp/a
$ kfed op=read dev=/dev/mapper/itstor741_11p1 aunum=3 blknum=3 text=/tmp/a
# writes from /tmp/a into the specified AU and block
#block checksum is computed and written together with data
$ kfed op=write dev=/dev/mapper/itstor741_11p1 aunum=3 blknum=3 text=/tmp/a
Example: how to change an ASM diskgroup parameter on a dismounted disk group
- the parameter is in ASM (hidden) file #9
- find AUs that contain that information (can be up to 3 mirrored copies in a normal redundancy diskgroup with 3 or more failgroups)
- read current value into a flat file, update the file and write the updated file with checksum using kfed
- dismount and mount diskgroup to see change (query v$asm_attribute)
SQL> select DISK_KFFXP,AU_KFFXP,LXN_KFFXP,SIZE_KFFXP from x$kffxp where NUMBER_KFFXP=9 and GROUP_KFFXP=1;
DISK_NUMBER PATH
-------------- ----------------------------------------
41 /dev/mapper/itstor741_11p1
22 /dev/mapper/itstor739_10p1
34 /dev/mapper/itstor740_9p1
READ: kfed read /dev/mapper/itstor741_11p1 aunum=3 blknum=3 text=/tmp/a
EDIT: vi /tmp/a and change attribute value (for example change smart_scan_enable from TRUE to FALSE
to disable exadata smart scans in this particular diskgroup, note update length field too)
WRITE PRMARY EXTENT: kfed write /dev/mapper/itstor741_11p1 aunum=3 blknum=3 text=/tmp/a
WRITE SECODARY extents:
kfed write /dev/mapper/itstor739_10p1 aunum=3 blknum=3 text=/tmp/a
kfed write /dev/mapper/itstor740_9p1 aunum=2 blknum=3 text=/tmp/a
SQL> (dismount) and mount the group again to see the chagen in v$asm_attribute
How to use KFED and AMDU in 10g
kfed and amdu are available by default in 11g in $ORACLE_HOME/bin. In 10g one needs
- For
kfed
a link operation needs to be run:
cd $ORACLE_HOME/rdbms/lib
make -f ins_rdbms.mk kfed
- for amdu, one needs to download it from support. See note note ID 553639.1
- in alternative an installation of and additional ORACLE_HOME with 11gR2 binaries should also work for the purposes of using amdu
BBED
BBED is an Oracle internal utility to do BLOCKEDIT. It is extensively discussed at
http://www.orafaq.com/papers/dissassembling_the_data_block.pdf
BBED doesn't work on ASM by default. A work-around has been studied by
http://oracleprof.blogspot.com/2009/06/asm-and-bbed.html
An example to get started (BTW make of bbed does not seem to work on 11gR2)
cd $ORACLE_HOME/rdbms/lib
make -f ins_rdbms.mk $ORACLE_HOME/rdbms/lib/bbed
Dump an extent or an ASM file with the methods described above, for example:
amdu -dis '/dev/mapper/itsto*p1' -extract TEST4_DATADG1.555
Edit: vi bbed.par (or rather follow the explample in the ASMBBED link above)
blocksize=8192
datafile=/ORA/dbs01/oracle/home/work/amdu_2010_02_01_17_22_39/TEST2_DATADG1_555.f
mode=browse
Finally:
$ORACLE_HOME/rdbms/lib/bbed parfile=bbed.par
Revisions:
First version, Jan 2010,
Luca.Canali@cernNOSPAMPLEASE.ch