The database restore with no rows
A PostgreSQL dump restores without errors, but the recovered database is empty. Investigate the archive and verify a complete restore.

The scenario
A synthetic orders database has a dump that restores successfully into a scratch database. The tables exist, but the rows are missing. Investigate the archive and produce a complete, independently restorable backup without changing the source.
Mission objectives
- Compare the source and scratch databases and inspect the dump contents.
- Create a full logical archive and restore it into the scratch database.
- Verify the original data and independently restore the new archive.
Lab README
The database restore with no rows
A PostgreSQL archive restored successfully into a scratch database, but the orders table has no rows. Investigate what the archive contains, then create and test a complete logical backup without changing the original database.
Before you begin
Use Docker with Compose, Python 3 and Bash on a disposable machine. The first run may download the PostgreSQL 17 image. The lab uses synthetic data, an internal Docker network and a named lab volume; it publishes no host ports. Authentication is deliberately insecure. Never use these settings or project name for real workloads. Other containers or users with Docker daemon access may access the lab database.
The project name breakfix-dbops-02 is reserved for this lab. Setup refuses to
reuse existing project resources. Teardown verifies container ownership before
removing the project's containers, network and database volume.
Investigate
Run ./setup.sh, then open a shell in the database container:
docker compose -p breakfix-dbops-02 exec db sh
The source database is lab, the scratch database is recovery, and the
initial archive is /tmp/partial.dump. Connect with psql -U lab_admin.
Compare the orders table in both databases and inspect the archive with
pg_restore -l /tmp/partial.dump.
Create a complete PostgreSQL custom-format archive at /tmp/full.dump. Restore
it into the separate recovery database, not over lab. Preserve the source
and its data. Exit the container shell, run ./verify.sh, then run
./teardown.sh. Verification also restores the new archive into its own
temporary database and checks its contents; teardown deletes the lab data.
The related restore guide and demo discuss checking restored data. Its video demonstrates a file restore, not this PostgreSQL exercise; the guide notes that its database commands were not run.
Get the lab
Download and inspect the installer before running it. It checks the archive's SHA-256 digest and refuses to overwrite an existing lab directory.
curl -fsSLO https://devops.download/labs/dbops-02-postgres-empty-restore.sh less dbops-02-postgres-empty-restore.sh
bash dbops-02-postgres-empty-restore.sh
cd labs/dbops-02-postgres-empty-restore
./setup.shWhen you've made your changes, run ./verify.sh. Remove lab resources with ./teardown.sh.
Need a nudge?
Hint #1
A successful restore and an existing table do not prove that the archive contains table data.
Hint #2
Inspect the archive's table of contents with pg_restore -l and compare it with a complete logical dump.
Hint #3 · Related guide on opsbreakfix.com
Solved it?
Explore the related guide on opsbreakfix.com.
Continue to opsbreakfix.com ↗