Wednesday, 26 October 2016

Script to Generate Trace Enable Statment in Oracle

SQL: 

SELECT s.username, s.SID, s.serial#, s.PROGRAM, p.spid ,
'EXECUTE dbms_system.set_sql_trace_in_session('|| s.SID||','||s.serial#||',true);' ENAB,
'EXECUTE dbms_system.set_sql_trace_in_session('|| s.SID||','||s.serial#||',true);' DISAB
FROM   v$session s,  

              v$process p 
WHERE p.addr = s.paddr   and s.username = 'SYS'  -- and s.Program='SQL Developer'
order by sid  

No comments:

Post a Comment