Restoring PostgreSQL database

This article explains how to restore a PostgreSQL database from a backup.

PostgreSQL database can be restored to its original location or to a new temporary directory.


How to restore PostgreSQL database from backup

The first step in restoring a PostgreSQL database from backup is to restore the database files from storage to a temporary directory. These files will then be imported into the PostgreSQL database environment.

To restore files backed up using a file-level backup plan follow this guide. If your database was backed up using an image-level backup, use granular recovery to restore it as described in this article.

Once the database files are restored, the next step is to import them into the PostgreSQL environment.

1

Log in to your database server using SSH.

2

Enter the following command:

psql dbname < dumpfile.sql
3

The database has been successfully restored

Last updated