Quantcast
Channel: Gokhan Atil’s Technology Blog
Viewing all articles
Browse latest Browse all 163

A Short Script to List Mappings of ASM Disks to Physical Devices

$
0
0

I got a warning mail from our Enterprise Manager Cloud Control, it says “Disk Device emcpowere1 is 98.468% busy.”. I logged into the server to see the busy disk. There were no related mount point points so it should be used by ASM, but because we use ASMLIB, I needed to query each ASM disk to see which physical device it’s mapped to.

If you have a few disks, it won’t take time to check each disk using “oracleasm querydisk -p” but we have over 10 disks so I wrote a short script to query all ASM disks:

#!/bin/bash

ORACLEASM=/etc/init.d/oracleasm

echo "ASM Disk Mappings"
echo "----------------------------------------------------"
for f in `$ORACLEASM listdisks`
do
dp=`$ORACLEASM querydisk -p  $f | head -2 | grep /dev | awk -F: '{print $1}'`
echo "$f: $dp"
done

I’m sure this script can be converted to a one-liner but I would prefer “readable” scripts. By the way, I used “head -2″ to eliminate additional disk aliases, otherwise script could produce such an output:

ASM Disk Mappings
----------------------------------------------------
DWHDGSATA01: /dev/emcpowerm1
DWHFRA01: /dev/emcpowerwa1
/dev/sdbj1
/dev/sdat1
DWHFRA02: /dev/emcpowerwd1

After I wrote the script, I checked My Oracle Support and see that there was a better script using “kfed” tool. You may check MoS Doc ID 1098682.1 to get the script.


Viewing all articles
Browse latest Browse all 163

Trending Articles