Table of Contents Previous Next



Either the tar (-F t) or plain text (-F p) backup file format may be used for full backups with the BACKUP subcommand. The plain text (-F p) backup file format must be used for incremental backups.
Transaction log streaming (xlog_method = stream in the BART configuration file) for taking full backups with pg_basebackup can be used as long as the -F p option is specified with the BACKUP subcommand. Thus, transaction log streaming can be used on database clusters containing user-defined tablespaces.
If the particular database cluster you plan to back up contains tablespaces created by the CREATE TABLESPACE command, be sure to set the tablespace_path parameter in the BART configuration file before you perform a BART RESTORE operation.
The tablespace_path parameter specifies the directory paths to which you want the tablespaces to be restored.
The tablespace_path parameter takes the following format:
OID_1=tablespace_path_1;OID_2=tablespace_path_2 ...
OID_1, OID_2, … are the Object Identifiers of the tablespaces. You can find the OIDs of the tablespaces and their corresponding soft links to the directories by listing the contents of the POSTGRES_INSTALL_HOME/data/pg_tblspc subdirectory as shown in the following example:
The OIDs are 16644 and 16645 to directories /mnt/tablespace_1 and /mnt/tablespace_2, respectively. If you later wish to restore the tablespaces to the same locations as indicated in the preceding example, the BART configuration file must contain the following entry:
In either case, the directories specified in the tablespace_path parameter must exist and be empty at the time you perform the BART RESTORE operation.
If the database server is running on a remote host (in other words you are also using the remote_host configuration parameter or will specify the --remote-host option with the RESTORE subcommand), the specified tablespace directories must exist on the specified remote host.
Note: This example emphasizes the steps that are affected by tablespace usage. See Section 5 for the complete process required for backing up and restoring a database cluster.
The BART configuration file contains the following settings. Note that the tablespace_path parameter does not have to be set at this point.
Within the backup subdirectory 1447709811516 of the BART backup catalog, the tablespace data is stored with file names 16587.tar.gz and 16588.tar.gz as shown by the following:
On the remote host, directories /opt/restore_tblspc_1 and /opt/restore_tblspc_2 are created and assigned the proper ownership and permissions as shown by the following. The main database cluster is to be restored to /opt/restore.
Set the tablespace_path parameter in the BART configuration file to specify the tablespace directories.
The symbolic links in the pg_tblspc subdirectory point to the restored directory location:
Queries within psql also show the restored tablespaces:


Table of Contents Previous Next