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

Home -> Community -> Usenet -> c.d.o.server -> Re: How can you find cpu usuage?

Re: How can you find cpu usuage?

From: andrew_webby at hotmail <spam_at_no.thanks.com>
Date: Thu, 14 Jun 2001 11:55:42 +0100
Message-ID: <992516050.12012.0.nnrp-14.c30bdde2@news.demon.co.uk>

This worked for me (You aren't using v$statname so I dropped it).

select

   s.sid,
   s.username,

        (select value from
         v$sesstat ss where ss.sid = s.sid and statistic# = 12) SessionCPU,
        (select value from
         v$sesstat ss where ss.sid = s.sid and statistic# = 8) RecursiveCPU,
        (select value from
         v$sesstat ss where ss.sid = s.sid and statistic# = 169)
ParseTimeCPU
from
v$session s
order by 3 desc

"KnighThing" <knighthing_at_hotmail.com> wrote in message news:58ofitkgefhl5jc8r0b2m3hrhdg0cu6ijb_at_4ax.com...
> I would like to do the following:
>
> Find the cpu time being used by each session.
>
> So that I could then sort that by CPU time and find out
> which sessions are using the most CPU times.
>
> I tried the following, but didn't get the results I'd expect.
>
> i.e. all but 3 sessions had 0 CPU time.
>
> select
> s.sid,
> s.username,
> s.status,
> s.schemaname,
> s.osuser,
> s.machine,
> s.terminal,
> s.program,
> s.module,
> decode(ss.statistic#,12,ss.value,0) SessionCPU,
> decode(ss.statistic#,8,ss.value,0) RecursiveCPU,
> decode(ss.statistic#,169,ss.value,0) ParseTimeCPU
> from
> v$SesStat ss,
> v$StatName sn,
> v$session s
> where
> ss.sid = s.sid
> and ss.statistic# = sn.statistic#
> order by SessionCPU desc
Received on Thu Jun 14 2001 - 05:55:42 CDT

Original text of this message

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