Cheeky Cockatoo

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

user_sql.sql

Download Script

break on username on sid_ser
column username for a12 heading 'User Name'
column sid_ser for a9 heading 'SID+SER'
column sql_text for a55 heading 'SQL Statement'
set pages 200
set verify off
set lines 80
select b.username username, b.sid||','||b.serial# sid_ser, sql_text 
from v$sqltext a, v$session b, v$process c
where b.username = upper('&userid')
and b.paddr = c.addr
and b.sql_address=a.address
and b.sql_hash_value=a.hash_value
order by b.sid||','||b.serial#, piece
/