SQL Script to find sessions consuming lot of CPU

 SQL Script to find sessions consuming lot of CPU in the DB

col program form a30 heading "Program" 
col CPUMins form 99990 heading "CPU in Mins" 
select rownum as rank, a.* 
from ( 
SELECT v.sid, program, v.value / (100 * 60) CPUMins 
FROM v$statname s , v$sesstat v, v$session sess 
WHERE s.name = 'CPU used by this session' 
and sess.sid = v.sid 
and v.statistic#=s.statistic# 
and v.value>0 
ORDER BY v.value DESC) a 
where rownum < 11;

Comments

Popular posts from this blog

Oracle Cloud Infrastructure(OCI) - Part2

Script to display the SQL text for a specific SQL_ID

How to Change Your EnterpriseOne Environment Color