How to restore PostgreSQL database from backup?

This article contains information on how to restore the PostgreSQL database from a backup.

How to restore the PostgreSQL database from the backup?

The first thing, you need to do to restore the PostgreSQL database from the backup is to restore the database files from the storage to the temporary directory, from which these will be imported to the PostgreSQL database environment.

Read the following article to get information on how to restore files backed up using a file-level backup plan:

pageFile-level backup recovery

If you backed up your database using the image-level backup, use the granular access to the image-level backup using the following article:

pageGranular Recovery Of Files & Folders - iSCSI Restore

Xopero recommends restoring the database files to the original directory! The reason for this is the possibility of problems with permissions to another location.

The next thing you need to do, when the database files are restored, is to import these files to the PostgreSQL environment. First, log in to your database server via SSH.

Later, type the following command:

psql dbname < dumpfile.sql

The database is not created by this command! If you want to import the database dump file into the non-existing database, you have to create the database first. If you want to restore the dump file to the existing database, you must drop the database first, then create it again and import the dump file.

Last updated