NetBackup™ for PostgreSQL Administrator's Guide
- Introduction to NetBackup for PostgreSQL
- Configuring NetBackup for PostgreSQL
- NetBackup for PostgreSQL backup and restore
- About PostgreSQL backups
- Performing PostgreSQL backups
- Validating the PostgreSQL backups
- Querying the PostgreSQL backups
- Deleting backup information from the NetBackup catalog files
- About PostgreSQL restore
- Performing the PostgreSQL restores
- Redirected restores
- Recovering the restores
- Disaster recovery
- Troubleshooting for PostgreSQL
- Appendix A. NetBackup for PostgreSQL commands and conventions
- Appendix B. NetBackup for PostgreSQL commands
- Index
Recovering the restores
Select a recovery workflow based on the version of PostgreSQL you are using. If you are using PostgreSQL version 12 or later, go directly to the section Recovering for PostgreSQL version 12 or later .
After a successful restore, to recover the restore, copy the recovery.conf.sample file to the PostgreSQLdata directory. The recovery.conf.sample is available at the PostgreSQL install path. Ensure that after you copy the recovery file, remove the .sample extension.
When you set the parameters and restart the PostgreSQL services, the server goes into the recovery mode and reads the archived WAL files. If the recovery gets terminated, you can restart the server to continue the recovery process.
After successful completion, the server renames the recovery.conf file to recovery.done to prevent re-entering into the recovery mode.
In Linux operating system, the owner and the group defaults to postgres after a successful restore. You must change the ownership to PostgreSQL owner and modify the settings according to your environment.
The recovery.conf file contains the parameters that you must set to enable archive recovery or act as a replication standby. The parameters must be set again for the subsequent recovery that you must perform.
Table: The recovery.conf file parameters lists the parameters that you must set to enable archive recovery.
Table: The recovery.conf file parameters
Parameters | Description |
|---|---|
restore_command | This parameter specifies the shell command that is run to copy log files back from archival storage. This parameter is required for archival storage but is optional for streaming replication. The command string may contain %f that is replaced by the name of the desired log file and %p is replaced by the absolute path to copy the log file to. |
recovery_target | This parameter stops the roll-forward at a specific point. By default, the recovery rolls forward to the end of the WAL log. |
To recover the restore
- Stop the PostgreSQL services.
- Copy the restore data into the PostgreSQL data directory.
- (Linux) Change the ownership to PostgreSQL user.
- Copy the
recovery.conffile to the PostgreSQL data directory and remove the.sampleextension. - (Linux) Change the ownership to the PostgreSQL user and modify the settings according to your environment.
- Edit the
recovery.conffile to set the following:(Windows) Mention the restore_command parameter as cp "<PostgreSQL-data-directory>\\pgarchive\\%f" "%p"
(Linux) Mention the restore_command as cp <PostgreSQL-data-directory>/pgarchive/%f %p
Remove the pause_recovery_target parameter.
- Start the PostgreSQL services.
- After successful recovery, delete the
pgarchivedirectory and therecovery.donefile.
If you are using PostgreSQL version 12 or a higher version, perform the following steps.
To recover the restore
- Stop the PostgreSQL services.
- Copy the restore data into the PostgreSQL data directory.
- (Linux) Change the ownership to PostgreSQL user.
- (Windows) Mention the restore_command parameter as cp "<PostgreSQL-data-directory>\\pgarchive\\%f" "%p"
- (Linux) Mention the restore_command as cp <PostgreSQL-data-directory>/pgarchive/%f %p
- Create an empty file named
recovery.signalin the PostgreSQL data directory. For example, # touch /<target_restored_directory>/recovery.signal - (Linux) Change ownership of the recovery.signal file to the PostgreSQL user. For example: chown postgres:postgres /<PostgreSQL-data-directory>/recovery.signal
- Start the PostgreSQL services.