Sunday, January 6, 2008

Live session tracing

Live session tracing

If you have identified a particular session from a concurrent request or a forms user, you can enable trace while the session is active. To do so, you must first have the spid (LOCAL=NO) process for this sid.

vi process.sql
column a.program format a40
select b.sid, b.serial#, a.spid, a.program from v$process a , v$session b
where a.addr = b.paddr and b.sid = &sid
/

SQL> @process
Enter value for sid: 919

SID SERIAL# SPID PROGRAM
---------- ---------- ------------ ------------------------------------------------
919 6335 15191 oracle@sun9999 (TNS V1-V3)

Make sure you’re running with the environment for oracle user – can’t run the oradebug statement from applmgr environment.
SQL> oradebug setospid 15191
Oracle pid: 152, Unix process pid: 15191, image: oracle@sun9999 (TNS V1-V3)
SQL> oradebug unlimit
Statement processed.
SQL> oradebug event 10046 trace name context forever, level 12
Statement processed.

When you are finished tracing…

SQL> oradebug setospid 15191 -- may not need to execute setospid again
Oracle pid: 152, Unix process pid: 15191, image: oracle@sun9999 (TNS V1-V3)
SQL> oradebug event 10046 trace name context off
Statement processed.

Your trace file will contain the spid in the string.

No comments: