CPU usage per session

SQL> conn /as sysdba
Connected.
SQL> select
 ss.username,
 se.SID,
 VALUE/100 cpu_usage_seconds
 5 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.status='ACTIVE'
 ss.username is not null
 order by VALUE desc;

SAMPLE OUTPUT

USERNAME        SID CPU_USAGE_SECONDS
------------------------------ ----------
APP_USER_S      863    2428.08
APP_USER        494    768.5
APP_USER        578    741.56
APP_USER_S      739    165.34
APP_USER_S      710    128.9
APP_USER_S      468    117.5
APP_USER_S      572    56.27
APP_USER_S      572    40.17
APP_USER_S      739    32.03
APP_USER        702    25.41
APP_USER_S      746    12.01
Advertisements

About Sher khan

Senior Oracle DBA, Oracle 10g , Oracle 11g OCE ,Oracle 12C and Oracle 11g OPN certified Specialist, OCP Certified in Oracle 9i,10g , 11g and 12C. I am working in Oracle technology since 2004. Currently working in U.A.E Email: sher487@hotmail.com
This entry was posted in scripts. Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s