If you cannot find the true reason a database is failing, you will apply the wrong fix, the problem will return, and the business could lose money or suffer a security breach. Database troubleshooting and root cause analysis is the methodical detective work used to pinpoint exactly why a database is slow, disconnected, corrupted, or failing to replicate, so you can apply a permanent solution. For the DBS-C01 exam, you must demonstrate that you can follow a structured, evidence-based process rather than guessing randomly.
Jump to a section
A simple way to picture Database Troubleshooting and Root Cause Analysis
A building superintendent is the person responsible for keeping a large apartment complex running smoothly. Tenants expect hot water, working lifts, and lights that switch on. When a tenant reports that the water in their shower is lukewarm, the superintendent does not immediately call a plumber and dig up the entire street. Instead, they take a methodical approach to find the real cause. They first check if the complaint is isolated to one apartment or affects the whole building. They look at the boiler room to see if the pilot light is on. They listen for strange sounds from the pipes. They ask other tenants if their showers are fine. The superintendent knows that a single cold shower could be caused by a faulty water heater, a closed valve in a specific flat, or even a neighbour running a washing machine that uses all the hot water. They also know that sometimes the boiler needs maintenance before it breaks entirely. The superintendent keeps a logbook of all repairs and complaints, noticing patterns that point to bigger underlying issues, like a pipe that clogs every few months. The job is not about guessing; it is about eliminating possible causes one by one until the real problem is found. This eliminates wasted effort and ensures the correct fix is applied the first time. In the same way, an IT professional troubleshooting a database uses a structured process to identify the root cause, not just the symptom.
Database troubleshooting is the process of identifying, diagnosing, and resolving problems in a database system. Root cause analysis (RCA) goes a step further: it identifies the fundamental underlying reason for a problem so the same issue does not happen again. In AWS, these skills are vital because databases power nearly every application, from online stores to banking systems. A slow database means angry customers. A disconnected database means lost sales. A corrupted database means lost data forever.
To understand troubleshooting, you must first know the four main categories of database problems: connectivity, performance, replication, and storage. Connectivity issues mean the application cannot reach the database at all. Performance issues mean the database is reachable but responds slowly. Replication issues happen when data is not copied correctly between a primary database and its replicas (backup copies). Storage issues occur when the database runs out of disk space or the storage subsystem is too slow.
Every troubleshooting process follows a logical sequence. You start by gathering information. What exactly is the symptom? Is the error message specific, like 'connection refused,' or vague, like 'timeout'? When did it start? Did a recent change (like a new software deployment or a network configuration update) happen just before the problem began? Next, you isolate the scope. Does the problem affect all users or just one? Does it affect all databases on the server or just one? You then form a hypothesis, which is an educated guess about the cause. You test that hypothesis by performing a controlled experiment. If the experiment disproves the hypothesis, you discard it and form a new one. If the experiment supports it, you have found the root cause. Finally, you implement a permanent fix and monitor the system to confirm the problem does not return.
Let us use an example. Imagine a company's e-commerce website is slow every day at 2 p.m. A beginner might immediately assume the database server is underpowered and ask for a larger instance. A troubleshooter does something different. They check the database metrics in Amazon CloudWatch (AWS's monitoring service). They see that CPU utilisation spikes at 2 p.m., but memory and disk I/O are normal. They then look at the slow query log, which records database queries that take a long time to run. They find a single query that runs every afternoon at 1:55 p.m. and takes 30 seconds. They contact the development team, who confirm they deployed a new report generation script that runs that query. The root cause is not the database server; it is the unoptimised query. The fix is to improve the query or schedule the report at a less busy time.
Root cause analysis for databases often involves checking these key areas:
Network connectivity: can the application reach the database security group? Is the Network Access Control List (NACL) blocking traffic? Are the route tables correct?
Database parameters: is the connection pool set too low? Is the timeout too short? Are resource limits (like max_connections) being hit?
Query performance: are there missing indexes? Are queries scanning entire tables instead of using an index? Is there a deadlock (two queries waiting for each other's locked data)?
Replication lag: are replicas falling behind because the primary is overwhelmed? Is the network bandwidth between regions too low?
Storage: is the disk full? Is the storage throughput (IOPS, or input/output operations per second) insufficient for the workload?
The AWS Shared Responsibility Model also plays a role. AWS is responsible for the infrastructure (physical hardware, network cables, power). You, the customer, are responsible for everything inside the database: user permissions, query optimisation, data backups, and security group rules. Therefore, when troubleshooting, you must first determine whether the issue is on your side or AWS's. AWS publishes service health dashboards and status pages to check for widespread outages.
A critical tool for RCA is the 'Five Whys' technique. You ask 'why' five times to drill down from a symptom to the root cause. For example: Symptom: Database backup failed. Why? Because the backup script could not connect to the database. Why? Because the database was not accepting connections. Why? Because the database had reached its maximum number of concurrent connections. Why? Because an application connection pool leak was not releasing connections after use. Why? Because the application code had a bug that did not close database connections in a 'finally' block. The root cause is a software bug, not a database configuration issue.
AWS provides several native services and features to assist with troubleshooting: Amazon CloudWatch for metrics and logs, AWS CloudTrail for recording API calls (like who changed a security group), AWS Trusted Advisor for checking best practices and service limits, and the Amazon RDS (Relational Database Service) events dashboard for maintenance notifications and failures.
For the exam, remember that troubleshooting always starts with the most likely, easiest-to-check causes first. Do not jump to a complex hypothesis before checking the simple things: is the database instance running? Is the security group allowing traffic from the correct IP address? Has the database password expired? Are the application credentials correct? The correct answer on the exam will follow this logical, layered approach.
1. Identify the Symptom
Clearly define what is wrong. Is the database unreachable, is it slow, is data missing, are backups failing? Use exact error messages from the application logs or database error log. This step prevents wasting time on the wrong problem.
2. Check the Database Status and Basic Connectivity
Log into the AWS Management Console and check the RDS or Aurora dashboard to confirm the instance is in 'available' state. Use the telnet or nc command to test connectivity to the endpoint and port. This quickly eliminates 'instance is down' as the cause.
3. Review Monitoring Metrics and Logs
Open Amazon CloudWatch to check CPU, memory, database connections, read/write IOPS, and replica lag (if applicable). Enable the slow query log and error log to find specific queries or errors. This gives evidence for your hypothesis.
4. Isolate the Scope and Pinpoint the Culprit
Determine if the problem affects one application, one user, or all users. Use Performance Insights to identify the top queries consuming resources. Look at CloudTrail for recent configuration changes. This narrows the search to a specific area, like a single query or a recent schema change.
5. Form and Test a Hypothesis
Based on the evidence, create an educated guess about the root cause. For example, 'the slow query has no index.' Test the hypothesis by creating an index on a staging environment first, or by analysing the query execution plan. If the test confirms the hypothesis, proceed to fix. If not, form a new hypothesis.
6. Apply a Permanent Fix and Verify
Implement the solution, such as adding an index, modifying a security group rule, or adjusting a database parameter. After the fix, monitor the system for at least 15–30 minutes to ensure the symptom does not return. Document the root cause and the fix for future reference.
Sarah is a junior database administrator at a mid-sized online retailer. One Monday morning, the customer service team reports that the 'order lookup' feature is timing out. Customers cannot see their recent purchases. Sarah's job is to find out why and fix it.
She starts by checking the Amazon RDS dashboard in the AWS Management Console. She sees that the primary database instance for the 'orders' database is in 'available' state, which means it is running. She then looks at Amazon CloudWatch metrics. She sees that the CPU utilisation is at 95%, the database connections metric is at the maximum limit, and the read latency for disk I/O has spiked. This tells her the database is under heavy load.
Next, Sarah checks whether the problem is global or local. She asks the customer service team if only the order lookup is slow, or if other functions (like login or product search) are also slow. They confirm only order lookup is affected. This narrows her focus to that specific database and its queries. She opens the RDS Performance Insights dashboard, which shows which queries are consuming the most resources. She sees one query that is running constantly and taking 10 seconds per execution: a SELECT statement joining the 'orders' and 'customers' tables without a proper index.
Sarah then checks the slow query log by enabling log export to CloudWatch Logs. She sees hundreds of entries for the same query. She goes one step further and checks AWS CloudTrail to see if any changes were made to the database schema over the weekend. She finds that a developer ran a script on Saturday night that removed an index on the 'customer_id' column of the 'orders' table. This was the trigger. Without the index, the database has to scan the entire 'orders' table to find a customer's orders, which is extremely slow when the table has millions of rows.
Sarah contacts the developer and learns the script was meant to drop a different, unused index, but the wrong index was targeted due to a copy-paste error. The root cause is human error during a schema change. The fix is to recreate the missing index. She runs the CREATE INDEX command (which takes a few minutes on a large table) and confirms the query execution time drops back to under 50 milliseconds. She also implements a change management policy requiring that all index changes be reviewed by two people and tested on a staging environment first.
If Sarah had not done root cause analysis, she might have simply rebooted the database (which would have only temporarily cleared the problem) or increased the database instance size (spending money on a symptom, not the cause). By finding the real root cause, she saved her company money and prevented the same mistake from happening again.
In AWS, real-world troubleshooting also involves these actions:
Checking the VPC (Virtual Private Cloud) flow logs to see if network packets are being dropped.
Using the SELECT pg_blocking_pids() function in Aurora PostgreSQL to find which session is blocking another.
Reviewing the error log for 'out of memory' or 'disk full' error messages.
Verifying that the database parameter group has appropriate values for max_connections, idle_in_transaction_session_timeout, and statement_timeout.
Confirming that the application connection pool (like HikariCP) is configured to release idle connections after a timeout.
This scenario shows that troubleshooting is a skill that combines data, logic, and communication with other teams. It is not just technical; it is about understanding the entire system, including how people interact with it.
The DBS-C01 exam tests your ability to follow a logical troubleshooting process, not just your memory of specific commands. The questions in objective 5.3 will present a scenario with multiple symptoms and ask you to identify the correct next step or the root cause. You must be able to eliminate incorrect options that sound plausible but would not actually fix the problem.
Exam topics you must master:
Connectivity troubleshooting steps: check security groups, network ACLs, route tables, VPC peering, DNS resolution, and the database endpoint. The exam loves to trap you by offering a 'fix' that involves changing something on the application side when the problem is network side, or vice versa.
Performance issues: understand the difference between a query that is slow because of a missing index versus a query that is slow because of a lock (waiting for another transaction). Know how to identify a full table scan using the query execution plan. Know that high CPU does not always mean database problem; it could be an unoptimised query.
Replication issues: know that replication lag can be caused by long-running transactions on the primary, insufficient network bandwidth, or a replica that is falling behind because it is too small. The exam may ask you to identify the cause of a replica lagging by looking at given metrics (like replica lag time and write I/O on primary).
Storage issues: know that storage auto-scaling in Amazon RDS can take time. Know what happens when a storage volume is full: the database goes into 'storage-full' state and may become read-only. Know that provisioned IOPS must match certain storage-to-IOPS ratios.
Root cause analysis method: the correct answer often begins with 'check the CloudWatch metrics' or 'check the error log'. Answers that say 'immediately restart the database' or 'increase the instance size' are usually traps because they treat symptoms, not causes.
Common trap patterns:
Trap 1: Presenting a problem where multiple things are wrong (e.g., a query is slow AND the database is low on memory). The correct answer is to fix the most likely root cause first, usually the missing index. The trap is choosing to increase memory when the query is the problem.
Trap 2: Giving a scenario where a network change was made, and the answer choices include 'restart the database' or 'reboot the EC2 instance.' The correct answer is to check the security group and route tables.
Trap 3: Asking about replication lag on Amazon Aurora and offering a fix like 'increase the instance size of the replica.' The correct answer for Aurora replication lag (when caused by a long-running query on the primary) is to tune the query, not resize the replica.
Key definitions to memorise:
Deadlock: two or more transactions holding locks on resources the other needs, causing all of them to wait forever. MySQL and PostgreSQL detect this and automatically kill one of the transactions.
Replication lag: the time delay between a write on the primary database and its appearance on a read replica. Measured in seconds. High replication lag means data is stale.
Read replica: a copy of the primary database used only for read queries (SELECT statements). It cannot be written to.
Multi-AZ deployment: a feature that automatically creates a standby database in a different Availability Zone for failover. This is for high availability, not read scaling.
Amazon CloudWatch: the AWS monitoring service that collects metrics (CPU, memory, disk I/O, database connections) and can trigger alarms.
Performance Insights: an AWS feature that provides a visualisation of database load and identifies the queries causing the most load.
Connection pooling: the practice of maintaining a cache of database connections so they can be reused, reducing the overhead of opening new connections.
You should also be familiar with the AWS tools for RCA: CloudTrail (for API activity), VPC Flow Logs (for network traffic), AWS Config (for configuration changes), and AWS Support cases (for AWS-side issues).
The exam will NOT ask you to write SQL queries, but you must understand what a slow query log is and how to enable it. You must know that you can set parameter groups to log queries that exceed a certain execution time.
Finally, the exam expects you to know when to escalate. If the problem is a hardware failure on AWS's side, the correct answer is to open a support case with AWS. If the problem is a misconfigured security group, the correct answer is to fix the security group. Do not escalate something you can fix yourself.
Database troubleshooting always starts by gathering data from monitoring tools like CloudWatch and checking the error logs before making any changes.
Root cause analysis uses the 'Five Whys' technique to drill from a symptom to the fundamental underlying cause of a database failure.
The most common cause of performance problems is a missing or dropped index, not an undersized database instance.
Replication lag is frequently caused by a long-running transaction on the primary database, not by the replica being too slow.
A connection timeout error does not mean the database is down; it often points to a network issue or exhausted connection pool.
When troubleshooting, always check the simplest, fastest things first: is the instance running, are security groups permissive, and are credentials valid.
Do not treat symptoms (e.g., high CPU) as the root cause; the root cause is the query or process causing the high CPU.
AWS CloudTrail is the primary tool for identifying who made a configuration change that caused a database issue.
These come up on the exam all the time. Here's how to tell them apart.
Multi-AZ Deployment
Synchronous replication from primary to standby
Used only for automatic failover, not for read traffic
Provides high availability during an AZ failure
Read Replica
Asynchronous replication from primary to replica
Can be used for SELECT queries to offload read traffic
Provides read scalability, not automatic failover
Slow Query Log
Text-based log of queries that exceed a time threshold
Must be manually enabled and parsed
Shows exact SQL statements and their execution time
Performance Insights
Dashboard in the AWS Management Console
Shows database load as a graph, broken down by SQL statement
Automatically identifies top queries without log parsing
Security Group (SG)
Acts as a virtual firewall at the instance level
Rules are evaluated as a whole (allow rules only)
Stateful: returning traffic is automatically allowed
Network ACL (NACL)
Acts as a firewall at the subnet level
Rules are evaluated in order, and both allow and deny rules are supported
Stateless: returning traffic must be explicitly allowed
CloudWatch Metric (e.g., CPUUtilization)
Shows the performance state of the database (e.g., CPU percentage)
Used for monitoring current health and setting alarms
Does not show who made a change
CloudTrail Event (e.g., CreateDBInstance)
Shows who performed an API action (e.g., created a database, modified a security group)
Used for auditing and root cause analysis of configuration changes
Does not show real-time performance metrics
Mistake
If the database is slow, I should immediately increase the instance size to get more CPU and memory.
Correct
Increasing instance size treats the symptom, not the cause. You should first check for missing indexes, long-running queries, or lock contention. Improving query performance is usually cheaper and more effective than scaling up.
It is easy to think that more resources always solve performance problems because it works in many physical-world scenarios (like adding more workers to speed up a task). In databases, a single bad query can consume all resources regardless of instance size.
Mistake
Replication lag is always caused by the replica being too slow or underpowered.
Correct
Replication lag is often caused by a long-running write transaction on the primary database. The replica cannot apply the changes until the primary transaction completes. Also, schema changes (like ALTER TABLE) can block replication.
People naturally assume the 'follower' (replica) is the bottleneck, but the 'leader' (primary) can also cause the lag if it holds up the replication stream.
Mistake
A database connection timeout error always means the database is down.
Correct
A connection timeout means the application waited too long for a response. The database could be running but overwhelmed with connections, or a firewall (security group or NACL) could be blocking the traffic. It could also be that the connection pool is exhausted.
The word 'timeout' sounds final and scary, so beginners assume the worst. In reality, it is a symptom that often has a simple fix like increasing the connection pool size or adding a rule to the security group.
Mistake
If a database query worked yesterday but not today, the database must have changed.
Correct
The database might not have changed. The data has changed. A query that is efficient on a small table becomes slow as the table grows. The root cause could be data volume growth, not a configuration change.
People think of software as static, but databases are dynamic. The data grows and changes constantly. A query execution plan that worked with 1,000 rows will not work the same way with 10 million rows.
Mistake
Root cause analysis means finding who to blame for the problem.
Correct
RCA is about finding what process or condition caused the failure, not who caused it. Blame prevents people from being honest about mistakes. A good RCA focuses on system improvements so the failure cannot happen again.
In everyday life, people often blame the person 'who clicked the wrong button.' In IT, the root cause is usually a lack of safeguards (like a review process or automated test), not a single person's mistake.
Reveal each answer, then mark whether you got it right. Score 60%+ to unlock the next chapter.
Use AWS CloudTrail. Search for the event name 'AuthorizeSecurityGroupIngress' or 'RevokeSecurityGroupIngress' and filter by the security group ID. CloudTrail shows who made the change, when, and from which IP address.
A read replica is a copy of the primary database that you can use for SELECT queries to offload read traffic. A Multi-AZ standby is a synchronous copy that is used only for automatic failover if the primary fails. You cannot query a Multi-AZ standby directly.
Enable Performance Insights on your RDS instance. It will show you the top SQL queries by load. You can also enable the slow query log and monitor it in CloudWatch Logs to find queries that run longer than a threshold you set.
You must free up space immediately. You can delete old logs, drop unused indexes, or archive old data to another storage service. You can also modify the RDS instance to enable storage auto-scaling or increase the allocated storage manually. The database may become read-only until space is freed.
A sudden increase in replication lag is often caused by a long-running transaction or a DDL operation (like ALTER TABLE) on the primary database. It can also happen if there is a burst of write traffic or if network bandwidth between the primary and replica is saturated.
A deadlock occurs when two transactions are each holding a lock on a resource the other transaction needs. Neither can proceed, so the database automatically kills one transaction to resolve the deadlock. You will see an error message like 'Deadlock found when trying to get lock' in the application logs.
From a server in the same VPC, try to connect to the database endpoint using a tool like 'mysql' or 'psql'. If it times out, check the security group inbound rules for the database to ensure it allows traffic from your server's security group or IP address. Also check the network ACLs for your subnet.
You've finished Database Troubleshooting and Root Cause Analysis. Continue through the DBS-C01 study guide to build a complete picture of the exam.
Done with this chapter?