dataiotech Labs
dbaguidedbaguideDBAdataxtoolsdataopsphere
Scripts Library/oracle/#77
Script #77
oracle
Performanceread-only (Diagnostics Pack lisansı)Min Version: 11g

Top Oracle Wait Events from ASH in the Last Hour

Extracts the busiest wait events and SQL from Active Session History over the last hour. Used for retrospective performance analysis.

#awr#wait-events#ash
oracle · sql
SELECT NVL(event, 'ON CPU') AS event, wait_class,
       COUNT(*) AS ash_samples,
       ROUND(100 * RATIO_TO_REPORT(COUNT(*)) OVER (), 1) AS pct
FROM   v$active_session_history
WHERE  sample_time > SYSDATE - 1/24
GROUP  BY event, wait_class
ORDER  BY ash_samples DESC
FETCH FIRST 15 ROWS ONLY;
Operational Notes & Remediation Guidance

Active Session History (ASH) provides second-by-second visibility into session bottlenecks without trace overhead.

Production Safety & Execution Standards
  • This script is designed for read-only diagnostics; it does not alter schema or modify data directly.
  • Prior to executing on production systems under high load, verify the target database version (Min. Version: 11g).
  • Exercise caution with mutating actions (e.g., terminating sessions or dropping indexes) referenced in the notes section.