Performance Tuning Scripts.

A practical collection of Oracle DBA scripts grouped for AWR, ASH, response time, Exadata, ADB, daily health checks, monitoring, and incident troubleshooting.

Disclaimer: These scripts are provided for educational and learning purposes. Review every query, test in a non-production or lower environment first, confirm required privileges, and validate performance impact before using anything in production.
103 files available
7 sections

AWR History Starter Scripts

8 files

sql

1 SQL Statements In AWR History Tables

1_sql_statements_in_awr_history_tables.sql

sql

2 Active Session History Longest Wait Times

2_active_session_history_longest_wait_times.sql

sql

3 Busiest Objects Since Last Database Restart

3_busiest_objects_since_last_database_restart.sql

sql

4 Busy Tables From AWR History

4_busy_tables_from_awr_history.sql

sql

5 Detailed History For Particular Query

5_detailed_history_for_particular_query.sql

sql

6a AWR History Long Running Queries

6a_awr_history_long_running_queries.sql

sql

6b AWR History Often Executed Queries

6b_awr_history_often_executed_queries.sql

sql

7 Plan History For Particular SQL Id

7_plan_history_for_particular_sql_id.sql

Oracle Performance Tuning Diagnostics

52 files

sql

01 Top SQL By Elapsed Time AWR

oracle_dba_perf_toolkit/performance_tuning/01_top_sql_by_elapsed_time_awr.sql

sql

02 Top SQL By Cpu AWR

oracle_dba_perf_toolkit/performance_tuning/02_top_sql_by_cpu_awr.sql

sql

03 Top SQL By IO Wait AWR

oracle_dba_perf_toolkit/performance_tuning/03_top_sql_by_io_wait_awr.sql

sql

04 ASH Wait Profile Last 60m

oracle_dba_perf_toolkit/performance_tuning/04_ash_wait_profile_last_60m.sql

sql

05 SQL With Plan Changes AWR

oracle_dba_perf_toolkit/performance_tuning/05_sql_with_plan_changes_awr.sql

sql

06 High Parse SQL Shared Pool Pressure

oracle_dba_perf_toolkit/performance_tuning/06_high_parse_sql_shared_pool_pressure.sql

sql

07 Segment Hotspots Reads Writes

oracle_dba_perf_toolkit/performance_tuning/07_segment_hotspots_reads_writes.sql

sql

08 System Waits Non Idle

oracle_dba_perf_toolkit/performance_tuning/08_system_waits_non_idle.sql

sql

09 IO Latency By Datafile

oracle_dba_perf_toolkit/performance_tuning/09_io_latency_by_datafile.sql

sql

10 PGA Temp Spill Candidates

oracle_dba_perf_toolkit/performance_tuning/10_pga_temp_spill_candidates.sql

sql

11 Top Sessions By Cpu Now

oracle_dba_perf_toolkit/performance_tuning/11_top_sessions_by_cpu_now.sql

sql

12 SQL Plan History For SQL Id

oracle_dba_perf_toolkit/performance_tuning/12_sql_plan_history_for_sql_id.sql

sql

13 Undo Pressure By Hour AWR Cdb Root Only

oracle_dba_perf_toolkit/performance_tuning/13_undo_pressure_by_hour_awr_cdb_root_only.sql

sql

14 Temp Spill Workarea Histogram

oracle_dba_perf_toolkit/performance_tuning/14_temp_spill_workarea_histogram.sql

sql

15 Undo Temp Parameter Review

oracle_dba_perf_toolkit/performance_tuning/15_undo_temp_parameter_review.sql

sql

16 Current Running SQL Realtime

oracle_dba_perf_toolkit/performance_tuning/16_current_running_sql_realtime.sql

sql

17 ASH Current And Recent SQL

oracle_dba_perf_toolkit/performance_tuning/17_ash_current_and_recent_sql.sql

sql

18 AWR SQL Regression Compare Cdb Root Only

oracle_dba_perf_toolkit/performance_tuning/18_awr_sql_regression_compare_cdb_root_only.sql

sql

19 ASH SQL Timeline For SQL Id Cdb Root Only

oracle_dba_perf_toolkit/performance_tuning/19_ash_sql_timeline_for_sql_id_cdb_root_only.sql

sql

20 Snapshot Too Old Incidents From Alert Log Cdb Root Only

oracle_dba_perf_toolkit/performance_tuning/20_snapshot_too_old_incidents_from_alert_log_cdb_root_only.sql

sql

21 Snapshot Too Old Undo Timeline Cdb Root Only

oracle_dba_perf_toolkit/performance_tuning/21_snapshot_too_old_undo_timeline_cdb_root_only.sql

sql

22 Snapshot Too Old SQL Candidates From ASH Cdb Root Only

oracle_dba_perf_toolkit/performance_tuning/22_snapshot_too_old_sql_candidates_from_ash_cdb_root_only.sql

sql

23 Current Long Transactions Holding Undo

oracle_dba_perf_toolkit/performance_tuning/23_current_long_transactions_holding_undo.sql

sql

24 Snapshot Too Old Risk Long Queries Vs Retention

oracle_dba_perf_toolkit/performance_tuning/24_snapshot_too_old_risk_long_queries_vs_retention.sql

sql

25 Snapshot Too Old Full Diagnostic Bundle

oracle_dba_perf_toolkit/performance_tuning/25_snapshot_too_old_full_diagnostic_bundle.sql

sql

30 Share Pool Errors From Alert Log Cdb Root Only

oracle_dba_perf_toolkit/performance_tuning/30_share_pool_errors_from_alert_log_cdb_root_only.sql

sql

31 Share Pool Pressure Indicators

oracle_dba_perf_toolkit/performance_tuning/31_share_pool_pressure_indicators.sql

sql

32 Shared Pool Reserved Diagnostics

oracle_dba_perf_toolkit/performance_tuning/32_shared_pool_reserved_diagnostics.sql

sql

33 Share Pool Top SQL Hard Parse Pressure

oracle_dba_perf_toolkit/performance_tuning/33_share_pool_top_sql_hard_parse_pressure.sql

sql

34 Deadlock Incidents From Alert Log Cdb Root Only

oracle_dba_perf_toolkit/performance_tuning/34_deadlock_incidents_from_alert_log_cdb_root_only.sql

sql

35 Deadlock Lock Wait Chains

oracle_dba_perf_toolkit/performance_tuning/35_deadlock_lock_wait_chains.sql

sql

36 Deadlock Locked Objects And SQL

oracle_dba_perf_toolkit/performance_tuning/36_deadlock_locked_objects_and_sql.sql

sql

37 PGA SGA Memory Errors From Alert Log Cdb Root Only

oracle_dba_perf_toolkit/performance_tuning/37_pga_sga_memory_errors_from_alert_log_cdb_root_only.sql

sql

38 PGA Usage And Limit By Instance

oracle_dba_perf_toolkit/performance_tuning/38_pga_usage_and_limit_by_instance.sql

sql

39 SGA Pool Usage By Instance

oracle_dba_perf_toolkit/performance_tuning/39_sga_pool_usage_by_instance.sql

sql

40 Process Memory Top Consumers

oracle_dba_perf_toolkit/performance_tuning/40_process_memory_top_consumers.sql

sql

41 Current Db Response Metrics

oracle_dba_perf_toolkit/performance_tuning/41_current_db_response_metrics.sql

sql

42 Current SQL Response Speed

oracle_dba_perf_toolkit/performance_tuning/42_current_sql_response_speed.sql

sql

43 Historical Db Time Wait Trend Cdb Root Only

oracle_dba_perf_toolkit/performance_tuning/43_historical_db_time_wait_trend_cdb_root_only.sql

sql

44 Historical Db Response Metrics Cdb Root Only

oracle_dba_perf_toolkit/performance_tuning/44_historical_db_response_metrics_cdb_root_only.sql

sql

45 Historical SQL Response For SQL Id Cdb Root Only

oracle_dba_perf_toolkit/performance_tuning/45_historical_sql_response_for_sql_id_cdb_root_only.sql

sql

46 Current Vs Baseline Response Compare Cdb Root Only

oracle_dba_perf_toolkit/performance_tuning/46_current_vs_baseline_response_compare_cdb_root_only.sql

sql

47 Executive Summary Daily Checks Cdb Root Only

oracle_dba_perf_toolkit/performance_tuning/47_executive_summary_daily_checks_cdb_root_only.sql

sql

48 OS Pressure By Instance

oracle_dba_perf_toolkit/performance_tuning/48_os_pressure_by_instance.sql

sql

49 RAC GC Wait Profile

oracle_dba_perf_toolkit/performance_tuning/49_rac_gc_wait_profile.sql

sql

50 Commit Redo Pressure

oracle_dba_perf_toolkit/performance_tuning/50_commit_redo_pressure.sql

sql

51 Storage Latency By Filetype

oracle_dba_perf_toolkit/performance_tuning/51_storage_latency_by_filetype.sql

sql

52 Exadata Smart Scan Efficiency

oracle_dba_perf_toolkit/performance_tuning/52_exadata_smart_scan_efficiency.sql

sql

53 Exadata Top Cell Waits

oracle_dba_perf_toolkit/performance_tuning/53_exadata_top_cell_waits.sql

sql

54 AWR ASH Bottleneck Analyzer Cdb Root Only

oracle_dba_perf_toolkit/performance_tuning/54_awr_ash_bottleneck_analyzer_cdb_root_only.sql

sql

55 IOPS Average Max By Instance Cdb Root Only

oracle_dba_perf_toolkit/performance_tuning/55_iops_average_max_by_instance_cdb_root_only.sql

sql

56 Sqlplus Cpu Iowait IOPS Narrowdown Cdb Root Only

oracle_dba_perf_toolkit/performance_tuning/56_sqlplus_cpu_iowait_iops_narrowdown_cdb_root_only.sql

Autonomous Database Performance Tuning

14 files

sql

00 ADB Access Check

oracle_dba_perf_toolkit/adb_performance_tuning/00_adb_access_check.sql

sql

01 ADB Current Db Response Metrics

oracle_dba_perf_toolkit/adb_performance_tuning/01_adb_current_db_response_metrics.sql

sql

02 ADB Top SQL Response Speed

oracle_dba_perf_toolkit/adb_performance_tuning/02_adb_top_sql_response_speed.sql

sql

03 ADB Current Wait Profile ASH

oracle_dba_perf_toolkit/adb_performance_tuning/03_adb_current_wait_profile_ash.sql

sql

04 ADB Top Wait Events

oracle_dba_perf_toolkit/adb_performance_tuning/04_adb_top_wait_events.sql

sql

05 ADB Temp Usage By Session

oracle_dba_perf_toolkit/adb_performance_tuning/05_adb_temp_usage_by_session.sql

sql

06 ADB Undo Risk Active SQL

oracle_dba_perf_toolkit/adb_performance_tuning/06_adb_undo_risk_active_sql.sql

sql

07 ADB Alert Log Errors Last N Hours

oracle_dba_perf_toolkit/adb_performance_tuning/07_adb_alert_log_errors_last_n_hours.sql

sql

08 ADB Historical Db Response Metrics

oracle_dba_perf_toolkit/adb_performance_tuning/08_adb_historical_db_response_metrics.sql

sql

09 ADB Historical SQL Response For SQL Id

oracle_dba_perf_toolkit/adb_performance_tuning/09_adb_historical_sql_response_for_sql_id.sql

sql

10 ADB ASH Bottleneck Analyzer

oracle_dba_perf_toolkit/adb_performance_tuning/10_adb_ash_bottleneck_analyzer.sql

sql

11 ADB Executive Summary

oracle_dba_perf_toolkit/adb_performance_tuning/11_adb_executive_summary.sql

md

Readme ADB

oracle_dba_perf_toolkit/adb_performance_tuning/README_ADB.md

sql

Run ADB Performance Tuning

oracle_dba_perf_toolkit/adb_performance_tuning/run_adb_performance_tuning.sql

Daily DBA Health Checks

15 files

sql

01 Instance And Database Status

oracle_dba_perf_toolkit/daily_dba/01_instance_and_database_status.sql

sql

02 Tablespace Usage

oracle_dba_perf_toolkit/daily_dba/02_tablespace_usage.sql

sql

03 Datafiles Autoextend Capacity

oracle_dba_perf_toolkit/daily_dba/03_datafiles_autoextend_capacity.sql

sql

04 Invalid Objects By Owner

oracle_dba_perf_toolkit/daily_dba/04_invalid_objects_by_owner.sql

sql

05 Blocking And Blocked Sessions

oracle_dba_perf_toolkit/daily_dba/05_blocking_and_blocked_sessions.sql

sql

06 Long Running Operations

oracle_dba_perf_toolkit/daily_dba/06_long_running_operations.sql

sql

07 Failed Scheduler Jobs Last 24h

oracle_dba_perf_toolkit/daily_dba/07_failed_scheduler_jobs_last_24h.sql

sql

08 Archivelog Generation Last 24h

oracle_dba_perf_toolkit/daily_dba/08_archivelog_generation_last_24h.sql

sql

09 Temp Usage By Session

oracle_dba_perf_toolkit/daily_dba/09_temp_usage_by_session.sql

sql

10 Stale Optimizer Stats

oracle_dba_perf_toolkit/daily_dba/10_stale_optimizer_stats.sql

sql

11 Undo Tablespace Usage And Retention Cdb Root Only

oracle_dba_perf_toolkit/daily_dba/11_undo_tablespace_usage_and_retention_cdb_root_only.sql

sql

12 Undo Active Transactions

oracle_dba_perf_toolkit/daily_dba/12_undo_active_transactions.sql

sql

13 Temp Tablespace Usage Summary

oracle_dba_perf_toolkit/daily_dba/13_temp_tablespace_usage_summary.sql

sql

14 Alert Log Errors Last N Hours

oracle_dba_perf_toolkit/daily_dba/14_alert_log_errors_last_n_hours.sql

sql

15 Redo Log Switches By Hour RAC

oracle_dba_perf_toolkit/daily_dba/15_redo_log_switches_by_hour_rac.sql

Incident Response Kits

8 files

sql

Run AWR ASH Analyzer

oracle_dba_perf_toolkit/incident_kits/run_awr_ash_analyzer.sql

sql

Run Deadlock Kit

oracle_dba_perf_toolkit/incident_kits/run_deadlock_kit.sql

sql

Run Exadata Core Perf Kit

oracle_dba_perf_toolkit/incident_kits/run_exadata_core_perf_kit.sql

sql

Run Executive Summary

oracle_dba_perf_toolkit/incident_kits/run_executive_summary.sql

sql

Run Memory Kit

oracle_dba_perf_toolkit/incident_kits/run_memory_kit.sql

sql

Run Response Time Kit

oracle_dba_perf_toolkit/incident_kits/run_response_time_kit.sql

sql

Run Share Pool Kit

oracle_dba_perf_toolkit/incident_kits/run_share_pool_kit.sql

sql

Run Snapshot Too Old Kit

oracle_dba_perf_toolkit/incident_kits/run_snapshot_too_old_kit.sql

Monitoring and PromQL Notes

2 files

md

01 Node Cpu Iowait And IOPS

oracle_dba_perf_toolkit/monitoring_promql/01_node_cpu_iowait_and_iops.md

md

02 Disk Bottleneck Narrowdown

oracle_dba_perf_toolkit/monitoring_promql/02_disk_bottleneck_narrowdown.md

Toolkit Launchers and Documentation

4 files

md

Readme

oracle_dba_perf_toolkit/README.md

22 KB Open script
sql

Run Daily Dba

oracle_dba_perf_toolkit/run_daily_dba.sql

sql

Run Performance Tuning

oracle_dba_perf_toolkit/run_performance_tuning.sql