Skip to main content

Restore PostgreSQL databases backups using AhsayOBM

Article ID

20004

Description

Ahsay streamlines PostgreSQL database recovery through automated processes. Through AhsayOBM, database files are quickly restored from the backup and are applied to the PostgreSQL instance, either on the original server or a remote standby server within the same LAN. For administrators seeking more control, the “Restore Raw File” option allows the files to be restored to a local disk. The administrator then manually creates the databases and imports them into the PostgreSQL instance, either on the original server or by transferring the files to a standby or remote server.

Please use the following steps and tips to make PostgreSQL database recovery quick and reliable using AhsayOBM.

  1. Before running the restore job, connect to the PostgreSQL server using Command Prompt.
  2. Verify that the database instance is running: \l.
  3. After verifying, open and login to AhsayOBM.
  4. From the AhsayOBM home screen, click Restore.
  5. Select the backup set containing the database/s you want to restore.
  6. Select a destination where to restore your database from.
  7. Check the temporary directory and configure if needed.
  8. Click Next.
    • Recover deleted/existing databases to the original machine

  9. Select what to restore: Choose from files as of job
    • Default selection shows the latest version. You may select a specific version by clicking the menus next to it.
  10. Select the databases you aim to recover.
  11. Click Next.
  12. When restoring to the original machine, the host, port, username, and password do not have to be modified. Click Next.
  13. A warning sign on a new database's name indicates that an existing database has a similar name and may be overwritten after the restore job. Change the name of the database if you want to clone an existing database to compare information.
  14. Click Restore.
  15. Verify if the databases have been recovered through the PostgreSQL Command Line client. Use the command show databases;.
  • Recover files to an alternate/standby machine within the same LAN

  1. Before running the restore job, connect to the PostgreSQL server using Command Prompt on the alternate/standby machine.
  2. Verify that the database instance is running: \l.
  3. After verifying, go back to the original machine. From the Restore page of AhsayOBM, select what to restore. You may select a previous version or keep the default selection which is the latest version.
  4. Select databases to recover.
  5. Click Next.
  6. For host, enter the IP address of the alternate/standby machine. Then modify the port, username, and password, if required.
  7. Click Next.
  8. Specify a new name for the databases, if preferred.
  9. Click Restore.
  10. To verify if the databases have been recovered, connect to the PostgreSQL server using Command Prompt on the alternate/standby machine and check the databases: \l.
  • Recover databases manually

  1. Before running the restore job, connect to the PostgreSQL server using Command Prompt.
  2. Verify that the database instance is running: \l.
  3. After verifying, from the Restore page of AhsayOBM, select what to restore. You may select a previous version or keep the default selection which is the latest version.
  4. Select databases to recover.
  5. Enable Restore raw file.
  6. Click Next.
  7. Click Browse and select a local destination. Click OK.
  8. Click Restore.
  9. To verify if the databases have been recovered:
    1. Check the Restore Report to confirm if the selected databases have been restored to the selected destination.
    2. Open the selected destination to check if the selected databases have been recovered.
  10. Connect to the PostgreSQL server using Command Prompt. Use the command \l to show databases.
  11. To manually create and import the databases into the PostgreSQL server, use the following commands:
    1. create database [name of the database];
    2. \c [name of the database]
    3. \i [letterdrive:\folder\subfolder\filename]
    4. Check the queries and make sure no error exists.
    5. To see the informaton of the database:
      1. Use \dt or \dt+ to show tables.
      2. You may check the information of a table by using select * from [name of the table]
      3. You may count the rows of a table by using select count(*) from [name of the table]