REM
REM DBAToolZ NOTE:
REM This script was obtained from DBAToolZ.com
REM It's configured to work with SQL Directory (SQLDIR).
REM SQLDIR is a utility that allows easy organization and
REM execution of SQL*Plus scripts using user-friendly menu.
REM Visit DBAToolZ.com for more details and free SQL scripts.
REM
REM
REM File:
REM s_top_cpu_usage.sql
REM
REM TRACE USER
REM
REM Author:
REM Vitaliy Mogilevskiy
REM VMOGILEV
REM (vit100gain@earthlink.net)
REM
REM Purpose:
REM
REM Reports TOP CPU usage by session
REM
REM
REM Usage:
REM s_top_cpu_usage.sql
REM
REM Example:
REM s_top_cpu_usage.sql
REM
REM
REM History:
REM 08-01-1998 VMOGILEV Created
REM
REM
col name format a30
col username format a15
col osuser format a15
col machine format a12
set lines 132
set pages 1000
break on sid skip 1
select * from (
select a.sid
, c.username
, c.osuser
, c.machine
, b.name
, a.value
from v$sesstat a
, v$statname b
, v$session c
where a.STATISTIC# = b.STATISTIC#
and a.sid = c.sid
and b.name like '%CPU%'
order by a.value desc)
where rownum < 11
/