Friday, May 7, 2010

Tracing other sessions

Identifiy the session(s)
------------------------------------

For sessions with a particular username

SELECT s.sid , s.serial#, s.status, s.program, s.username
FROM v$session s
WHERE username = 'DBATEST'


For sessions with a particular event

SELECT s.sid , s.serial#, s.status, s.server, s.username,
e.event, e.time_waited
FROM v$session_event e, v$session s
WHERE e.sid=s.sid
AND e.event like ' '
AND e.time_waited > ###




Turn on tracing for the session
---------------------------------------

Make sure times_statistics is on at the system level or session level.
Using dbms_monitor;

exec dbms_monitor.session_trace_enable(binds=>true,waits=>true,session_id=> SID ,serial_num=> serial# );


Turn off tracing for the session
---------------------------------------

To turn the tracing off

exec dbms_monitor.session_trace_disable(session_id=>170,serial_num=>111);




tkprof the output
--------------------------

tkprof tccpsus_ora_14391.trc tccpsus_ora_14391.txt sort=prsela,exeela,fchela


******************************************
keywords:
******************************************
rdbms version:
******************************************

No comments: