🖨 Print this page

The 8-Step Database Disaster Checklist

Run these in order. The first three stop the bleeding — do them before you google anything.

1

Stop all writes — now

Pause your app, workers and cron jobs. Every write after the incident overwrites data you might still recover. systemctl stop app or scale to zero.

2

Disconnect the thing that did it

AI agent, migration script, console session — kill its connection before it "helpfully" retries. Revoke its credentials if you're not sure.

3

Snapshot the damaged state

Counter-intuitive but critical: dump what's LEFT before any repair attempt. Failed repairs make things worse. pg_dump dbname > damaged.sql

4

Write down the exact time

Point-in-time recovery needs the minute it happened. Check your app logs for the last good request if you're unsure.

5

List your recovery options — oldest data wins

Managed host PITR (Supabase/Neon/RDS), your own backups, replicas, local snapshots, even yesterday's staging copy. Don't start with the first idea — start with the most complete one.

6

Restore to a NEW database first

Never restore over production. Restore side-by-side, verify the data is good, then switch. createdb restore_check && psql restore_check < backup.sql

7

Diff before you switch

Compare row counts of your critical tables between damaged and restored. You want to know what the restore loses (data written after the backup) before you commit to it.

8

Write the 3-line post-mortem

What happened, what saved you (or didn't), what changes today. If the answer to "what saved you" was luck — fix that while the pain is fresh.

If you have no backup at all: stop here and check your host's dashboard anyway — Supabase, Neon, Railway and RDS often have automatic backups you never configured. Many "no backup" disasters end with finding one.

Step 0 for next time: make this checklist useless

OopsDB snapshots your database every 5 minutes, encrypted, locally — restore in one command. Free CLI, works with Postgres, Supabase, MySQL and SQLite.

npx oopsdb init →