Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Mailing Lists -> Oracle-L -> Re: CPU usage in a multi database environment

Re: CPU usage in a multi database environment

From: John Kanagaraj <john.kanagaraj_at_gmail.com>
Date: Wed, 22 Nov 2006 11:56:32 -0800
Message-ID: <2ead3a60611221156w4e333b88rd81a3da56f1576ee@mail.gmail.com>


Orlando,
The following is a simple script that wraps up what everyone else is saying:

#!/bin/ksh
#
#  Name:      top20.ksh
#  Purpose:   Display the top 20 CPU consumers. Specify a SID to collect
#             only those top procs related to that SID in a multi-db system
#  Author:    John Kanagaraj, DBSoft Inc/ Aug 2001
#  Notes:     Tested and works on Solaris - may need adjustment for other OS
#
uptime
echo "PID   %CPU    RUSER     CPUTIME     ELAPSED COMMAND"
if [ $# == 1 ]; then
        ps -eo pid,pcpu,ruser,time,etime,args | grep $1 | sort -nr +1
| head -20 | awk '{print substr($0,1,80)}' else

        ps -eo pid,pcpu,ruser,time,etime,args | sort -nr +1 | head -20 | awk '{ print substr($0,1,80)}'
fi

On boxes which have multiple instances, you can supply the SID name as a parameter which will then parse out the top 20 processes for that database only. Great for checking Dev boxes which have four or five instances running simultaneously.

On 11/21/06, Orlando L <oralrnr_at_gmail.com> wrote:
>
> Hi all,
>
>
> I have a server with 6 Oracle databases running. How do I find out which processes are consuming the CPU?
>
> top shows something like this which does not help me:
>
> PID USERNAME THR PRI NICE SIZE RES STATE TIME CPU COMMAND
> 16475 oracle 11 26 2 698M 660M sleep 1:34 8.97% oracle
> 16477 oracle 11 46 2 697M 659M sleep 1:56 7.96% oracle
> 7605 oracle 11 46 2 886M 850M cpu10 11:48 6.13% oracle
> 1767 oracle 15 58 0 898M 842M sleep 184:54 0.66% oracle
> 14363 oracle 1 59 2 885M 841M sleep 448:25 0.28% oracle
> 7603 oracle 4 52 2 15M 8848K sleep 0:19 0.27% sqlplus
>
>
> Orlando.
>

-- 
John Kanagaraj <><
DB Soft Inc
Phone: 408-970-7002 (W)

Disappointment is always inevitable; Discouragement is invariably optional

** The opinions and facts contained in this message are entirely mine
and do not reflect those of my employer or customers **
--
http://www.freelists.org/webpage/oracle-l
Received on Wed Nov 22 2006 - 13:56:32 CST

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US