Table of Contents Previous Next



5.4.3 BACKUP
The BACKUP subcommand is used to create a full backup or an incremental backup.
bart BACKUP –s { server_name | all } [ -F { p | t } ]
[ -z ] [ –c compression_level ]
[ --parent { backup_id | backup_name } ]
[ --backup-name backup_name ]
[ --thread-count number_of_threads ]
The backup is saved in the directory formed by backup_path/server_name/backup_id where backup_path is the value assigned to the backup_path parameter in the BART configuration file, server_name is the lowercase name of the database server as listed in the configuration file, and backup_id is an integer, backup identifier assigned by BART to the particular backup.
While a BACKUP subcommand is in progress, no other processes are allowed to access or interfere with the affected backups. Therefore any of the following subcommands issued while a backup is in progress will skip and ignore those affected backups – INIT, SHOW-BACKUPS, VERIFY-CHKSUM, MANAGE, and DELETE.
Note: Although this capability to check and warn if there is not enough disk space available before copying backup files is provided with the BACKUP subcommand, the RESTORE subcommand does not have this same capability. Thus, it is possible that the RESTORE subcommand may result in an error while copying files if there is not enough disk space available.
In the postgresql.conf file, be sure the wal_keep_segments configuration parameter is set to a sufficiently large value, otherwise you may encounter the following error during usage of the BACKUP subcommand:
A low setting of the wal_keep_segments configuration parameter may result in the deletion of some WAL files before the BART BACKUP subcommand has had a chance to save them to the BART backup catalog.
For information about the wal_keep_segments parameter, see the PostgreSQL Core Documentation available at:
If in the BART configuration file, parameter setting xlog_method=stream applies to a given database server, streaming of the transaction log in parallel with creation of the backup is performed for that database server, otherwise the transaction log files are collected upon completion of the backup. See Section 4.1 for global setting of xlog_method. See Section 4.2.5 for setting of xlog_method by database server.
Note: If the transaction log streaming method is used, the -F p option for a plain text backup format must be specified with the BACKUP subcommand.
-s, --server { server_name | all }
server_name is the name of the database server to be backed up as specified in the BART configuration file. If all is specified, all servers are backed up. Note: If all is specified, and a connection to a database server listed in the BART configuration file cannot be opened, the backup for that database server is skipped, but the backup operation continues for the other database servers. The following error message is displayed when a database server connection fails:
-F, --format { p | t }
Specifies the backup file format. Use p for plain text or t for tar. If the option is omitted, the default is tar format. Note: For taking incremental backups, the -F p option must be specified.
-z, --gzip
-c, --compress-level compression_level
Specifies the gzip compression level on the tar file output. compression_level is a digit from 1 through 9, inclusive, with 9 being the best compression. This option is applicable only for the tar format.
--parent { backup_id | backup_name }
backup_id is the integer, backup identifier of a parent backup. backup_name is the user-defined alphanumeric name of a parent backup. Specify this option to take an incremental backup. The parent is a backup taken prior to the incremental backup currently being invoked. The parent backup can be either a full backup or an incremental backup. The –F p option must be specified as well since an incremental backup can only be taken in plain text format. Note: An incremental backup cannot be taken on a standby database server. See Section 2.1 for additional information on incremental backups.
--backup-name backup_name
User-defined, friendly name to be assigned to the backup. This is an alphanumeric string that may include the following variables to be substituted by the timestamp values when the backup is taken: 1) %year – 4-digit year, 2) %month – 2-digit month, 3) %day – 2-digit day, 4) %hour – 2-digit hour, 5) %minute – 2-digit minute, and 6) %second – 2-digit second. To include the percent sign (%) as a character in the backup name, specify %% in the alphanumeric string. Enclose the string in single quotes (') or double quotes (") if it contains space characters. Use of space characters, however, then requires enclosing the backup name in quotes when referenced with the -i option by other subcommands. The maximum permitted length of backup names is 49 characters.
This option overrides the backup_name parameter in the server section of the BART configuration file. If the --backup-name option is not specified, and the backup_name parameter is not set for this database server in the BART configuration file, then the backup can only be referenced in other BART subcommands by the BART assigned, integer backup identifier.
--thread-count number_of_threads
If the --thread-count option is specified, number_of_threads is the number of worker threads to run in parallel to copy blocks for a backup.
Note: If parallel backup is run with N number of worker threads, then it will initiate N+ 1 concurrent connections with the server.
If the --thread-count option is omitted, then the thread_count parameter in the BART configuration file applicable to this database server is used. If thread_count is not enabled for this database server, then the thread_count setting in the global section of the BART configuration file is used. If this is not set as well, the default number of threads is 1. See sections 4.1 and 4.2.5 for information on the thread_count parameter.
Specifies that pg_basebackup is to be used to take a full backup. The number of thread counts in effect is ignored as given by the thread_count parameter in the BART configuration file (see sections 4.1 and 4.2.5). Note: When taking a full backup, if the thread count in effect is greater than 1, then the pg_basebackup utility is not used to take the full backup (parallel worker threads are used) unless the --with-pg_basebackup option is specified with the BACKUP subcommand.
Specifies that pg_basebackup is not to be used to take a full backup. Note: When taking a full backup, if the thread count in effect is only 1, then the pg_basebackup utility is used to take the full backup unless the --no-pg_basebackup option is specified with the BACKUP subcommand.
Note that the -F p option must be specified with the BACKUP subcommand when streaming is used.
The following shows an incremental backup taken by specifying the --parent option. The -F p option must be specified as well for plain text format.


Table of Contents Previous Next