Quantcast
Channel: Oracle Maniacs' Notes » Admin
Viewing all articles
Browse latest Browse all 25

Trace file path in Oracle

$
0
0

The following script returns the path to the trace file that the current session writes. It returns the path whether or not tracing is enabled.

SELECT    u_dump.VALUE
       || '/'
       || db_name.VALUE
       || '_ora_'
       || v$process.spid
       || NVL2 (v$process.traceid,
                '_' || v$process.traceid,
                NULL
               )
       || '.trc' "Trace File"
  FROM v$parameter u_dump CROSS JOIN v$parameter db_name
       CROSS JOIN v$process
       JOIN v$session ON v$process.addr = v$session.paddr
 WHERE u_dump.NAME = 'user_dump_dest' AND db_name.NAME = 'db_name' AND v$session.audsid = SYS_CONTEXT ('userenv', 'sessionid');

Execute this query in the database

If you alter the session using the following script

ALTER
SESSION
SET tracefile_identifier = here_is_my_session;

Now execute the script to generate the trace file name

Note that the trace file name has been modified to include “HERE_IS_MY_SESSION” in the name. This way the trace file can be easily identified in a huge list of trace files within a directory.

Thanks to René Nyffenegger for providing this.

Cheers!



Viewing all articles
Browse latest Browse all 25

Trending Articles