Restore Postgres Database on Windows

Exported on 17-Nov-2021 21:43:25

Restore Postgres Databases With AttuneOps on Windows

This Blueprint Restores A Backup For Specified MongoDB Database on Windows

Postgres is a relational database Management system. This blueprint takes the following parameter to restore the Postgres backup file.

  • postgresConnectionUri: Postgres Connection URI, example: mongo://username@host:port/database
  • postgresBackupDestination: MongoDB Database backup file destination, should be a file path.
Pre-Blueprint Attune setup
  1. On the Inputs tab, create a Windows node for the host you wish to install the stack on.
  2. On the Inputs tab, create Windows credentials to connect to the host you wish to install the stack on.
Steps Involved
  • Restore Postgres Backup

Parameters

Name Type Script Reference Default Value Comment
Postgres Backup Destination Text postgresBackupDestination
Postgres Bin Directory Text postgresBinDirectory
Postgres Connection URI Text postgresConnectionUri
Windows Credential Windows OS Credential windowsCredential
Windows Node Windows Server windowsNode

1 - Restore Postgres

This step has the following parameters

Name Script Reference Default Value
Postgres Connection URI {postgresConnectionUri} None
Postgres Bin Directory {postgresBinDirectory} None
Postgres Backup Destination {postgresBackupDestination} None
The connection details have changed from the last step.

Login as user on node

  1. Connect via RDP
    mstsc /admin /v:Windows Node
  2. Login as user {Windows Credential}
  3. Then open a command prompt
This is a PowerShell Script make sure you run it with powershell.exe Click start menu, enter "powershell" in the search bar, then select the powersehll program
# Restore Postgres Backup in the specified Postgres Server
cd "{postgresBinDirectory}"
.\psql.exe   {postgresConnectionUri} < "{postgresBackupDestination}"