How to Tag your Session Trace file Name
How to Tag
your Session’s Trace file Name
Oracle server has been provided with the power of Instrumented
Code. With this power you can get diagnostic as well as performance related
information out of the server as required. One of the ways to get that
information is by the use of trace files.
There is a way to “tag” your trace file so that you can find it
even if you are not permitted access to V$PROCESS and V$SESSION. Assuming you
have access to read the user_dump_dest directory, you can use the session
parameter tracefile_identifier. With this, you can add a uniquely identifiable
string to the trace file name, for example:
SQL Prompt> connect / as sysdba
Connected.
SQL Prompt > alter session set
tracefile_identifier = ‘I_am_tcfile’;
Session altered.
SQL Prompt > alter session set sql_trace=true;
You can now go to the trace file directory (say USER_DUMP_DEST,
assuming you are using dedicated server mode), and you will see a trace file
like:
(USER_DUMP_DEST)/mynewdb_ora_3352_I_am_tcfile.trc
You can see, the trace file is now named in the standard
<ORACLE_SID>_ora_<SERVER_PROCESS_ID> format, but it also has the
unique string we specified associated with it, making it easy to find “our” trace
file name.
Note:
You will not see the trace file with that
name in the trace directory until you enable tracing in that session with one
of the tracing method enabled. Till then no file will exist.
As soon as tracing is enabled, however, you
will be able to see it.
You can check the contents of the trace file
to make sure that you are looking at correct trace file. Like the file will
contain the statements/queries for which you had enabled the tracing or Oracle
instance name.
Comments
Post a Comment