How can a DBA trace what SQL is running by using PID from Solaris? Means from the PID I want to know what SQL is being executing. Thanks.
Find the parent process number of the oracle conenction e.g.
oracle 203 25640 0 09:15:09 pts/4 0:00 grep 25640
oracle 26764 25640 0 09:14:08 ? 0:01 oraclecasht32 (DESCRIPTION=(LOCA)
oracle 25640 13542 0 09:13:54 pts/4 0:00 sqlplus
In this case it'll be 25640 (the sqlplus program)
select sid, serial# from v$session where process=25640;
exec dbms_system.set_sql_trace_in_session(sid,serial#,true) to trace that session.
Trace files are written to user_dump_dest (make sure max)dump_file_size is set appropriatley)
Click Here to Expand Forum to Full Width