Using Tablespaces v2.6
If the database cluster contains user-defined tablespaces (that is, tablespaces created with the CREATE TABLESPACE
command):
- You can take full backups with the
BACKUP
subcommand in either tar (-Ft
) or plain text (-Fp
) backup file format. - You must take incremental backups in the plain text (
-Fp
) backup file format. - You can take full backups using the transaction log streaming method (xlog_method = stream in the BART configuration file)
--with-pg_basebackup
and theBACKUP
subcommand in either tar (-Ft
) or plain text (-Fp
) backup file format.
Note
If the particular database cluster you plan to back up contains tablespaces created by the CREATE TABLESPACE
command, then you must 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. It takes the following format:
OID_1=tablespace_path_1;OID_2=tablespace_path_2 ...
Where 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:
If you later wish to restore the tablespaces to different locations, specify the new directory locations in the tablespace_path
parameter.
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.
To view example of backing up and restoring a database cluster on a remote host containing tablespaces, see the EDB Backup and Recovery Reference Guide available at the EDB website.
The directories must be owned by the user account with which you intend to start the database server (typically the Postgres user account) with no access by other users or groups as is required for the directory path to which the main full backup is to be restored.
To view a sample BART managed backup and recovery system consisting of both local and remote database servers, see the EDB Backup and Recovery Reference Guide available at the EDB website.