Cheeky Cockatoo

Life Advice and Stories, Travel, Oracle Tech, Good Food and More

sid_sql.sql

Download Script

break on username on sidser
column username for a12 heading 'User|Name'
column sidser for a7 heading 'SID|SER'
column sql_text for a55 heading 'SQL|Statement'
set pages 100
set verify off
set lines 110
select b.username username, b.sid||','||b.serial# sidser, sql_text 
from v$sqltext a, v$session b
where sid = '&SID'
and b.sql_address=a.address
and b.sql_hash_value=a.hash_value
order by piece
/