Skip to content
WaitScope Sign in Request access (by email) Menu

Choose the event 10046 level

The event 10046 levels, which one WaitScope needs, how to turn it on and off with ALTER SESSION and the parameters that prevent traces without timings or truncated traces.

Applies to: 10046 traces with waits (level 8 or 12), console 1.7.0

Event 10046 is Oracle's extended SQL trace: the level determines what goes into the file in addition to the database calls. WaitScope needs the waits. Use level 8; level 12 also works, but it writes bind values, which WaitScope ignores.

Before you start

  • alter session set events turns on the event only in the session you are in and requires the ALTER SESSION privilege. To turn it on in another session, use DBMS_MONITOR.
  • Check the parameters that change the file beforehand (timed_statistics and max_dump_file_size).
  • To find the file later, give it a name with tracefile_identifier (mark the file name).

The levels

Event 10046 levels and their use in WaitScope
LevelWhat it writesIn WaitScope
1Standard SQL trace: statements, calls and plan rowsNot usable: no waits
4Level 1 plus bind valuesNot usable: no waits
8Level 1 plus waitsRecommended
12Level 1, binds and waitsUsable; the binds are ignored

Levels 1, 4, 8 and 12 are listed in the Event Level Settings table on the SQL Trace page of the Oracle documentation, and level 8 is the one the 19c tracing guide uses to write waits. Without waits, the profile cannot separate waits from everything else: the time spent waiting for disk, a lock or the application becomes unaccounted-for time, within and between calls (gaps between calls). In the Summary, Waits equal to 0 means a trace without waits.

When the plan goes into the file

The STAT lines, the plan with the figures for each operation, go into the file at the frequency set by the plan_stat parameter. The DBMS_MONITOR reference documents three values:

plan_stat values and the plan in the report
ValueWhen it writes the planIn the report
'FIRST_EXECUTION', same as NULL, the defaultOn the first execution of the cursorThe plan appears in the statement detail.
'ALL_EXECUTIONS'On every execution, and the file growsEach distinct plan appears once, with the figures from the last time it was written (in a statement with the N variants badge, those from the slowest execution written) and a note such as plan written 3 times, showing the last one (with variants, showing the slowest recording).
'NEVER'NeverThe statement detail has no plan.

In alter session set events, the documented levels, 1, 4, 8 and 12, do not choose this frequency, and the default is enough for the report to show the plan. If you need the plan on every execution, turn on tracing with DBMS_MONITOR and plan_stat => 'ALL_EXECUTIONS' (which values to use).

Turn it on and off with ALTER SESSION

  1. In the session that will run the operation, turn on the event:
    alter session set events '10046 trace name context forever, level 8';
  2. Run the whole operation in that same session.
  3. Turn off the event:
    alter session set events '10046 trace name context off';

Result: the session's trace file has the PARSE, EXEC, FETCH and WAIT lines of the operation. To find its path, use the V$DIAG_INFO query in find the file of your own session.

Do not turn on 10046 for the whole system: each session writes its own file, and the operation you care about gets lost among the others.

Parameters that change the file

Check the values in effect before turning tracing on:

select name, value
from v$parameter
where name in ('timed_statistics', 'statistics_level', 'max_dump_file_size');
Instance parameters that affect the trace
ParameterGood valueOtherwise
timed_statisticsTRUEWith FALSE, the timings come out as zero and the profile has nothing to split. With statistics_level set to TYPICAL or ALL, its default is TRUE.
max_dump_file_sizeUNLIMITED, the defaultWith a limit, the file stops growing when it reaches it. From 25 MB on, Oracle splits the trace into up to 5 segments and deletes the oldest one after the first: the middle of the operation is lost.

In your session, adjust them with alter session:

alter session set timed_statistics = true;
alter session set max_dump_file_size = unlimited;

In someone else's session, traced through DBMS_MONITOR, the instance value applies, which only changes with alter system and applies to all sessions: agree on it with the DBA. The details are in the Oracle reference for MAX_DUMP_FILE_SIZE and TIMED_STATISTICS.

Trace truncated in the middle

The report measures only what is in the file. Signs that the trace does not cover the whole operation:

  • the Period in the Summary starts after or ends before the operation;
  • a warning at the top of the report that ends in (trace started or cut in the middle of a call);
  • statements with Text not available: the cursor was opened before the trace started.;
  • the Time gaps between calls finding in the Diagnosis.

To avoid it: turn on tracing before the operation starts and turn it off after it ends, without turning it off in the middle; leave max_dump_file_size unlimited; and, if the application switches files along the way, upload all the files together (analyze together).

Next steps

Updated on 2026-10-29. Report an error on this page