Recovery of a complete database server, including all of its databases, is an important feature. This recipe covers how to execute a recovery in the simplest way possible.
Some complexities are discussed here, though most are covered in later recipes.
Find a suitable server on which to perform the restore.
Before you recover onto a live server, always make another backup. Whatever problem you thought you had could get worse if you aren't prepared.
Here, we'll provide four distinct examples, depending on what type of backup was taken.
- Restoring of all databases means simply restoring each individual database from each dump you took. Confirm that you have the correct backup before you restore:
pg_restore --schema-only -v dumpfile | head | grep Started
- Reload the global objects from the script file, as follows:
psql -f myglobals.sql
- Reload all databases. Create the databases...