RESTORE v2.6
The RESTORE
subcommand restores a backup and its archived WAL files for the designated database server to the specified directory location.
Syntax for Restore:
To view detailed information about the RESTORE
subcommand, see the EDB Backup and Recovery User Guide available at the EDB website.
If the backup is restored to a different database cluster directory than where the original database cluster resided, then some operations dependent upon the database cluster location may fail. This happens if the supporting service scripts are not updated to reflect the new directory location of restored backup.
For information about the use and modification of service scripts, see the EDB Advanced Server Installation Guide available at the EDB website.
The following table describes the RESTORE
options:
Options | Description |
---|---|
-s <server_name> --server <server_name> | <server_name> is the name of the database server to be restored. |
-p --restore-path <restore_path> --restore-path <restore_path> | <restore_path> is the directory path where the backup of the database server is to be restored. The directory must be empty and have the proper ownership and privileges assigned to it. |
-i { <backup_id> | <backup_name>} --backupid { <backup_id> | <backup_name>} | backup_id is the backup identifier of the backup to be used for the restoration and <backup_name> is the user-defined alphanumeric name for the backup.If the option is omitted, the latest backup is restored by default. |
-r <remote_user@remote_host_address> --remote-host <remote_user@remote_host_address> | <remote_user> is the user account on the remote database server host that accepts a passwordless SSH/SCP login connection and is the owner of the directory where the backup is to be restored.<remote_host_address> is the IP address of the remote host to which the backup is to be restored. This option must be specified if the remote_host parameter for this database server is not set in the BART configuration file.For information about the remote_host parameter, see the EDB Backup and Recovery Installation and Upgrade Guide available at the EDB website. |
-w <number_of_workers> --workers <number_of_workers> | <number_of_workers> is the number of worker processes to run in parallel to stream the modified blocks of an incremental backup to the restore location. If the -w option is omitted, the default is 1 worker process.For example, if four worker processes are specified, four receiver processes on the restore host and four streamer processes on the BART host are used. The output of each streamer process is connected to the input of a receiver process. When the receiver gets to the point where it needs a modified block file, it obtains those modified blocks from its input. With this method, the modified block files are never written to the restore host disk. |
-t <timeline_id> --target-tli <timeline_id> | <timeline_id> is the integer identifier of the timeline to be used for replaying the archived WAL files for point-in-time recovery. |
-x <target_xid> --target-xid <target_xid> | <target_xid> is the integer identifier of the transaction ID that determines the transaction up to and including, which point-in-time recovery encompasses. |
-g <target_timestamp> --target-timestamp <target_timestamp> | <target_timestamp> is the timestamp that determines the point in time up to and including, which point-in-time recovery encompasses. |
-c --copy-wals | Specify this option to copy archived WAL files from the BART backup catalog to <restore_path>/archived_wals directory.The restore_command retrieves the WAL files from <restore_path>/archived_wals for the database server archive recovery.If the -c option is omitted and the copy_wals_during_restore parameter in the BART configuration file is not enabled in a manner applicable to this database server, then the restore_command in the postgresql.conf retrieves the archived WAL files directly from the BART backup catalog.For information about the copy_wals_during_restore parameter, see the EDB Backup and Recovery Installation and Upgrade Guide available at the EDB website. |
--disable-checksum | While restoring a backup, specify this option to skip verifying the MD5 or SHA256 checksum files. If you set the --checksum-algorithm=NONE option with the BART scanner or while taking a backup, you also need to specify the --disable checksum option while restoring an incremental backup. |
Examples
The following code sample restores a database server(named mktg
) to the /opt/restore
directory up to timestamp 2015-12-15 10:47:00
:
The following parameters are set in the postgresql.auto.conf
file:
The following is a list of the restored files and subdirectories:
Example
The following code sample performs a RESTORE
operation with the copy_wals_during_restore
parameter enabled to copy the archived WAL files to the local <restore_path>/archived_wals
directory:
The following parameters are set in the postgresql.auto.conf
file:
The following is a list of the restored files and subdirectories:
The following code sample displays restoring an incremental backup taken using --checksum-algorithm=NONE
option. To restore this incremental backup, you must specify the --disable-checksum
option to skip verifying MD5 or SHA256 checksum files.