Disclaimer

Thursday 2 September 2021

How to trace of session in Oracle

How to trace of session?


1.First of all select

SQL> select sid,serial#,username,status,program from v$session where program like '%pmrepagent@PRDBIETL%';



2.Take SPID from session_id

SQL> select p.PID,p.SPID,s.SID from v$process p,v$session s where s.paddr=p.addr and s.sid=&session_id;

Enter value for session_id: 487


3. 
Now user oradebug Utility to trace the user

$] oradebug setospid 16384392



4. $] oradebug unlimit


5.  ->>>TO START<<< -

$] oradebug event 10046 trace name context forever,level 12


Note : Now that we have started tracing SQL statement with oradebug, lets do some activity
i.e. tell to user to do some activity....!

6. To check the tracefile name run below command:-

$] oradebug tracefile_name

/oracle/app/oracle/diag/rdbms/olapprod/OLAPPROD/trace/OLAPPROD_ora_16384392.trc


7. >>> TO STOP <<< To stop the trace issue below command

$] oradebug event 10046 trace name context off

Statement processed.



8.Convert .trc file to .txt file in readable format using tkprof utility

$] tkprof /oracle/app/oracle/diag/rdbms/olapprod/OLAPPROD/trace/OLAPPROD_ora_35651662.trc /oracle/app/oracle/diag/rdbms/olapprod/OLAPPROD/trace/OLAPPROD_ora_35651662.txt waits=yes sys=no sort=exeela,fchela





No comments:

Post a Comment

100 Oracle DBA Interview Questions and Answers

  Here are 100 tricky interview questions tailored for a Senior Oracle DBA role. These questions span a wide range of topics, including perf...