Database Server Monitoring

Understand why database monitoring is critical, what to monitor, how to monitor and the common bottlenecks that impact database performance.

1

Why Do We Monitor Database Server?

The database is the heart of most applications. Poor database performance impacts the entire system.
Ensure Availability
Detect issues early and prevent downtime.
Optimize Performance
Identify and remove bottlenecks to improve response time.
Capacity Planning
Track resource usage to plan for future growth.
Problem Detection
Find issues before users experience failures.
Cost Optimization
Efficient resource usage reduces infrastructure costs.
2

What Do We Monitor in a Database Server?

Database performance depends on CPU, Memory, I/O, Storage, Connections, Queries and Wait Events.
System Resources
CPU Usage
High CPU indicates heavy load or inefficient queries.
Memory (SGA / PGA)
High memory usage or spills cause performance degradation.
Disk I/O
High I/O waits indicate storage bottlenecks.
Network
High network latency affects response time.
Database Internals
Active Sessions
Track the number and status of user sessions.
SQL Performance
Identify slow or resource intensive SQL.
Wait Events
Understand what the database is waiting for.
Locks & Blocking
Detect blocking sessions and lock contention.
Storage & Space
Tablespace Usage
Monitor datafile and tablespace utilization.
Redo / Archive Logs
Ensure sufficient space and proper log switching.
Backup Status
Verify backups are successful and up to date.
Fragmentation
Identify and reduce fragmentation.
Monitoring these metrics helps in maintaining high availability, optimal performance and prevents potential failures.
3

How Do We Monitor Database Server?

Monitoring can be performed using database views, native tools and external monitoring solutions.
Collect Metrics
Gather metrics using DB views, AWR, OEM, Agent or scripts.
Store & Retain
Store collected data for trend analysis and historical comparison.
Analyze
Analyze metrics to identify anomalies and bottlenecks.
Alert
Set thresholds and get alerts on critical conditions.
Take Action
Investigate root cause and optimize database performance.
Common Monitoring Tools
Oracle Enterprise
Manager (OEM)
Oracle AWR / ASH
Reports
Statspack
Prometheus +
Grafana
Custom Scripts
(SQL, Shell, Python)
4

Common Database Bottlenecks

Bottlenecks occur when demand is higher than the available resources.
Bottleneck Area Symptoms Impact Possible Causes How to Identify
CPU Contention
High CPU usage, slow response Slow queries, high latency Complex queries, lack of indexes, parallel execution High CPU, Top SQL by CPU in AWR
Memory Pressure
High physical reads, swaps Poor performance, more I/O Insufficient SGA/PGA, memory leaks High DB time on 'db file scattered read'
I/O Bottleneck
High I/O wait, slow reads/writes Slow transactions and queries Slow disks, high concurrent I/O High I/O wait events in AWR
Lock Contention
Blocked sessions, waits Transactions waiting, timeouts Long running transactions, poor design High 'enq: TX - row lock contention'
Slow Queries
High DB time, long execution Poor response time Missing indexes, bad SQL, no stats Top SQL by Elapsed Time in AWR
Storage Full
Errors, backup failures Downtime risk Tablespace full, redo log full High % usage in tablespaces/logs
5

How to Identify & Troubleshoot - Analysis Steps

Follow a structured approach to find and fix database performance issues.
1
Check Overview
Review overall health, alerts and key metrics (CPU, Memory, I/O, Sessions).
2
Check Top Wait Events
Identify top wait events from AWR/ASH to know where time is spent.
3
Check Top SQL
Find SQLs with highest CPU/Elapsed Time/I/O using AWR/ASH.
4
Analyze SQL
Check execution plan, indexes, bind variables and statistics.
5
Check Locks
Identify blocking sessions and lock contention.
6
Validate Resources
Validate CPU, Memory, I/O and Storage utilization.
7
Take Corrective Action
Optimize SQL, add indexes, tune parameters, scale resources.
6

Best Practices for Database Monitoring

Monitor Continuously
24x7 monitoring helps in early detection.
Set Appropriate Alerts
Configure meaningful thresholds to avoid alert fatigue.
Review Regularly
Review performance reports and trends regularly.
Keep Statistics Updated
Outdated stats lead to poor query execution plans.
Automate Reports
Automate AWR/ASH reports and share insights.
Plan Capacity
Plan for growth based on trends and usage patterns.
Effective database monitoring helps in delivering better performance, high availability and a great user experience.