Steps To Restore PostgreSQL

You might also like

Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 3

List of steps to Restore PostgreSQL Backup

1. Identify list of files to be restored from sharepoint (Telecoms Access Review - On Virtual
Machine - All Documents (sharepoint.com))

2. In our scenario, following files will be qualified for restore.

3. Download these files on VM (tested with following config) and unzip using 7zip application.
 OS: Windows 2022
 SKU: Standard B4s v2
 Disk: 256 HDD
 RG: OFCOM-BTN-AZMG-RG

4. After unzipping, following red highlighted sql files will be generated (used for restoring db).

5. Download Community DL Page (enterprisedb.com)


 Step 1: Download PostgreSQL (postgresql-16.1-1-windows-x64) in C:\software dir.
 Step 2: Begin Installation
 Step 3: Select Components
 Step 4: Choose Installation Data Directory
 Step 5: Set a Password
 Step 6: Set the Port Number
 Step 7: Choose the Locale
 Step 8: Install
Note - Please don't install any extension while installing PostgreSQL from StackBuilder.

6. Now go to https://download.osgeo.org/postgis/windows/pg16/archive/

7. Then download postgis-bundle-pg16x64-setup-3.4.0-1 and install.


Note - postgis 3.4.1 doesn't work with PostgreSQL 16
8. Launch pgAdmin from start menu & verify that postgis extension installed successfully.

9. We can also try to create temp table with geometry datatype, and it should be successful.
10. Go to path - C:\Program Files\PostgreSQL\16\bin
Note – We will get .ddl not found error (if below command gets executed from other
directory)

11. Run restore command (enter password once prompted)


Note – Password is created during creation of database.

C:\Program Files\PostgreSQL\16\bin>"C:\Program Files\PostgreSQL\16\pgAdmin 4\runtime\


pg_restore.exe" --host "localhost" --port "5432" --username "postgres" --role "postgres" --
dbname "postgres" --section=pre-data --section=data --section=post-data --no-owner --no-
privileges --no-tablespaces --verbose "C:\PostgressDB\Download\P-HPC-
32CORE01_ar_2021_backup_2021_03_18.sql"

12. Restore Process should not throw any error.

13. Below are logs from above command while restoring PostgreSQL.

14. Data Validation in PostgreSQL tables after restore.

You might also like