General PERFORMANCE TUNING scripts Using AWR and ASH Views
Note: Proof read any scripts before using. Always try scripts on a test instance first. This Blog is not responsible for any damage. Listed below are some SQL queries which are very useful for performance tuning. these are based on the ACTIVE SESSION HISTORY V$ VIEW to get a current perspective of performance and the DBA_HIST_* AWR HISTORY TABLES for obtaining performance data pertaining to a period of time in the past. -- TOP RECENT WAIT EVENTS SET LINESIZE 132 PAGESIZE 60 COL EVENT FORMAT A60 SELECT * FROM ( SELECT ACTIVE_SESSION_HISTORY.EVENT, SUM(ACTIVE_SESSION_HISTORY.WAIT_TIME + ACTIVE_SESSION_HISTORY.TIME_WAITED) TTL_WAIT_TIME FROM V$ACTIVE_SESSION_HISTORY ACTIVE_SESSION_HISTORY WHERE ACTIVE_SESSION_HISTORY.EVENT IS NOT NULL GROUP BY ACTIVE_SESSION_HISTORY.EVENT ORDER BY ...