Doc


      Name:   sesscpu.sql

      Author: Mark Gurry

      This script lists the CPU used per session in descending order of CPU usage
      You must have TIMED_STATISTICS = TRUE for meaningful output  
#
column parameter noprint;
column user_process format a30
column value format 999,999,999.99
set pagesize 999
set feedback off
set echo off
set verify off

spool sesscpu.lis
ttitle ' CPU Used By Session Information '

select substr(name,1,30) parameter,
         ss.username||'('||se.sid||') ' user_process, value
  from v$session ss, v$sesstat se, v$statname sn
 where  se.statistic# = sn.statistic#
   and  name  like '%CPU used by this session%'
   and  se.sid = ss.sid
   and  ss.username is not null
 order  by substr(name,1,25), value desc
/


spool off


