4.2. Full Restore #
Important
For a full restore, the PGDATA directory must be completely empty. Otherwise, the restore will fail.
To restore the database cluster from a backup, run the restore command with at least the following options:
pg_probackup3 restore -Bbackup_dir--instance=instance_name-ibackup_id
Where:
backup_diris the backup catalog that stores all backup files and meta information.instance_nameis the backup instance for the cluster to be restored.backup_idspecifies the backup to restore the cluster from.
If you restore ARCHIVE backups or perform PITR, pg_probackup3 creates a postgresql.auto.conf configuration file in the target directory that includes the minimal set of parameters required for recovery, with restore_command set to the archive-get command. An empty recovery.signal file is also created in the target directory; it is deleted automatically upon recovery completion.
If you are restoring a STREAM backup, the restore is complete at once, with the cluster returned to a self-consistent state at the point when the backup was taken. For ARCHIVE backups, Postgres Pro replays all available archived WAL segments, so the cluster is restored to the latest state possible within the current timeline. You can change this behavior by using the recovery target options with the restore command, as explained in Section 4.5.
If the cluster to restore contains tablespaces, pg_probackup3 restores them to their original location by default. To restore tablespaces to a different location, use the -T/--tablespace-mapping option. Otherwise, restoring the cluster on the same host will fail if tablespaces are in use, because the backup would have to be written to the same directories.
When using the -T/--tablespace-mapping option, you must provide absolute paths to the old and new tablespace directories. If a path happens to contain an equal sign (=), escape it with a backslash.
To relocate several tablespaces, either use the -T option repeatedly:
pg_probackup3 restore -Bbackup_dir--instance=instance_name-Ddata_dir-j 4 -ibackup_id-Ttablespace1_dir=tablespace1_new_dir-Ttablespace2_dir=tablespace2_new_dir
Or specify a colon-separated list of mapping pairs within the same option:
pg_probackup3 restore -Bbackup_dir--instance=instance_name-Ddata_dir-j 4 -ibackup_id-Ttablespace1_dir=tablespace1_new_dir:tablespace2_dir=tablespace2_new_dir