Re: AW: Query on Linux 'top' command for oracle user

From: Kerry Osborne <kerry.osborne_at_enkitec.com>
Date: Thu, 21 Oct 2010 07:47:00 -0500
Message-Id: <2A2E8973-FCC2-4CDE-8892-4EEF61953FD3_at_enkitec.com>



You can also get overall system memory info from /proc/meminfo. Linux wants to suck up most available (free) memory for file system cache, so the free command always reports a pretty low value. Here's a little script that pulls info from /proc/meminfo to report available memory including file system cache. While no where near as sophisticated as Tanel's pmap script for Solaris, it will at least give you an idea how much memory is available on a Linux box without having to add numbers yourself. ;) Note this script was actually written by a guy named Sean Turner who works at Oracle now. I always use the -a parameter.

#!/bin/ksh

FREEMEM=`cat /proc/meminfo | grep MemFree: | sed -e 's/ */ /g' | cut -f2 -d' '` CACHED=`cat /proc/meminfo | grep Cached: | grep -v SwapCached: | sed -e 's/ */ /g' | cut -f2 -d' '` TOTALMEM=`cat /proc/meminfo | grep MemTotal: | sed -e 's/ */ /g' | cut -f2 -d' '`

((FREEMEM=${FREEMEM}/1024))
((CACHED=${CACHED}/1024))
((TOTALMEM=${TOTALMEM}/1024))

((TOTALFREE=${FREEMEM}+${CACHED}))

((REALFREE=$TOTALFREE*100))
((REALFREEPCT=$REALFREE/$TOTALMEM)) if [ "$1" = "-a" ]; then
  echo 'Free Memory:' ${FREEMEM}'M'
  echo 'Cached Memory:' ${CACHED}'M'
  echo 'Total Free Memory:' ${TOTALFREE}'M'
  echo 'Total Memory:' ${TOTALMEM}'M'
  echo 'Percent Memory Free (including cache):' ${REALFREEPCT}'%'
else
  echo 'Percent Memory Free (including cache):' ${REALFREEPCT}'%' fi

return $REALFREEPCT

Kerry Osborne
Enkitec
blog: kerryosborne.oracle-guy.com

On Oct 21, 2010, at 4:47 AM, Petr Novak wrote:

> Hi Sreejith,
>
> read Tanels article
>
> http://tech.e2sn.com/oracle/performance/unix-performance-tools/process-memory-matrix
>
>
> Best Regards,
> Petr
>
>
> -----Ursprüngliche Nachricht-----
> Von: oracle-l-bounce_at_freelists.org im Auftrag von Sreejith S Nair
> Gesendet: Do 21.10.2010 11:41
> An: oracle-l_at_freelists.org
> Betreff: Query on Linux 'top' command for oracle user
>
> This is the output of 'top' command in one of my linux server hosting One
> Oracle instance with 600MB SGA and 400MB PGA. One one instance is up in
> this server.
> top - 14:36:37 up 4:26, 3 users, load average: 0.05, 0.11, 0.28
> Tasks: 124 total, 1 running, 123 sleeping, 0 stopped, 0 zombie
> Cpu(s): 0.2% us, 0.1% sy, 0.0% ni, 66.6% id, 33.1% wa, 0.0% hi, 0.0% si
> Mem: 12299332k total, 2569836k used, 9729496k free, 61288k buffers
> Swap: 20972816k total, 0k used, 20972816k free, 2274852k cached
>
> PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND
> 6345 oracle 16 0 37132 1752 1172 S 0.0 0.0 0:00.08 sshd
> 6346 oracle 16 0 54004 1536 1208 S 0.0 0.0 0:00.02 bash
> 6423 oracle 16 0 45376 10m 6228 S 0.0 0.1 0:00.25 tnslsnr
> 6471 oracle 16 0 740m 17m 13m S 0.0 0.1 0:00.02 oracle
> 6473 oracle 16 0 739m 15m 12m S 0.0 0.1 0:00.01 oracle
> 6475 oracle 16 0 739m 32m 29m S 0.0 0.3 0:00.07 oracle
> 6477 oracle 16 0 742m 50m 44m S 0.0 0.4 0:00.27 oracle
> 6479 oracle 16 0 754m 23m 19m S 0.0 0.2 0:00.43 oracle
> 6481 oracle 16 0 739m 24m 20m S 0.0 0.2 0:00.61 oracle
> 6483 oracle 16 0 740m 88m 83m S 0.0 0.7 0:00.71 oracle
> 6485 oracle 16 0 739m 22m 19m S 0.0 0.2 0:00.01 oracle
> 6487 oracle 16 0 740m 30m 25m S 0.0 0.3 0:00.15 oracle
> 6489 oracle 16 0 741m 55m 48m S 0.0 0.5 0:00.29 oracle
> 6491 oracle 16 0 739m 24m 20m S 0.0 0.2 0:00.01 oracle
> 6493 oracle 16 0 739m 15m 11m S 0.0 0.1 0:00.01 oracle
> 6495 oracle 16 0 739m 14m 11m S 0.0 0.1 0:00.00 oracle
> 6622 oracle 16 0 739m 16m 13m S 0.0 0.1 0:00.00 oracle
> 6626 oracle 16 0 740m 79m 74m S 0.0 0.7 0:01.95 oracle
> 6636 oracle 16 0 740m 28m 23m S 0.0 0.2 0:00.06 oracle
> 6638 oracle 16 0 739m 16m 12m S 0.0 0.1 0:00.01 oracle
> 6846 oracle 16 0 739m 19m 16m S 0.0 0.2 0:00.02 oracle
> 6848 oracle 16 0 739m 24m 21m S 0.0 0.2 0:00.04 oracle
> 6850 oracle 16 0 739m 19m 16m S 0.0 0.2 0:00.02 oracle
> 6852 oracle 16 0 739m 19m 16m S 0.0 0.2 0:00.01 oracle
> 6854 oracle 16 0 739m 30m 26m S 0.0 0.3 0:00.12 oracle
> 6856 oracle 15 0 739m 28m 24m S 0.0 0.2 0:00.18 oracle
> 6858 oracle 15 0 740m 40m 35m S 0.0 0.3 0:06.39 oracle
> 6862 oracle 16 0 739m 32m 28m S 0.0 0.3 0:02.25 oracle
> 6864 oracle 16 0 739m 19m 16m S 0.0 0.2 0:00.02 oracle
> 6866 oracle 16 0 739m 19m 16m S 0.0 0.2 0:00.03 oracle
> 6868 oracle 16 0 739m 19m 16m S 0.0 0.2 0:00.02 oracle
> 7480 oracle 15 0 37264 1668 1092 S 0.0 0.0 0:00.15 sshd
> 7481 oracle 15 0 54004 1528 1196 S 0.0 0.0 0:00.05 bash
> 10333 oracle 16 0 739m 20m 16m S 0.0 0.2 0:00.00 oracle
> 10337 oracle 15 0 6168 1080 768 R 0.0 0.0 0:00.00 top
>
> Total RAM as seen from top command is 12G.
> 2569836 - Total RAM which is being used currently .
>
> How can I see the total RAM used by all Oracle Processes running in this
> server. The server is Linux X86 64 Bit. Can I sum up the values under
> 'VIRT' column of 'top' command to see the total RAM used ?
>
> Is there a way to see the total *RAM and CPU u*sed by Oracle from top ?
> 'VIRT' is the virtual memory - In what way is this related to the figure
> above, which is the physical memory (RAM) ?
>
> Thanks in Advance
> SSN
>
> Thank You,
>
> Kind Regards,
> Sreejith Nair
>
>
>
>
>
>
> DISCLAIMER:
>
> "The information in this e-mail and any attachment is intended only for
> the person to whom it is addressed and may contain confidential and/or
> privileged material. If you have received this e-mail in error, kindly
> contact the sender and destroy all copies of the original communication.
> IBS makes no warranty, express or implied, nor guarantees the accuracy,
> adequacy or completeness of the information contained in this email or any
> attachment and is not liable for any errors, defects, omissions, viruses
> or for resultant loss or damage, if any, direct or indirect."
>
>
>
>
>
>

--
http://www.freelists.org/webpage/oracle-l
Received on Thu Oct 21 2010 - 07:47:00 CDT

Original text of this message