Sunday, July 10, 2016

Scripts to check Long Running Sessions

Scripts to check Long Running Sessions

Summary:

This one shows SQL that is currently "ACTIVE"

select S.USERNAME, s.sid, s.osuser, t.sql_id, sql_text from v$sqltext_with_newlines t,V$SESSION s where t.address =s.sql_address and t.hash_value = s.sql_hash_value and s.status = 'ACTIVE'
and s.username <> 'SYSTEM' order by s.sid,t.piece;