Wednesday, March 18, 2015

Check Active sessions in Oracle Database

script to check Active / Running Sessions in Oracle Database. 


col sid for 999999
col serial# for 999999
col spid for a8
col username for a20
col osuser for a20
set lines 300 pagesize 999
col event for a30
col TERMINAL for a15
col SQL_ID for a15
col STATUS for a10

alter session set nls_date_format = 'DD-MON-YYYY HH24:MI:SS';
select s.inst_id,s.sid,s.serial#,s.sql_id,s.event,s.p1,s.p2,s.p3,p.spid,p.pid,s.username,s.osuser,s.status,s.terminal,s.BLOCKING_SESSION,s.LOGON_TIME from gv$session s,gv$process p where s.paddr=p.addr and 
s.status='ACTIVE' and s.username IS not null order by 2;

No comments:

Post a Comment