Use it to design backups or when you must restore.
Backup, Restore & Recovery
Backup, restore and recovery protect data: full, differential and log/WAL backups; logical dumps vs physical copies; point-in-time recovery; and regular restore tests.
1. Last successful backup per database (SELECT database_name,MAX(backup_finish_date) FROM msdb.dbo.backupset GROUP BY database_name; / backup tool report).
2. Log/WAL archiving working: SELECT * FROM pg_stat_archiver;?
3. Copies off-host?
4. Restore test date and duration.
5. Encryption and retention.
full + incremental/log backups → stored off-host → restore + replay → verified
Common failures are missing log segments, inconsistent filesystem-only copies, untested encryption keys/credentials, retention deleting a required base/log chain, backups stored on the same failure domain and assuming snapshot success equals application-consistent recovery. Preserve the first divergent observation and repeat the same bounded verification after remediation.
Continue only after interpreting the current observation.Context & applicabilityCommon mistakes · platform/version boundaries
Databases owns engine-consistent backup/recovery procedures. Storage owns media/snapshot durability; Automation owns scheduling/orchestration; the recovery evidence belongs to the database outcome.
Operational reference
Fast context before you go deeper.
Verification & Troubleshooting
Start with the observed symptom, prove the nearest boundary, and move outward only when the current state is understood.
Use the operational verification above to establish the expected state.
Capture the concrete output, symptom, packet, log or counter before changing anything.
Step 1 Verification workflow Verify boundary
Record backup type, scope, timestamp/position and required log chain. Restore into an isolated target, run engine consistency checks where appropriate, verify representative data/application reads and measure elapsed recovery time. For PITR, show the exact target time/transaction boundary.
Step 2 Failure signatures and limits Narrow the fault
Common failures are missing log segments, inconsistent filesystem-only copies, untested encryption keys/credentials, retention deleting a required base/log chain, backups stored on the same failure domain and assuming snapshot success equals application-consistent recovery.
Evidence · 1 on this Topic
Expected observations and documentation recipes are reference material. Record actual output, device identity, scope and time before claiming a verified result.
Subtopics
Go one level deeper into this subject.
Logical backups export data as SQL or archive files; physical backups copy the database files and logs.
Subtopic Point-in-Time RecoveryPoint-in-time recovery (PITR) restores a base backup and replays logs up to a chosen moment, for example just before a bad DELETE.
Subtopic Restore TestingA backup is proven only by restoring it and checking the data; restore tests should be scheduled and measured.
Define RPO/RTO first. Keep backups off the server and immutable. A backup is proven only by restoring it.
SELECT database_name,MAX(backup_finish_date) FROM msdb.dbo.backupset GROUP BY database_name;— first check for this topicpsql -c "SELECT now(), version();"— PostgreSQL reachable and versionmysql -e "SELECT NOW(), VERSION();"— MariaDB/MySQL reachable and versionsqlcmd -S <server> -Q "SELECT @@VERSION"— SQL Server reachable and version
ReferenceWhat it is1 section · depth on demand
Operating model
Backup, Restore & Recovery defines how database state is captured and reconstructed. Logical exports, physical/base backups and log/WAL/binlog streams protect different recovery needs. A backup is only operationally useful when its dependencies are retained and a restore has been confirmed against the required RPO/RTO.
ReferenceHow it works1 section · depth on demand
In depth
Backup, restore and recovery protect databases against hardware failure, corruption, human error and ransomware. The goal is not backups but proven recovery within the agreed recovery point objective (RPO) and recovery time objective (RTO).
| Backup type | Characteristics |
|---|---|
| Logical (dump) | Portable SQL/text; slower restore for large databases |
| Physical (file-level, hot) | Fast restore of whole instance; same version/platform |
| Continuous log archiving (WAL, binlog, transaction log) | Point-in-time recovery |
| Storage snapshots | Fast, must be application-consistent |
Recovery practice:
- Test restores regularly into a separate environment and measure time.
- Practise point-in-time recovery to just before a mistaken
DELETE. - Keep copies off-site and immutable; databases are prime ransomware targets.
- Verify backups with checksums and by restoring, not just by job status.
- Back up configuration, users/roles and encryption keys too — a restore without TDE keys fails.
ReferenceImportant terms & boundaries1 section · depth on demand
Scope map
- Logical vs physical backup
- Full/incremental/differential boundaries
- Transaction/WAL/binlog recovery
- Point-in-time recovery
- RPO and RTO
- Restore verification
- Consistency/application-aware backup boundaries
Additional reference context Scope · expected state · examples · history · terminology Open only when you need the supporting context
Configuration & expected output
Concrete examples are shown only when the stored reference contains an actual configuration or output shape for this Topic.
Configuration example
Assumptions: Run the restore test on a separate server or database; never over production.
pg_dump -h db1 -U backup -Fc -f app_$(date +%F).dump app
createdb -h restore1 app_restore_test
pg_restore -h restore1 -d app_restore_test --no-owner app_$(date +%F).dump
psql -h restore1 -d app_restore_test -c "SELECT count(*) FROM orders;"Expected output
pg_restore --list app_2026-10-25.dump | head -5Expected state: The dump file is readable and lists the expected archive header and objects.
;
; Archive created at 2026-10-25 02:00:01 UTC
; dbname: app
; TOC Entries: 214
; Compression: gzipA backup is only proven by a successful restore and a row-count or checksum comparison; a file that exists is not a backup. Illustrative authored output: field layout matches the tool, values will differ in your environment.Verification history & basis
When and against what this Topic was checked. Later text edits do not count as a new check.
Documentation verification: confirms the upstream model used by the Topic. It does not assert local production behavior.
Basis: https://www.postgresql.org/docs/current/backup.html · confidence 92%What changed and what may be affected
Recent technical edits are separated from ordinary page timestamps. Relationship impact is advisory: it identifies nearby canonical references to review, not automatic breakage.
Terms & aliases
Hover a linked term for a quick definition; click it to open its glossary entry. Aliases are other names that find this Topic in search.
Quick lookup tables
Backup, Restore & Recovery verification boundary matrix
A compact lookup separating intent, owning component state, effective state and consumer-visible outcome for Backup, Restore & Recovery.
| Boundary | Inspect | Healthy interpretation | Do not infer |
|---|---|---|---|
| Intent | Logical vs physical backup | Intended object/scope is explicit and versioned where relevant | Intent is already effective |
| Owning runtime/control plane | Full/incremental/differential boundaries / Transaction/WAL/binlog recovery | Owner accepts and reports the expected object state | Downstream dependencies are healthy |
| Effective state | Point-in-time recovery | Independent read-back matches the intended state | Every client sees the same result |
| Consumer outcome | RPO and RTO | The original bounded check succeeds in the same time window | Production correctness outside this scope |
Deep reference
Design & tradeoffs
Scope
Databases owns engine-consistent backup/recovery procedures. Storage owns media/snapshot durability; Automation owns scheduling/orchestration; the recovery evidence belongs to the database outcome.