SQL Monitor report
When to use it
For a statement that is running right now for a long time, or ran recently, when you want to see where the time goes step by step. Needs the Tuning Pack.
Run this
Starter query written for this guide:
SET LONG 1000000 LONGCHUNKSIZE 1000000 LINESIZE 250 PAGESIZE 0
SELECT DBMS_SQL_MONITOR.REPORT_SQL_MONITOR(
sql_id => '<SQL_ID>',
type => 'TEXT',
report_level => 'ALL')
FROM dual;
Script on the shelf: 01_generate_sql_monitor_report.sql (Performance › SQL Monitor › SQL Monitor reports): the same report plus progress of long operations.
How to read the output
- The header shows status (
EXECUTINGorDONE), duration and the bind values. - In the plan section, the
Activity (%)column shows which step consumes the time. Start there. - Compare
Rows (Estim)withRows (Actual). A difference of several orders of magnitude is a strong clue. - Only statements that run for more than about 5 seconds, or run in parallel, are monitored automatically. A fast statement may return no report.
What to do next
- Save the report text and attach it when you escalate. It is the single most useful piece of evidence.
- For bind values and history, see Performance › SQL Monitor › SQL analysis.
Risk level
READ ONLY Safe to run at any time. It only queries the data dictionary.