How to Generate and Read an Oracle AWR Report: Performance Diagnosis Step by Step
Updated: Oct 24
"The database was slow yesterday between 2 and 3 pm." To answer that kind of complaint you need data from that exact period, and the Automatic Workload Repository (AWR) is where Oracle keeps it. An AWR report can look overwhelming the first time: it is long and full of numbers. The trick is to read it in a fixed order and only go deeper where the numbers point.
This post shows how to set up AWR properly, generate the right report, and read it step by step. We also use ASH (Active Session History) to zoom in on a short spike, and ADDM for a second opinion.
Licensing: AWR, ASH and ADDM are part of the Oracle Diagnostics Pack, an extra-cost option for Enterprise Edition. Check that you are licensed before using them. The parameter CONTROL_MANAGEMENT_PACK_ACCESS controls access. Without the licence, Statspack is the free alternative.
Step 1: Check the Snapshot Settings
AWR takes snapshots of performance statistics at a fixed interval (default 60 minutes) and keeps them for a retention period (default 8 days). Eight days is often too short to compare "this Monday" with "last month-end".
SQL |
SHOW PARAMETER control_management_pack_access
SELECT snap_interval, retention, topnsql FROM dba_hist_wr_control WHERE dbid = (SELECT dbid FROM v$database); |
What to expect: CONTROL_MANAGEMENT_PACK_ACCESS = DIAGNOSTIC+TUNING (if licensed). SNAP_INTERVAL +00000 01:00:00 and RETENTION +00008 00:00:00 are the defaults.
Step 2: Change the Interval and Retention
A 30-minute interval gives finer detail, and a 35 to 45 day retention lets you compare with the previous month. The SYSAUX tablespace will need more space, typically a few GB per instance.
SQL |
BEGIN DBMS_WORKLOAD_REPOSITORY.MODIFY_SNAPSHOT_SETTINGS( interval => 30, -- minutes retention => 40 * 1440); -- 40 days, in minutes END; / |
What this does: From now on a snapshot is taken every 30 minutes and kept for 40 days. Existing snapshots are not changed.
Step 3: Take Manual Snapshots Around a Test
When you test a batch job or a change, take a snapshot right before and right after. Then the report covers exactly the test, and nothing else is mixed in.
SQL |
EXEC DBMS_WORKLOAD_REPOSITORY.CREATE_SNAPSHOT; -- ... run the workload ... EXEC DBMS_WORKLOAD_REPOSITORY.CREATE_SNAPSHOT;
SELECT snap_id, instance_number, TO_CHAR(begin_interval_time,'YYYY-MM-DD HH24:MI') AS begin_time, TO_CHAR(end_interval_time,'YYYY-MM-DD HH24:MI') AS end_time FROM dba_hist_snapshot ORDER BY snap_id DESC FETCH FIRST 6 ROWS ONLY; |
Step 4: Choose the Right Time Window
Pick snapshots that tightly cover the problem. An AWR report averages everything inside its window. A 15-minute problem inside a 24-hour report disappears in the averages. A one-hour window around the complaint is usually right.
SQL |
SELECT snap_id, TO_CHAR(begin_interval_time,'DD-MON HH24:MI') AS begin_time FROM dba_hist_snapshot WHERE begin_interval_time BETWEEN TIMESTAMP '2026-09-10 13:30:00' AND TIMESTAMP '2026-09-10 15:30:00' AND instance_number = 1 ORDER BY snap_id; |
What to expect: A short list of SNAP_IDs. Note the begin and end snapshot IDs that cover 14:00 to 15:00.
Step 5: Generate the AWR Report
Oracle ships SQL*Plus scripts for every kind of report. Run them from the database server or any client with SQL*Plus.
SQL |
sqlplus / as sysdba
-- Standard report for the current instance @?/rdbms/admin/awrrpt.sql -- Report type: html -- Number of days: 2 -- Begin snap: 48210 End snap: 48212 -- Report name: awr_prod_1400_1500.html |
The other useful scripts are:
awrrpti.sql: report for a specific database and instance, useful on RAC or from a central server.
awrgrpt.sql: global RAC report, all instances combined.
awrddrpt.sql: compare two periods side by side, such as a good day and a bad day.
awrsqrpt.sql: report for a single SQL_ID, with all its plans in the window.
What to expect: An HTML file in the current directory. HTML is easier to read than text, because sections are linked and tables are aligned.
Step 6: Read the Header: DB Time Versus Elapsed Time
Start at the top. The header shows the elapsed time of the window and the DB Time, which is the total time sessions spent working or waiting in the database. Their ratio tells you how busy the database was.
SQL |
Snap Id Snap Time Sessions Curs/Sess --------- ------------------- -------- --------- Begin Snap: 48210 10-Sep-26 14:00:12 412 3.1 End Snap: 48212 10-Sep-26 15:00:41 455 3.4 Elapsed: 60.49 (mins) DB Time: 845.12 (mins) |
How to read it: 845 minutes of DB time in 60 minutes of elapsed time means an average of about 14 active sessions. Compare this with the number of CPU cores. On a 16-core server, 14 active sessions is busy but fine, if most of the time is CPU. If the same server normally shows 3, something changed. The awrddrpt.sql compare report shows such changes immediately.
Step 7: Check the Load Profile
The load profile shows the workload per second and per transaction. It answers the question "Was the database doing more work, or the same work more slowly?"
SQL |
Load Profile Per Second Per Transaction ~~~~~~~~~~~~~~~~~~~~~~~ ------------ --------------- DB Time(s): 14.0 0.1 DB CPU(s): 6.2 0.0 Redo size (bytes): 18,412,330.5 105,212.1 Logical read (blocks): 912,334.2 5,213.5 Physical read: 48,120.6 275.0 Executes: 9,812.4 56.1 Transactions: 175.0 |
How to read it: Compare with a good period. If Executes and Transactions doubled, the database is simply doing more work, and the question becomes "why did the application send more?". If they stayed the same but Logical reads or Physical reads jumped, a SQL plan probably changed.
Step 8: Read Top 10 Foreground Events
This is the most important section. It shows where the DB time went. Look at the "% DB time" column: the first two or three lines usually explain the problem.
SQL |
Event Waits Time(s) Avg(ms) % DB time Wait Class ---------------------------- ---------- -------- -------- ---------- ---------- DB CPU 22,312 44.0 db file sequential read 4,512,330 14,210 3.1 28.0 User I/O enq: TX - row lock contention 2,104 6,880 3270.0 13.6 Applicati log file sync 612,004 2,450 4.0 4.8 Commit gc buffer busy acquire 212,330 1,102 5.2 2.2 Cluster |
How to read the common events:
DB CPU high: sessions are working, not waiting. Look at SQL ordered by CPU and by gets.
db file sequential read: single-block reads, usually index access. A high count points to inefficient index access in a few SQLs. A high average (more than 10 ms on SSD) points to storage.
db file scattered read / direct path read: full scans. Check whether they are expected.
enq: TX - row lock contention: sessions waiting for row locks held by other sessions. This is an application design or locking problem, not a database resource problem.
log file sync: sessions waiting for commit. Too many commits, or slow redo log storage.
gc events (RAC): blocks moving between instances. Look at which segments and services cause it.
Step 9: Find the SQL Responsible
Now go to "SQL Statistics". Each list sorts the same statements by a different resource. Choose the list that matches your top event: SQL ordered by Elapsed Time in general, by CPU Time for DB CPU, by User I/O Wait Time for read events, by Gets for logical reads.
SQL |
SQL ordered by Elapsed Time Elapsed Executions Elapsed per %Total %CPU %IO SQL Id Time (s) Exec (s) ---------- ------------ ----------- ------- ----- ----- ------------- 18,214.2 1,204 15.13 35.9 12.1 86.2 8z4kq1xbv9r2m 6,880.4 410 16.78 13.6 0.1 0.0 3fg1d9a0y2kqp |
How to read it: Here one statement, 8z4kq1xbv9r2m, accounts for 36% of all DB time, mostly I/O. That is your tuning target. Run awrsqrpt.sql for that SQL_ID to see whether its plan changed (see the SQL Plan Baselines post on this blog for how to fix a plan regression).
Step 10: Zoom In on a Short Spike with ASH
AWR shows an hour. When the problem lasted five minutes, ASH is better. ASH samples every active session every second and keeps the samples in memory (V$ACTIVE_SESSION_HISTORY), and one in ten in AWR (DBA_HIST_ACTIVE_SESS_HISTORY).
SQL |
-- Top events and SQL during a 10-minute spike, from AWR's ASH SELECT NVL(event, 'ON CPU') AS event, sql_id, COUNT(*) * 10 AS approx_seconds FROM dba_hist_active_sess_history WHERE sample_time BETWEEN TIMESTAMP '2026-09-10 14:20:00' AND TIMESTAMP '2026-09-10 14:30:00' GROUP BY NVL(event, 'ON CPU'), sql_id ORDER BY approx_seconds DESC FETCH FIRST 10 ROWS ONLY;
-- Who was blocking whom? SELECT blocking_session, blocking_session_serial#, event, COUNT(*) AS samples FROM dba_hist_active_sess_history WHERE sample_time BETWEEN TIMESTAMP '2026-09-10 14:20:00' AND TIMESTAMP '2026-09-10 14:30:00' AND blocking_session IS NOT NULL GROUP BY blocking_session, blocking_session_serial#, event ORDER BY samples DESC; |
What this does: The first query shows which events and SQL statements dominated those 10 minutes. Each DBA_HIST sample represents about 10 seconds, so COUNT(*) * 10 is roughly the DB time in seconds. The second query finds the blocking sessions behind lock waits. You can also run @?/rdbms/admin/ashrpt.sql for a formatted ASH report.
Step 11: Get a Second Opinion from ADDM
ADDM (Automatic Database Diagnostic Monitor) analyses every pair of AWR snapshots automatically and writes findings with recommendations. It is a good cross-check of your own reading.
SQL |
@?/rdbms/admin/addmrpt.sql -- Begin snap: 48210 End snap: 48212 |
What to expect: A list of findings ordered by impact, for example "SQL statements consuming significant database time were found. Impact: 35%". Each finding has a recommendation, such as running the SQL Tuning Advisor on a specific SQL_ID. Treat them as hints, not orders.
Step 12: Turn the Findings into Action
Write down a short diagnosis that anyone can check: the symptom, the evidence and the action. For example:
Symptom: average active sessions rose from 3 to 14 between 14:00 and 15:00.
Evidence: db file sequential read rose to 28% of DB time. SQL 8z4kq1xbv9r2m accounts for 36% of DB time and switched to a new plan at 13:55.
Action: force the previous plan with a SQL plan baseline, then investigate why the plan changed (statistics gathered at 13:50).
Summary
Read an AWR report in a fixed order: DB time versus elapsed time, the load profile, the top foreground events, then the SQL lists that match the top event. Use a tight time window, compare with a good period using awrddrpt.sql, use ASH for short spikes and blocking chains, and use ADDM as a second opinion. With practice, finding the cause of most slowdowns takes minutes rather than hours.
Comments