Thursday, July 25, 2013

ORACLE - ASM devices

List ASM devices:

#!/bin/ksh
for i in `sudo /etc/init.d/oracleasm listdisks`
do
v_asmdisk=`sudo /etc/init.d/oracleasm querydisk -d $i | awk  '{print $2}'`
v_minor=`sudo /etc/init.d/oracleasm querydisk -d $i | awk -F[ '{print $2}'| awk -F] '{print $1}' | awk -F, '{print $1}'`
v_major=`sudo /etc/init.d/oracleasm querydisk -d $i | awk -F[ '{print $2}'| awk -F] '{print $1}' | awk -F, '{print $2}'`
v_device=`ls -la /dev | grep -i $v_minor | grep -i $v_major | awk '{print $10}'`
echo "ASM disk $v_asmdisk based on /dev/$v_device  [$v_minor $v_major] " | grep ASM
done

Output:
ASM disk "D_JDDB_01" based on /dev/dm-9  [252 9]
ASM disk "D_JDDB_04" based on /dev/dm-12  [252 12]
ASM disk "D_JDDB_05" based on /dev/dm-13  [252 13]
ASM disk "D_JDDB_06" based on /dev/dm-14  [252 14]

No comments:

Post a Comment