Database Restore Drills and Recovery Targets
Every team has backups; far fewer know whether they can restore them, how long it takes, or how much data they would lose. Those questions are usually answered for the first time during an outage, when the archive turns out to be missing a day of logs, the restore needs a permission nobody has, or the "one-hour" recovery takes nine. A restore drill answers them in advance: restore a real production backup into an isolated environment on a schedule, check that the data is complete and consistent, and record exactly how long each step took.
Drills turn the recovery point objective (RPO, how much data you can afford to lose) and recovery time objective (RTO, how long you can be down) from numbers in a policy document into measurements. When the measured values drift past the targets — usually because the database grew — the drill tells you before an incident does.
TL;DR
- Set RPO and RTO per database from business impact, and choose backup mechanisms that can meet them.
- Automate restores of real production backups into an isolated environment, at least monthly and more often for critical data.
- Verify restored data: tables present, row counts plausible, business invariants intact, newest data close to the target time.
- Measure the real RPO (how stale the newest recoverable data is) and RTO (time until the application works again).
- Rehearse scenarios: full loss, point-in-time recovery after a bad change, single-table recovery, and loss of a region or account.
- Alert on failed drills and on restore times approaching the RTO, and update the runbook after every drill.
Quick Example
A monthly drill for an Amazon RDS PostgreSQL database: restore to the latest restorable time in an isolated subnet, run checks, measure RPO and RTO, and always delete the copy afterwards.
The ops.heartbeat table receives a row every minute in production, so the newest heartbeat in the restored copy proves the restore really contains data up to the target. The measured RTO covers the technical restore only; detection, decision, and repointing applications are rehearsed in a fuller drill.
Core Concepts
Targets Versus Measurements
The targets are promises; the measurements show whether you can keep them. See Database Backups & Recovery for the mechanisms behind each.
Recovery Tiers
Not every database deserves the same investment. Group them into tiers:
Why Restores Fail
Drills catch problems that never show up while backups are only being written:
- Gaps in archived write-ahead logs or binlogs, so point-in-time recovery stops short.
- Backups encrypted with keys that were rotated, deleted, or held in the same compromised account.
- Missing permissions to read the backup bucket from the recovery environment.
- Objects outside the backup: roles and grants (
pg_dumpdoes not include roles), extensions, configuration, scheduled jobs, secrets. - Restores that take many times longer than expected, because indexes are rebuilt or the database tripled in size.
- A runbook that no longer matches the infrastructure, and one person who knows the real steps.
Replication Is Not a Backup
Replicas copy every change, including a mistaken DELETE or a corrupting migration, within seconds. They protect against hardware and zone failure, not against bad writes. Restore drills test the mechanisms that protect against both.
Designing Drills
Scenarios
Frequency
- Automated technical restore: weekly or monthly per database, nightly for the most critical.
- Full scenario drill with application cutover and on-call participants: quarterly or twice a year.
- After significant change: a major version upgrade, a new backup tool, a storage migration, or rapid data growth.
Isolation and Data Protection
A restored copy is a full copy of production data. Restore into an isolated network, with access limited to the drill's automation and named operators, and delete it when the drill ends. Disable anything that acts on the outside world — scheduled jobs, outbound email, webhooks, payment integrations — so a restored copy cannot email customers or charge cards.
Verifying a Restore
"The database started" is the lowest bar. Verification should climb further:
- Availability — the instance starts and accepts connections.
- Structure — the expected schema version, tables, extensions, and roles exist.
- Physical integrity — page checksums and index checks pass; in PostgreSQL, the
amcheckextension verifies B-tree indexes. - Completeness — the newest data is close to the target time, and row counts are in a plausible range.
- Consistency — business invariants still hold across tables.
- Application — smoke tests pass with the application pointed at the restored copy.
Measuring and Reporting
Record every drill: the backup used, the target time, measured data age, the duration of each phase, the result, problems found, and runbook changes made. Timing each phase shows where recovery time actually goes:
Plot restore duration over time. Databases grow steadily, and restore time grows with them; alert when the measured RTO passes about 80% of the target, so there is time to change the approach before it is breached. Auditors for frameworks such as SOC 2 and ISO 27001 commonly ask for evidence of restore testing, and drill logs provide it.
Best Practices
Automate the Whole Drill
Drills that depend on someone finding a free afternoon stop happening. Schedule them, run them unattended, and page someone when they fail — a failed drill is an incident in waiting.
Restore the Way a Disaster Would Force You To
Use the production backups, the recovery account, and the cross-region copies you would really depend on, rather than a convenient admin role in the primary account. A drill that relies on something an outage would take away proves little.
Rotate the People
Have different engineers run the manual scenario drills. Recovery knowledge that lives in one head is a single point of failure, and fresh eyes find gaps in the runbook.
Back Up What Surrounds the Data
Roles, grants, extensions, configuration, encryption keys, and secrets are part of a working restore. Include them in backups and verify them in drills.
Keep the Runbook Beside the Script
After each drill, update the runbook with what was learned. Store it where people will find it during an incident, including when the main documentation system is down. See Disaster Recovery Planning.
Common Mistakes
Treating Successful Backup Jobs as Proof
Drilling on a Toy Database
Restored Copies That Act Like Production
An RTO That Leaves Out the Humans
FAQ
How often should we run restore drills?
Automate technical restores at least monthly for every important database, weekly or nightly for critical ones, and run a fuller scenario drill with people and application cutover at least twice a year. Run an extra drill after major upgrades or changes to the backup system.
Can replication replace restore drills?
No. Replication copies mistakes and corruption almost instantly, so it cannot recover from a bad migration or a mass delete. It shortens recovery from hardware failure; backups and tested restores recover from bad data.
How do we rehearse point-in-time recovery?
Pick a realistic event — a deliberately run destructive statement against a drill copy, or a known timestamp from logs — then restore to just before it and confirm that the data from before the event is present and the change itself is absent. Finding the right target time from logs is part of the skill being rehearsed.
Do managed databases make drills unnecessary?
No. Managed services handle backup mechanics, but you still need to confirm that you can restore within your RTO, that the restored data is complete, that applications can be repointed, and that someone knows how. Managed restores also take longer as data grows.
How do we drill restores without exposing production data?
Run them in an isolated environment with access limited to automation and a few named operators, run verification as automated checks rather than manual browsing, and delete the copy at the end. Treat the drill environment with the same data protections as production. See PostgreSQL Backup & Recovery for engine-specific tooling.
Related Topics
- Database Backups & Recovery — Backup types, PITR, RPO and RTO
- PostgreSQL Backup & Recovery — Engine-specific backup and restore tools
- Disaster Recovery Planning — Recovery beyond a single database
- Backup Strategy & Restore Testing — Copies, retention, and storage choices
- Database Replication — High availability, and why it is not a backup
- Immutable Backups and Restore Verification — Backups that survive ransomware and compromised accounts
- Stateful Kubernetes Backup and Restore — Restores for workloads on Kubernetes
References
- Continuous Archiving and Point-in-Time Recovery (PostgreSQL documentation)
- amcheck (PostgreSQL documentation)
- restore-db-instance-to-point-in-time (AWS CLI reference)
- pgBackRest User Guide
- Data Integrity: What You Read Is What You Wrote (Google SRE Book)
- NIST SP 800-34 Rev. 1: Contingency Planning Guide for Federal Information Systems