How do I restore my data?

Assuming you have created a backup file using, you can restore your database using the command:

 $ pg_restore [options] your_backup.bak

It should be pointed out that it's not possible to restore a backup to a database with a different name than the one you made the backup from!

If the database to restore into doesn't exist: replace [options] with -C new_database.
If you want to restore replacing an existing database: replace [options] with --clean -C new_database.

Note: You need to restore the roles backup before restoring the data backup.

FAQ Category: