If you have the "top" utility installed on the Unix box, this makes an easy
to use interface to identify CPU hogs.  For non-root users to run it, your
sys admin might have to change default permissions on certain "files" such
as /dev/kmem; or possibly make top SUID root.

If you don't have top, or you can't run it as non-root, you can try using
the following ps command to sort things by %CPU, but I think there might be
differences among OS's on some of the more exotic ps and sort options:

ps -eo pid -o %cpu | sort -rk2 | head -20

After you have identified which PID is the hog, and can see that it is a
dedicated server process, you can run something like the following to match
SID & SERIAL# to the correct OS process ID.  If you must brutally kill the
process, kill the session in the database, then kill the pid in the OS.

set linesize whatever_you_like
set pagesize whatever_you_like

col username format a15
col osuser format a15

select s.username,
       s.osuser,
       s.sid,
       s.serial#,
       s.process "USER PRCS",
       p.spid "SVR PRCS"
  from v$process p,v$session s
  where p.addr = s.paddr
  and s.username <> ' '
/


> -----Original Message-----
> From: ecandrietta [mailto:ecandrietta@;uol.com.br]
> Sent: Thursday, November 14, 2002 1:20 PM
> To: Multiple recipients of list ORACLE-L
> Subject: Monitoring Unix Question 
> 
> 
> 
> Friends :
> 
> How can i do for get what is running inside a PID that is 
> using a lot of CPU ?
> 
> How can I get the query that is running inside the database 
> according PID of unix ?
> 
> I would like to know commands of the unix and the query that 
> i need to run in the database for find out the problem.
> 
> Regards
> 
> Eriovaldo
> 
> 
>  
> ---
> UOL, o melhor da Internet
> http://www.uol.com.br/
> 
> -- 
> Please see the official ORACLE-L FAQ: http://www.orafaq.com
> -- 
> Author: ecandrietta
>   INET: [EMAIL PROTECTED]
> 
> Fat City Network Services    -- 858-538-5051 http://www.fatcity.com
> San Diego, California        -- Mailing list and web hosting services
> ---------------------------------------------------------------------
> To REMOVE yourself from this mailing list, send an E-Mail message
> to: [EMAIL PROTECTED] (note EXACT spelling of 'ListGuru') and in
> the message BODY, include a line containing: UNSUB ORACLE-L
> (or the name of mailing list you want to be removed from).  You may
> also send the HELP command for other information (like subscribing).
> 
-- 
Please see the official ORACLE-L FAQ: http://www.orafaq.com
-- 
Author: Stephen Lee
  INET: [EMAIL PROTECTED]

Fat City Network Services    -- 858-538-5051 http://www.fatcity.com
San Diego, California        -- Mailing list and web hosting services
---------------------------------------------------------------------
To REMOVE yourself from this mailing list, send an E-Mail message
to: [EMAIL PROTECTED] (note EXACT spelling of 'ListGuru') and in
the message BODY, include a line containing: UNSUB ORACLE-L
(or the name of mailing list you want to be removed from).  You may
also send the HELP command for other information (like subscribing).

Reply via email to