Memory Calculation

Taking care of your Linux box.

Memory Calculation

Postby telenor » Wed Mar 17, 2010 5:13 pm

I want an script that calculate total memory consume by all Oracle Process


PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND

6689 oraprod 16 0 1163m 155m 150m S 0 2.0 0:01.95 oracle
7046 oraprod 16 0 1161m 18m 14m S 0 0.2 0:00.02 oracle
7392 oraprod 16 0 1165m 39m 33m S 0 0.5 0:00.07 oracle
7394 oraprod 16 0 1161m 22m 18m S 0 0.3 0:00.02 oracle
7735 oraprod 16 0 1163m 125m 119m S 0 1.6 0:01.45 oracle
7749 oraprod 16 0 1163m 123m 117m S 0 1.5 0:01.54 oracle
7946 oraprod 16 0 1162m 69m 65m S 0 0.9 0:00.15 oracle
telenor
Havaldaar
 
Posts: 104
Joined: Tue Mar 29, 2005 11:08 am

Postby azfar » Mon Mar 22, 2010 11:40 pm

try this.

Code: Select all

totalmem=`free | awk 'NR==2 {print $2}'`

usage=`ps aux | grep -v grep | grep oracle | awk '{ total += $4} END {print total}'`

res=`echo "$totalmem * $usage / 100 / 1024" | bc`
echo $res"Mb"
Azfar Hashmi
Email : azfarhashmi@hotmail.com
azfar
Captain
 
Posts: 598
Joined: Tue Mar 23, 2004 1:16 am
WLM: azfarhashmi@hotmail.com
Yahoo Messenger: azfarhusain@yahoo.com
Location: Karachi


Return to “%s” Administration

Who is online

Users browsing this forum: No registered users and 2 guests

cron