Search notes:

Oracle: Real Time SQL Monitoring

By default, Oracle monitors the execution of SQL statements that
Oracle can be forced to monitor all executions with one of the following statements:
alter session set events 'sql_monitor force=true';
alter system  set events 'sql_monitor force=true';
In order to force monitoring an SQL statement identified by an SQL Id, one of the following statements will do:
alter session set events 'sql_monitor [sql:abc0123456789] force=true';
alter system  set events 'sql_monitor [sql:abc0123456789] force=true';
Monitoring can be turned off with
alter system  set events 'sql_monitor off';

Limits

The number of statement executions that will be monitored at a given time is limited to 20 times the number of cpus, but can be adjusted with the hidden init parameter _sqlmon_max_plan.
Statements whose execution plans exceed 300 lines are not monitored. This threshold can be altered with the parameter _sqlmon_max_planlines.
The minimal execution time of 5 seconds that an SQL statement must be running before monitoring kicks in can be adjusted with _sqlmon_threshold.

See also

v$sql_monitor
The monitor and no_monitor SQL hints.
Compare with v$sql_plan_statistics and dbms_xplan.display_cursor.

Index