Oracle Tracing

Syntax:

ALTER SESSION SET EVENTS '<event> trace name context forever, level <level>';

Common events

SQL Trace - Event 10046

ALTER SESSION SET EVENTS '10046 trace name context forever, level 12';

Optimiser Decisions - Event 10053

ALTER SESSION SET EVENTS '10053 trace name context forever, level 1';

Other events

Oracle 12c query to list other traceable events:

WITH
  FUNCTION fn_errm(n NUMBER)
  RETURN VARCHAR2
  IS
  BEGIN
    RETURN SQLERRM(n);
  END fn_errm;
error_messages AS (
  SELECT 10000 + rownum AS event, fn_errm(-9999 - rownum) AS description
  FROM   dba_objects
  WHERE  rownum <= 1000
)
SELECT *
FROM   error_messages
WHERE  LOWER(description) LIKE '%trace%';
      

Potentially more information about an event listed by the above

[rik@o12102nc trace]$ oerr ora 10065
10065, 00000, "limit library cache dump information for state object dump"
// *Document: NO
// *Cause:
// *Action: level 1 - minimal (only the address of state objects)
//          level 2 - little more (no object details)
//          level 3 - normal
      

Parameters

ParameterDescription
tracefile_identifier='XXX'Add _XXX to tracefile name
_trace_files_public = TRUEOpen up trace file for "world" read access (parameter file setting)
times_statistics = TRUEInclude timed statistics
user_dump_dest='<directory>'Log file location
background_dump_dest='<directory>'
max_dump_file_size=<size>Maximum trace file size