Dba Sessions

Description: Returns a list of users and their session details.

SET linesize 170
SET pagesize 60
break ON osuser skip 1
spool sessions.lst
SELECT SUBSTR(v$session.username,1,15),
       v$session.process,v$session.sid,
       v$session.serial#,
       SUBSTR(v$session.program,1,23),v$session.status,
       v$session.terminal,
       SUBSTR(v$statname.name,1,30),
ROUND(((v$timer.hsecs - v$sesstat.VALUE)/100/60/60),2) HOURS
FROM v$timer,v$statname,v$sesstat,v$session
WHERE v$statname.statistic# = v$sesstat.statistic# AND
      v$sesstat.statistic# IN (13,14) AND
      v$sesstat.sid = v$session.sid
ORDER BY v$session.username,v$session.sid,v$sesstat.statistic#
/

Enjoyed this post? Share it!

 

Leave a comment

Your email address will not be published.