Wednesday, February 15, 2012

Oracle SQL Script to Find Out Active Sessions Details




SET LINESIZE 500
SET PAGESIZE 1000

COLUMN username FORMAT A15
COLUMN machine FORMAT A25
COLUMN logon_time FORMAT A20


Oracle SQL Script to Find Out Active Sessions Details


SELECT NVL(sess.username, '(ora BGproc)') AS username,
       sess.osuser,
       sess.sid,
       sess.serial#,
       proc.spid,
       sess.lockwait,
       sess.status,
       sess.module,
       sess.machine,
       sess.program,
       TO_CHAR(sess.logon_Time,'DD-MON-YYYY HH24:MI:SS') AS logon_time
FROM   v$session sess,
       v$process proc
WHERE  sess.paddr  = proc.addr
AND    sess.status = 'ACTIVE'
ORDER BY sess.username, sess.osuser;



No comments:

Post a Comment