Ransomware attackers specifically target and attempt to destroy backup systems to increase the probability of payment. Hardening your system is critical. Please ensure you have reviewed your platform security using the Security Hardening Checklist
Cohesity

COHESITY Documentation

Explore our documentation to get started, discover products & new features, access troubleshooting guides, register sources, platforms support.

Products
Data Security Alliance
Visit Cohesity.com
Demos
Support
Blogs
Developers
Partner Portals
Cohesity Community
© 2026 Cohesity, Inc. All Rights Reserved.
Terms of Use|
Privacy Policy|
Legal|
  1. Home
  2. NetBackup™ for PostgreSQL Administrator's Guide
  3. Restoring PostgreSQL Instances and Databases
  4. Steps to perform recovery after restore operation
NetBackup™ for PostgreSQL Administrator's Guide

Steps to perform recovery after restore operation

The procedure to perform post-recovery is as follows for various platforms:

For Windows (VSS):

  1. Go to Control Panel > System and Security > Administrative Tools > Services.
  2. Select PostgreSQL service and stop it.
  3. Delete or move everything from the PostgreSQL data directory.

    Note:

    Post restores, change the attributes of the restored data directory and files by using the following command:

    attrib -S restore_path/*.* /S /D

  4. Copy all the contents of the restored data directory to PostgreSQL data directory.
  5. Edit the postgresql.conf file from the PostgreSQL data directory and edit the restore_command parameter as restore_command = 'copy "restored_WAL_directory\\%f" "%p"'.

    For precise point-in-time recovery, specify the timestamp up to which recovery is performed. Update the recovery_target_time parameter as recovery_target_time = 'yyyy-mm-dd hh:mm:ss'

  6. Create an empty file in the data directory and name it recovery.signal.
  7. Start PostgreSQL service.

For Linux (LVM):

  1. Stop PostgreSQL services.
  2. Delete or move everything from the PostgreSQL data directory.
  3. Extract and copy the data directory and WAL directory contents to respective location.
  4. Create an empty file with name recovery.signal in data directory.
  5. Edit the postgresql.conf file from the PostgreSQL data directory and edit the restore_command parameter as restore_command = 'copy "restored_WAL_directory\\%f" "%p"'.

    For precise point-in-time recovery, specify the timestamp up to which recovery is performed. Update the recovery_target_time parameter as recovery_target_time = 'yyyy-mm-dd hh:mm:ss'

  6. Change ownership of PostgreSQL data directory and permission to 700.

    For example:

    chown -R postgres:postgres /full/path/of/PostgreSQL/Data/Dir

    chmod - R 700 /full/path/of/PostgreSQL/Data/Dir

  7. Start PostgreSQL service.

Recovery steps for backup done by pg_basebackup utility

  1. Stop PostgreSQL services.
  2. Delete or move everything from the PostgreSQL data directory.
  3. Extract and copy the data directory and WAL directory contents to respective location.
  4. Create an empty file with name recovery.signal in data directory.
  5. Edit the postgresql.conf file from the PostgreSQL data directory and edit the restore_command parameter as restore_command = 'copy "restored_WAL_directory\\%f" "%p"'.

    For precise point-in-time recovery, specify the timestamp up to which recovery is performed. Update the recovery_target_time parameter as recovery_target_time = 'yyyy-mm-dd hh:mm:ss'

  6. (For Windows) Provide access to data directory for network service.
  7. (For Linux) Change ownership of PostgreSQL data directory and permission to 700.

    For example:

    chown -R postgres:postgres /full/path/of/PostgreSQL/Data/Dir
    chmod  - R 700 /full/path/of/PostgreSQL/Data/Dir
    
  8. Start PostgreSQL service.

    Note:

    Remove the restore data from the restored path /full/path/of/restore/directory after successful recovery, else the next backup job may fail.

Recovery steps for backup using pgbackrest utility

  1. Stop the PostgreSQL service.
  2. Delete or move everything from PostgreSQL data directory.
  3. Perform the restore operation using pgbackrest utility using the following command:

    pgbackrest --stanza=<stanza_name> --pg1-path=<data_directory_path> --repo1-path=<restore_path>

    Note:

    The stanza name can be identified by examining the backup directory within the restore path. This directory contains a subdirectory named after the stanza, which holds the associated backup sets.

    For precise point-in-time recovery, specify the timestamp up to which recovery is performed with the help of --target option.

    For example:

    pgbackrest --stanza=<stanza_name> --pg1-path=<data_directory_path> --repo1-path=<restore_path> --type=time --target="yyyy-mm-dd hh:mm:ss+00"

    Note:

    Ensure that the time is GMT format.

    To optimize restore performance, use the --process-max option to define the number of parallel processes (1 - 999) for copying data files concurrently.

    For example:

    pgbackrest --stanza=<stanza_name> --pg1-path=<data_directory_path> --repo1-path=<restore_path> --process-max=5
  4. Change the ownership of PostgreSQL data directory and set the permission to 700.

    For example:

    chown -R postgres:postgres /full/path/of/PostgreSQL/Data/Dir
    chmod -R 700 /full/path/of/PostgreSQL/Data/Dir
    
  5. Start PostgreSQL service.
Database recovery steps for backup done by pg_dumpall utility
  • For Windows: psql.exe -h localhost -p port_num -U username -f full\path\to\dumpall\file\filename.out

  • For Linux: psql -h localhost -p port_num -U username -f full/path/to/dumpall/file/filename.out

Database recovery steps for backup done by pgdump utility
  • For Windows: pg_restore -U username -d dbname full\path\to\dump\file\filename.dump

  • For Linux: pg_restore -U username -d dbname full/path/of/dump/file/filename.dump

Feedback

Was this page helpful?
Previous

Pre-restore checks for PostgreSQL

Next

Steps to perform after Restore and Recovery for PostgreSQL cluster deployment

Feedback

Was this page helpful?