Post date: 22-Apr-2010 08:29:24
#!/bin/sh
echo "Generating ASM Disk Report"
# Create ASM disk report
# Here ORACLE_HOME=Software Home location for ASM
$ORACLE_HOME/bin/kfod disks=asm status=true > asm_mapping.rpt
# Loop through all device names and update the ASM disk Report
echo "Updating ASM Disk Report with device names"
for asmlabel in `ls /dev/oracleasm/disks/`
do
major=`ls -l /dev/oracleasm/disks/${asmlabel}|awk '{print $5}'|tr -d ','`
minor=`ls -l /dev/oracleasm/disks/${asmlabel}|awk '{print $6}'|tr -s " "`
partition=`cat /proc/partitions|tr -s " "|grep -we "${major} ${minor}"|awk '{print $4}'`
/usr/bin/perl -pi -e "s|`echo $asmlabel`|`echo $asmlabel - ${partition}`|" asm_mapping.rpt
done