Architecture · By Rivtor · Updated
Rehearse a PostgreSQL backup and restore before an incident
A useful backup must restore into a suitable database and support the application’s recovery requirements. Run a drill on disposable resources, verify schema, records, sequences and representative queries, and record elapsed time without touching the live source.
See the Rivtor deployment workflow →
Define what recovery must preserve
Record the acceptable data-loss window and recovery time for the application. A logical dump, snapshot and point-in-time recovery have different capabilities. Choose the backup mechanism that matches the requirement and verify the host’s current retention and access contract.
Inventory extensions, roles, ownership and external objects. A database backup does not contain files stored in an object bucket or the configuration of an external identity provider. The recovery checklist must include those dependencies separately.
Use an isolated restore target
For an illustrative custom-format dump already obtained through an authorized process, inspect its contents before a rehearsal:
pg_restore --list rehearsal.dump
This lists archive entries; it does not restore data. A real restore changes the selected destination. Use a new disposable database, verify its identity and privileges, and choose flags deliberately. Do not add destructive clean options to a general diagnostic command.
Rivtor documents database export and recovery interfaces. Confirm the supported route for operator access and import rather than assuming a private application URL is reachable from your computer.
Verify more than a successful exit code
| Check | Evidence |
|---|---|
| Schema | Expected tables, indexes and constraints |
| Data | Counts and known synthetic or sanitized records |
| Sequences | A new insert gets a valid unused identifier |
| Application | Representative read/write journey |
| Recovery timing | Start, completion and validation times |
Use the PostgreSQL tools appropriate to the source version. A dump can fail to restore because an extension or privilege is unavailable even when its file is readable.
Record the recovery boundary
Document which revision and backup were restored, what was checked and what was excluded. Keep backup files protected because they can contain private data and credentials stored by the application. Delete disposable resources according to the agreed retention process.
Repeat the drill after a meaningful schema or platform change. Do not claim recovery is proven merely because scheduled backups are enabled or a dump file exists; the evidence is the restored application state and the measured procedure.