Restore a PostgreSQL dump
high risk
pg_restore -l <dump>Inspect the contentscreatedb restore_test && pg_restore -d restore_test <dump>Test restore elsewhereRestores archives created by pg_dump -Fc.
| Flag | Meaning |
|---|---|
-d | Target database |
--clean --clean | Drop objects before recreating⚠ Deletes existing objects. |
--no-owner --no-owner | Skip ownership |
-j | Parallel |
pg_restore -d newdb mydb.dumpRestore into a new database · explain & risk-check →pg_restore --list mydb.dumpList contents · explain & risk-check →Reference text is hand-written and may be incomplete — check man pg_restore for your version. Test destructive commands on a non-production system first.