Disk Structure Command for ASM - asmdisks

In my firm we have a seperation between System guys to the DBAs, we don't have root privileges. this is the reason that they are peparing us the ASM disks.
After using "/etc/init.d/oracleasm createdisk..." I tailored a script to see all the information that I can get WITHOUT the need to connect to the ASM instance.
#!/bin/ksh

export ORACLE_HOME=`grep ASM /etc/oratab | cut -d: -f2`
export PATH=$PATH:~$user/dba/scripts/bin:$ORACLE_HOME/bin
export SID=`grep ASM /etc/oratab | cut -d: -f1`

printf "\n%-15s %-14s %-11s %s\n" "ASM disk" "based on" "Minor,Major" "Size (Mb)"
printf "%-15s %-14s %-11s %s\n" "===============" "=============" "===========" "========="
for i in `/etc/init.d/oracleasm listdisks`
do
v_asmdisk=`/etc/init.d/oracleasm querydisk $i | awk '{print $2}' | sed 's/\"//g'`
v_minor=`/etc/init.d/oracleasm querydisk $i | awk -F[ '{print $2}' | awk -F] '{print $1}' | awk '{print $1}'`
v_major=`/etc/init.d/oracleasm querydisk $i | awk -F[ '{print $2}' | awk -F] '{print $1}' | awk '{print $2}'`
v_device=`ls -la /dev | awk -v v_minor=$v_minor -v v_major=$v_major '{if ( $5==v_minor ) { if ( $6==v_major ) { print $10}}}'`
v_size=`${ORACLE_HOME}/bin/kfod asm_diskstring='ORCL:*' disks=all | grep ${v_asmdisk} | awk '{print $2}'`
Total_size=`expr $Total_size + $v_size`
printf "%-15s %-14s %-11s %s\n" $v_asmdisk "/dev/$v_device" "[$v_minor $v_major]" $v_size
done
printf "\nTotal: %43s\n\n" $Total_size

The output is:
>asmdisks

ASM disk        based on       Minor,Major Size (Mb)
=============== =============  =========== =========
MTSDB_DATA_01   /dev/dm-23     [253, 23]   98304
MTSDB_DATA_02   /dev/dm-24     [253, 24]   98304
MTSDB_DATA_03   /dev/dm-25     [253, 25]   98304
MTSDB_DATA_04   /dev/dm-26     [253, 26]   98304
MTSDB_DATA_05   /dev/dm-6      [253, 6]    98304
MTSDB_DATA_06   /dev/dm-7      [253, 7]    98304
MTSDB_DATA_07   /dev/dm-8      [253, 8]    98304
MTSDB_DATA_08   /dev/dm-9      [253, 9]    98304
MTSDB_DATA_09   /dev/dm-10     [253, 10]   98304
MTSDB_DATA_10   /dev/dm-11     [253, 11]   98304
MTSDB_DATA_11   /dev/dm-12     [253, 12]   98304
MTSDB_DATA_12   /dev/dm-13     [253, 13]   98304
MTSDB_DATA_13   /dev/dm-14     [253, 14]   98304
MTSDB_DATA_14   /dev/dm-15     [253, 15]   98304
MTSDB_DATA_15   /dev/dm-16     [253, 16]   98304
MTSDB_DATA_16   /dev/dm-17     [253, 17]   98304
MTSDB_DATA_17   /dev/dm-18     [253, 18]   98304
MTSDB_DATA_18   /dev/dm-19     [253, 19]   98304
MTSDB_DATA_19   /dev/dm-20     [253, 20]   98304
MTSDB_DATA_20   /dev/dm-21     [253, 21]   98304

Total:                                     1966080

Comments

sve said…
Hi,

Just wanted to tell you that by some reason all the pipes in the shell script are gone and the script is not working property. Otherwise both script are great, thanks.

Popular posts from this blog

Fixing & Registering ORACLE_HOMES in Central Inventory

Export in Pl/Sql via DBMS_DATAPUMP