Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.server -> Re: How can you find cpu usuage?
Put this before your stmt:
select decode(VALUE,'TRUE','',
'prompt Note: Requires timed_statistics be set to TRUE.' )
If 'timed_statistics' = FALSE it won't work.
Cheers, Roelof
R. Schierbeek, DBA
email : info_at_bytelife.com www : www.bytelife.com SQL : www.bytelife.com/sql4dba.htm
KnighThing <knighthing_at_hotmail.com> schreef in berichtnieuws
> 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 - 13:03:46 CDT