Backup and Restore a PostgreSQL Database

PostgreSQL is a open source object-relational database. We received many request from our clients asked us how to backup and restore a PostgreSQL database. Below are the steps to perform backup and restore of a PostgreSQL database with two simple steps.

 

Step 1: Backup the Database

Follow the steps below to backup the database:

  • Open pgAdmin. Navigate to Databases and expand it.

  • Right-click the desired database, and click Backup.

Backup database option

  • For Filename, use the browse button to specify the location to store the backup file and give a name (<filename>.backup).
  • Next, for Encoding, select UTF8.
  • For Role name, select postgres.
  • Click Backup to start the backup process.

 

Step 2: Restore the Database

Follow the steps below to restore the database:

  • In pgAdmin. Select Databases.
  • Right-click Databases, select Create and select Database.

creating a new database

  • Provide a name for the database and click Save.
  • The newly created database will appear in the database list in the left pane.

database list

  • Right-click on the new database, select Restore.

restore option

  • For Filename, use the browse button to locate the backup file.
  • Next, for Role name, select postgres.
  • Click Restore to start the restoration process.

 

Below are some useful post related to PostgreSQL:

  1. Create PostgreSQL Database for SCADA
  2. Setup PostgreSQL Database for SCADA