getting CPU usage of oracle session



— Show CPU Usage for Active Sessions

SET PAUSE ON
SET PAUSE ‘Press Return to Continue’
SET PAGESIZE 60
SET LINESIZE 300

COLUMN username FORMAT A30
COLUMN sid FORMAT 999,999,999
COLUMN serial# FORMAT 999,999,999
COLUMN “cpu usage (seconds)” FORMAT 999,999,999.0000

SELECT
s.username,
t.sid,
s.serial#,
SUM(VALUE/100) as “cpu usage (seconds)”
FROM
v$session s,
v$sesstat t,
v$statname n
WHERE
t.STATISTIC# = n.STATISTIC#
AND
NAME like ‘%CPU used by this session%’
AND
t.SID = s.SID
AND
s.status=’ACTIVE’
AND
s.username is not null
GROUP BY username,t.sid,s.serial#
/

Press Return to Continue

in my case..i have just opened a session so cpu usage would be very low, as you can see

USERNAME SID     SERIAL#         cpu usage (seconds)
—————————— ———— ———— ——————-
SYS               8,752      11,975            .0000

Advertisements

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