LATEST TOPICS

Script to check OS memory utilization for Oracle Instance

This shell script can be used to check, how much Physical Memmory a particular Oracle database instance is consuming on a Unix [Linux/SunOs] machine.

#!/bin/sh
### script to find the actual memory utilization by a oracle instance
### Name : get_inst_os_mem.sh
### Platform : Oracle Linux/RHEL, SunOS
### Author : Abu Fazal Mohammed Abbas
### Usage : get_inst_os_mem.sh [instance_name]
sid=$1
if [ $# -ne 1 ]
then
echo "Invalid Argument"
echo "Usage : get_inst_os_mem.sh [instance_name]"
exit
fi

if [ "`ps -ef | grep pmon | grep -v grep | awk '{print $NF}'| cut -c 10- | grep -w $sid`" != "" ]
then
mem_c=0
os_p=`uname`
if [ "$os_p" = "Linux" ]; then
for x in `ps aux --sort -rss | grep oracle | grep $sid | awk '{print $6}'`
do
mem_c=`expr $mem_c + $x`
done
elif [ "$os_p" = "SunOS" ] ; then
for x in `ps -ef -o user,rss,comm | grep oracle | grep $sid | awk '{print $2}'`
do
mem_c=`expr $mem_c + $x`
done
fi
mem_c=`expr $mem_c / 1024`

echo "Total Physical Memory consumed by Oracle Instance $sid is: $mem_c MB"
else
echo "Invalid Oracle SID"
fi

 

%d bloggers like this:
Visit Us On LinkedinVisit Us On TwitterVisit Us On Google PlusCheck Our Feed