df emulation in ASM - asmbdf

When talking ASM between DBAs and System guys I had to let them "see" the new filesystem in the way they are used to.
I parsed the output of asmcmd utility to be as close as it can be to the command in Unix/Linux, I called it asmbdf:

#!/bin/ksh

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

asmcmd lsdg | \
awk '{
if ( FNR == 1 )
{
printf "%-20s %10s %10s %10s %10s %-20s\n","Filesystem","Size","Used","Avail","Use%","Mounted on"
}
if ( FNR > 1 )
{
if ( $2 == "EXTERN" ) { REDUNDENCY=1 }
if ( $2 == "NORMAL" ) { REDUNDENCY=2 }
if ( $2 == "HIGH" ) { REDUNDENCY=3 }
printf "%-20s %10d %10d %10d %10.2f%% %-20s\n",$(NF),($8/REDUNDENCY)*1024,(($8-$9)/REDUNDENCY)*1024,($9/REDUNDENCY)*1024,($8-$9)/$8*100,$(NF)
}
}'
The output is:
>asmbdf
Filesystem                 Size       Used      Avail       Use% Mounted on          
DATA/                 301989888   99937280  202052608      33.09% DATA/               
FLASH_RECOVERY_AREA/   50331648    3042304   47289344       6.04% FLASH_RECOVERY_AREA/


Comments

Popular posts from this blog

Data Guard - Changing IP Addresses

Install Oracle Internet Directory (OID) in Standalone mode

Fixing & Registering ORACLE_HOMES in Central Inventory