Backing up WarehousePG with gpbackup
and gprestore
gpbackup and gprestore are WarehousePG utilities that create and restore backup sets in parallel for WarehousePG. By default, gpbackup
stores only the object metadata files and DDL files for a backup in the WarehousePG Coordinator data directory. WarehousePG segments use the COPY ... ON SEGMENT
command to store their data for backed-up tables in compressed CSV data files, located in each segment’s backups directory.
Parallel Backup with gpbackup and gprestore
The backup metadata files contain all of the information that gprestore
needs to restore a full backup set in parallel. Backup metadata also provides the framework for restoring only individual objects in the data set, along with any dependent objects, in future versions of gprestore
. (See Understanding Backup Files for more information.) Storing the table data in CSV files also provides opportunities for using other restore utilities, such as gpload, to load the data either in the same cluster or another cluster. By default, one file is created for each table on the segment. You can specify the --leaf-partition-data
option with gpbackup
to create one data file per leaf partition of a partitioned table, instead of a single file. This option also enables you to filter backup sets by leaf partitions.
Each gpbackup
task uses a single transaction in WarehousePG. During this transaction, metadata is backed up on the Coordinator host, and data for each table on each segment host is written to CSV backup files using COPY ... ON SEGMENT commands in parallel. The backup process acquires an ACCESS SHARE lock on each table that is backed up.
For additional documenation, visit the gpbackup and gprestore cluster utilities reference page.
Objects in a backup set
Objects Included in a Backup or Restore The following table lists the objects that are backed up and restored with gpbackup
and gprestore
.
Database objects are backed up for the database you specify with the --dbname
option.
Global objects (WarehousePG Cluster objects) are also backed up by default, but they are restored only if you include the --with-globals option
when calling gprestore
. Conversely, the gpbackup --without-globals
will skip the backup of global objects
Objects that are backed up and restored
Database objects | |
---|---|
Aggregates | Readable External Tables 1 |
Casts | Rules |
Comments | Schemas 4 |
Conversions | Sequences |
Domains | Session-level configuration parameter settings (GUCs) |
Extensions | Table statistics 2 |
Functions | Tables |
Indexes | Text search parsers, dictionaries, templates, and configurations |
Materialized Views 1 | Triggers 3 |
Operators, operator families, and operator classes | Types |
Owners | Views |
Procedural language extensions | Writable External Tables 1 |
Protocols |
1. DDL Only
2. when --with-stats
flag is used
3. While WarehousePG does not support triggers, trigger definitions present in the database are backed up and restored
4. The following schemas are not part of the backup set: gp_toolkit, information_schema, pg_aoseg, pg_bitmapindex, pg_catalog, pg_toast*, pg_temp*
Global objects | _ |
---|---|
Databases | Resource queue definitions |
Database-wide configuration parameter settings (GUCs) | Roles |
GRANT assignments of roles to databases | Tablespaces |
Resource group definitions |
When restoring to an existing database, gprestore
assumes the public schema exists when restoring objects to the public schema. When restoring to a new database (with the --create-db option), gprestore
creates the public schema automatically when creating a database with the CREATE DATABASE command. The command uses the template0 database that contains the public schema.
Backup and Restore Workflow
Full Backup
This command will take a full backup (metadata and user data) using zstandard compression
$ gpbackup --dbname <database_name> --compression-type zstd
Example:
[gpadmin@whpg_cdw ~]$ gpbackup --dbname ww_sales --compression-type zstd
20250514:20:27:13 gpbackup:gpadmin:whpg_cdw:027069-[INFO]:-gpbackup version = 1.30.5
20250514:20:27:13 gpbackup:gpadmin:whpg_cdw:027069-[INFO]:-Greenplum Database Version = 6.27.1 build commit:ab5a612bfdc355ad2d601860dfb70a47778c8dd7
20250514:20:27:13 gpbackup:gpadmin:whpg_cdw:027069-[INFO]:-Starting backup of database ww_sales
20250514:20:27:14 gpbackup:gpadmin:whpg_cdw:027069-[INFO]:-Backup Timestamp = 20250514202713
20250514:20:27:14 gpbackup:gpadmin:whpg_cdw:027069-[INFO]:-Backup Database = ww_sales
20250514:20:27:14 gpbackup:gpadmin:whpg_cdw:027069-[INFO]:-Gathering table state information
20250514:20:27:14 gpbackup:gpadmin:whpg_cdw:027069-[INFO]:-Acquiring ACCESS SHARE locks on tables
Locks acquired: 57 / 57 [==============================================================] 100.00% 0s
20250514:20:27:14 gpbackup:gpadmin:whpg_cdw:027069-[INFO]:-Gathering additional table metadata
20250514:20:27:14 gpbackup:gpadmin:whpg_cdw:027069-[INFO]:-Getting partition definitions
20250514:20:27:14 gpbackup:gpadmin:whpg_cdw:027069-[INFO]:-Getting storage information
20250514:20:27:14 gpbackup:gpadmin:whpg_cdw:027069-[INFO]:-Getting child partitions with altered schema
20250514:20:27:14 gpbackup:gpadmin:whpg_cdw:027069-[INFO]:-Metadata will be written to /data/coordinator/gpseg-1/backups/20250514/20250514202713/gpbackup_20250514202713_metadata.sql
20250514:20:27:14 gpbackup:gpadmin:whpg_cdw:027069-[INFO]:-Writing global database metadata
20250514:20:27:14 gpbackup:gpadmin:whpg_cdw:027069-[INFO]:-Global database metadata backup complete
20250514:20:27:14 gpbackup:gpadmin:whpg_cdw:027069-[INFO]:-Writing pre-data metadata
20250514:20:27:14 gpbackup:gpadmin:whpg_cdw:027069-[INFO]:-Pre-data metadata metadata backup complete
20250514:20:27:14 gpbackup:gpadmin:whpg_cdw:027069-[INFO]:-Writing post-data metadata
20250514:20:27:14 gpbackup:gpadmin:whpg_cdw:027069-[INFO]:-Post-data metadata backup complete
20250514:20:27:14 gpbackup:gpadmin:whpg_cdw:027069-[INFO]:-Writing data to file
Tables backed up: 33 / 33 [============================================================] 100.00% 7s
20250514:20:27:22 gpbackup:gpadmin:whpg_cdw:027069-[INFO]:-Data backup complete
20250514:20:27:22 gpbackup:gpadmin:whpg_cdw:027069-[INFO]:-Skipped data backup of 24 external/foreign table(s).
20250514:20:27:22 gpbackup:gpadmin:whpg_cdw:027069-[INFO]:-See /home/gpadmin/gpAdminLogs/gpbackup_20250514.log for a complete list of skipped tables.
20250514:20:27:23 gpbackup:gpadmin:whpg_cdw:027069-[INFO]:-/home/gpadmin/gp_email_contacts.yaml list found, /data/coordinator/gpseg-1/backups/20250514/20250514202713/gpbackup_20250514202713_report will be sent
20250514:20:28:23 gpbackup:gpadmin:whpg_cdw:027069-[INFO]:-Beginning cleanup
20250514:20:28:23 gpbackup:gpadmin:whpg_cdw:027069-[INFO]:-Cleanup complete
20250514:20:28:23 gpbackup:gpadmin:whpg_cdw:027069-[INFO]:-Backup completed successfully
The above command creates a file that contains global and database-specific metadata on the WarehousePG Coordinator host in the default directory, $COORDINATOR_DATA_DIRECTORY/backups/<YYYYMMDD>/<YYYYMMDDHHMMSS>/
.
For example:
[gpadmin@whpg_cdw 20250514202713]$ ls -ltr /data/coordinator/gpseg-1/backups/20250514/20250514202713
total 2112
-r--r--r-- 1 gpadmin gpadmin 2114041 May 14 20:27 gpbackup_20250514202713_metadata.sql
-r--r--r-- 1 gpadmin gpadmin 35787 May 14 20:27 gpbackup_20250514202713_toc.yaml
-r--r--r-- 1 gpadmin gpadmin 1437 May 14 20:27 gpbackup_20250514202713_config.yaml
-r--r--r-- 1 gpadmin gpadmin 1833 May 14 20:27 gpbackup_20250514202713_report
By default, each segment stores each table’s data for the backup in a separate compressed CSV file in <seg_dir>/backups/<YYYYMMDD>/<YYYYMMDDHHMMSS>/
:
[gpadmin@mdw 20250514202713]$ ls -ltr /data/primary/gpseg0/backups/20250514/20250514202713
total 125764
-rw------- 1 gpadmin gpadmin 494 May 14 20:27 gpbackup_0_20250514202713_65582.zst
-rw------- 1 gpadmin gpadmin 174123 May 14 20:27 gpbackup_0_20250514202713_67854.zst
-rw------- 1 gpadmin gpadmin 3057086 May 14 20:27 gpbackup_0_20250514202713_67861.zst
-rw------- 1 gpadmin gpadmin 32450223 May 14 20:27 gpbackup_0_20250514202713_70343.zst
-rw------- 1 gpadmin gpadmin 1994875 May 14 20:27 gpbackup_0_20250514202713_71070.zst
-rw------- 1 gpadmin gpadmin 475745 May 14 20:27 gpbackup_0_20250514202713_71077.zst
-rw------- 1 gpadmin gpadmin 3006034 May 14 20:27 gpbackup_0_20250514202713_71084.zst
-rw------- 1 gpadmin gpadmin 528895 May 14 20:27 gpbackup_0_20250514202713_71091.zst
-rw------- 1 gpadmin gpadmin 8945 May 14 20:27 gpbackup_0_20250514202713_71098.zst
-rw------- 1 gpadmin gpadmin 74 May 14 20:27 gpbackup_0_20250514202713_71105.zst
-rw------- 1 gpadmin gpadmin 19507368 May 14 20:27 gpbackup_0_20250514202713_71112.zst
-rw------- 1 gpadmin gpadmin 596995 May 14 20:27 gpbackup_0_20250514202713_71326.zst
-rw------- 1 gpadmin gpadmin 4688 May 14 20:27 gpbackup_0_20250514202713_71333.zst
-rw------- 1 gpadmin gpadmin 251 May 14 20:27 gpbackup_0_20250514202713_71340.zst
-rw------- 1 gpadmin gpadmin 289 May 14 20:27 gpbackup_0_20250514202713_71347.zst
-rw------- 1 gpadmin gpadmin 638 May 14 20:27 gpbackup_0_20250514202713_71354.zst
-rw------- 1 gpadmin gpadmin 4729580 May 14 20:27 gpbackup_0_20250514202713_71361.zst
-rw------- 1 gpadmin gpadmin 44197780 May 14 20:27 gpbackup_0_20250514202713_71575.zst
-rw------- 1 gpadmin gpadmin 198475 May 14 20:27 gpbackup_0_20250514202713_73562.zst
-rw------- 1 gpadmin gpadmin 224 May 14 20:27 gpbackup_0_20250514202713_73569.zst
-rw------- 1 gpadmin gpadmin 634 May 14 20:27 gpbackup_0_20250514202713_73576.zst
-rw------- 1 gpadmin gpadmin 1245122 May 14 20:27 gpbackup_0_20250514202713_73583.zst
-rw------- 1 gpadmin gpadmin 16500913 May 14 20:27 gpbackup_0_20250514202713_73716.zst
-rw------- 1 gpadmin gpadmin 1455 May 14 20:27 gpbackup_0_20250514202713_74227.zst
-rw------- 1 gpadmin gpadmin 13 May 14 20:27 gpbackup_0_20250514202713_74306.zst
-rw------- 1 gpadmin gpadmin 13 May 14 20:27 gpbackup_0_20250514202713_74312.zst
-rw------- 1 gpadmin gpadmin 302 May 14 20:27 gpbackup_0_20250514202713_74318.zst
-rw------- 1 gpadmin gpadmin 278 May 14 20:27 gpbackup_0_20250514202713_74324.zst
-rw------- 1 gpadmin gpadmin 353 May 14 20:27 gpbackup_0_20250514202713_74330.zst
-rw------- 1 gpadmin gpadmin 13 May 14 20:27 gpbackup_0_20250514202713_74336.zst
-rw------- 1 gpadmin gpadmin 13 May 14 20:27 gpbackup_0_20250514202713_74342.zst
-rw------- 1 gpadmin gpadmin 22 May 14 20:27 gpbackup_0_20250514202713_74348.zst
-rw------- 1 gpadmin gpadmin 441 May 14 20:27 gpbackup_0_20250514202713_74351.zst
To consolidate all backup files into a single directory, include the --backup-dir
option with an absolute path to the location you wish to backup to. Optionally, when performing a backup, the --single-data-file
option may be used in situations where the additional overhead of multiple files might be prohibitive such as third party storage solutions.
The command below shows both options in use
[gpadmin@whpg_cdw ~]$ gpbackup --dbname ww_sales --single-data-file --no-compression --backup-dir /tmp/single_file
20250515:18:22:09 gpbackup:gpadmin:whpg_cdw:032298-[INFO]:-gpbackup version = 1.30.5
20250515:18:22:09 gpbackup:gpadmin:whpg_cdw:032298-[INFO]:-Greenplum Database Version = 6.27.1 build commit:ab5a612bfdc355ad2d601860dfb70a47778c8dd7
20250515:18:22:09 gpbackup:gpadmin:whpg_cdw:032298-[INFO]:-Starting backup of database ww_sales
20250515:18:22:09 gpbackup:gpadmin:whpg_cdw:032298-[INFO]:-Backup Timestamp = 20250515182209
20250515:18:22:09 gpbackup:gpadmin:whpg_cdw:032298-[INFO]:-Backup Database = ww_sales
20250515:18:22:09 gpbackup:gpadmin:whpg_cdw:032298-[INFO]:-Gathering table state information
20250515:18:22:09 gpbackup:gpadmin:whpg_cdw:032298-[INFO]:-Acquiring ACCESS SHARE locks on tables
Locks acquired: 57 / 57 [==============================================================] 100.00% 0s
20250515:18:22:09 gpbackup:gpadmin:whpg_cdw:032298-[INFO]:-Gathering additional table metadata
20250515:18:22:09 gpbackup:gpadmin:whpg_cdw:032298-[INFO]:-Getting partition definitions
20250515:18:22:09 gpbackup:gpadmin:whpg_cdw:032298-[INFO]:-Getting storage information
20250515:18:22:09 gpbackup:gpadmin:whpg_cdw:032298-[INFO]:-Getting child partitions with altered schema
20250515:18:22:09 gpbackup:gpadmin:whpg_cdw:032298-[INFO]:-Metadata will be written to /tmp/single_file/gpseg-1/backups/20250515/20250515182209/gpbackup_20250515182209_metadata.sql
20250515:18:22:09 gpbackup:gpadmin:whpg_cdw:032298-[INFO]:-Writing global database metadata
20250515:18:22:09 gpbackup:gpadmin:whpg_cdw:032298-[INFO]:-Global database metadata backup complete
20250515:18:22:09 gpbackup:gpadmin:whpg_cdw:032298-[INFO]:-Writing pre-data metadata
20250515:18:22:10 gpbackup:gpadmin:whpg_cdw:032298-[INFO]:-Pre-data metadata metadata backup complete
20250515:18:22:10 gpbackup:gpadmin:whpg_cdw:032298-[INFO]:-Writing post-data metadata
20250515:18:22:10 gpbackup:gpadmin:whpg_cdw:032298-[INFO]:-Post-data metadata backup complete
20250515:18:22:10 gpbackup:gpadmin:whpg_cdw:032298-[INFO]:-Writing data to file
Tables backed up: 33 / 33 [============================================================] 100.00% 8s
20250515:18:22:18 gpbackup:gpadmin:whpg_cdw:032298-[INFO]:-Data backup complete
20250515:18:22:18 gpbackup:gpadmin:whpg_cdw:032298-[INFO]:-Skipped data backup of 24 external/foreign table(s).
20250515:18:22:18 gpbackup:gpadmin:whpg_cdw:032298-[INFO]:-See /home/gpadmin/gpAdminLogs/gpbackup_20250515.log for a complete list of skipped tables.
20250515:18:22:19 gpbackup:gpadmin:whpg_cdw:032298-[INFO]:-Found neither /usr/local/greenplum-db-6.27.1/bin/gp_email_contacts.yaml nor /home/gpadmin/gp_email_contacts.yaml
20250515:18:22:19 gpbackup:gpadmin:whpg_cdw:032298-[INFO]:-Email containing gpbackup report /tmp/single_file/gpseg-1/backups/20250515/20250515182209/gpbackup_20250515182209_report will not be sent
20250515:18:22:19 gpbackup:gpadmin:whpg_cdw:032298-[INFO]:-Beginning cleanup
20250515:18:22:24 gpbackup:gpadmin:whpg_cdw:032298-[INFO]:-Cleanup complete
20250515:18:22:24 gpbackup:gpadmin:whpg_cdw:032298-[INFO]:-Backup completed successfully
The contents of the corresponding backup directories show the single data file, and it's associated table of contents files (toc). Both files are required for a successful restore.
[gpadmin@whpg_cdw ~]$ ls -ltr /tmp/single_file/gp*/backups/*/*
/tmp/single_file/gpseg0/backups/20250515/20250515182209:
total 407012
-rw-rw-r-- 1 gpadmin gpadmin 416771752 May 15 18:22 gpbackup_0_20250515182209
-r--r--r-- 1 gpadmin gpadmin 1864 May 15 18:22 gpbackup_0_20250515182209_toc.yaml
/tmp/single_file/gpseg1/backups/20250515/20250515182209:
total 434396
-rw-rw-r-- 1 gpadmin gpadmin 444811433 May 15 18:22 gpbackup_1_20250515182209
-r--r--r-- 1 gpadmin gpadmin 1864 May 15 18:22 gpbackup_1_20250515182209_toc.yaml
/tmp/single_file/gpseg2/backups/20250515/20250515182209:
total 407260
-rw-rw-r-- 1 gpadmin gpadmin 417025293 May 15 18:22 gpbackup_2_20250515182209
-r--r--r-- 1 gpadmin gpadmin 1864 May 15 18:22 gpbackup_2_20250515182209_toc.yaml
/tmp/single_file/gpseg-1/backups/20250515/20250515182209:
total 2112
-r--r--r-- 1 gpadmin gpadmin 2114041 May 15 18:22 gpbackup_20250515182209_metadata.sql
-r--r--r-- 1 gpadmin gpadmin 35787 May 15 18:22 gpbackup_20250515182209_toc.yaml
-r--r--r-- 1 gpadmin gpadmin 1451 May 15 18:22 gpbackup_20250515182209_config.yaml
-r--r--r-- 1 gpadmin gpadmin 1872 May 15 18:22 gpbackup_20250515182209_report
Full Restore
To use gprestore
to restore from a backup set, you must use the --timestamp
option to specify the exact timestamp value (YYYYMMDDHHMMSS) to restore. Include the --create-db
option if the database does not exist in the cluster. If you specified a custom --backup-dir to consolidate the backup files, include the same --backup-dir
option when using gprestore
to locate the backup files.
[gpadmin@whpg_cdw ~]$ psql -c "DROP DATABASE ww_sales";
DROP DATABASE
[gpadmin@whpg_cdw ~]$
[gpadmin@whpg_cdw ~]$ gprestore --timestamp 20250515182209 --backup-dir /tmp/single_file --create-db
20250515:18:35:09 gprestore:gpadmin:whpg_cdw:032941-[INFO]:-Restore Key = 20250515182209
20250515:18:35:09 gprestore:gpadmin:whpg_cdw:032941-[INFO]:-gpbackup version = 1.30.5
20250515:18:35:09 gprestore:gpadmin:whpg_cdw:032941-[INFO]:-gprestore version = 1.30.5
20250515:18:35:09 gprestore:gpadmin:whpg_cdw:032941-[INFO]:-Greenplum Database Version = 6.27.1 build commit:ab5a612bfdc355ad2d601860dfb70a47778c8dd7
20250515:18:35:09 gprestore:gpadmin:whpg_cdw:032941-[INFO]:-Creating database
20250515:18:35:10 gprestore:gpadmin:whpg_cdw:032941-[INFO]:-Database creation complete for: ww_sales
20250515:18:35:10 gprestore:gpadmin:whpg_cdw:032941-[INFO]:-Restoring pre-data metadata
Pre-data objects restored: 153 / 153 [=================================================] 100.00% 3s
20250515:18:35:14 gprestore:gpadmin:whpg_cdw:032941-[INFO]:-Pre-data metadata restore complete
Tables restored: 33 / 33 [============================================================] 100.00% 38s
20250515:18:35:52 gprestore:gpadmin:whpg_cdw:032941-[INFO]:-Data restore complete
20250515:18:35:52 gprestore:gpadmin:whpg_cdw:032941-[INFO]:-Restoring post-data metadata
20250515:18:35:52 gprestore:gpadmin:whpg_cdw:032941-[INFO]:-Post-data metadata restore complete
20250515:18:35:52 gprestore:gpadmin:whpg_cdw:032941-[INFO]:-Found neither /usr/local/greenplum-db-6.27.1/bin/gp_email_contacts.yaml nor /home/gpadmin/gp_email_contacts.yaml
20250515:18:35:52 gprestore:gpadmin:whpg_cdw:032941-[INFO]:-Email containing gprestore report /tmp/single_file/gpseg-1/backups/20250515/20250515182209/gprestore_20250515182209_20250515183509_report will not be sent
20250515:18:35:52 gprestore:gpadmin:whpg_cdw:032941-[INFO]:-Beginning cleanup
20250515:18:36:00 gprestore:gpadmin:whpg_cdw:032941-[INFO]:-Cleanup complete
20250515:18:36:00 gprestore:gpadmin:whpg_cdw:032941-[INFO]:-Restore completed successfully
gprestore
does not attempt to restore global metadata for the WarehousePG Cluster by default. If this is required, include the --with-globals
option.
By default, gprestore
uses 1 connection to restore table data and metadata. If you have a large backup set which did not use the --single-data-file
option, restore duration can be decreased by specifiying the number of parallel processes using the --jobs
option. Depending on system resourceds and database size, this number can be tuned for each specific environment.
[gpadmin@whpg_cdw ~]$ psql -c "DROP DATABASE ww_sales";
DROP DATABASE
[gpadmin@whpg_cdw ~]$
[gpadmin@whpg_cdw ~]$ gprestore --timestamp 20250514202713 --create-db --jobs 4
20250515:18:40:40 gprestore:gpadmin:whpg_cdw:033527-[INFO]:-Restore Key = 20250514202713
20250515:18:40:40 gprestore:gpadmin:whpg_cdw:033527-[INFO]:-gpbackup version = 1.30.5
20250515:18:40:40 gprestore:gpadmin:whpg_cdw:033527-[INFO]:-gprestore version = 1.30.5
20250515:18:40:40 gprestore:gpadmin:whpg_cdw:033527-[INFO]:-Greenplum Database Version = 6.27.1 build commit:ab5a612bfdc355ad2d601860dfb70a47778c8dd7
20250515:18:40:40 gprestore:gpadmin:whpg_cdw:033527-[INFO]:-Creating database
20250515:18:40:41 gprestore:gpadmin:whpg_cdw:033527-[INFO]:-Database creation complete for: ww_sales
20250515:18:40:41 gprestore:gpadmin:whpg_cdw:033527-[INFO]:-Restoring pre-data metadata
Pre-data objects restored: 153 / 153 [=================================================] 100.00% 2s
20250515:18:40:43 gprestore:gpadmin:whpg_cdw:033527-[INFO]:-Pre-data metadata restore complete
Tables restored: 33 / 33 [============================================================] 100.00% 16s
20250515:18:41:00 gprestore:gpadmin:whpg_cdw:033527-[INFO]:-Data restore complete
20250515:18:41:00 gprestore:gpadmin:whpg_cdw:033527-[INFO]:-Restoring post-data metadata
20250515:18:41:00 gprestore:gpadmin:whpg_cdw:033527-[INFO]:-Post-data metadata restore complete
20250515:18:41:00 gprestore:gpadmin:whpg_cdw:033527-[INFO]:-Found neither /usr/local/greenplum-db-6.27.1/bin/gp_email_contacts.yaml nor /home/gpadmin/gp_email_contacts.yaml
20250515:18:41:00 gprestore:gpadmin:whpg_cdw:033527-[INFO]:-Email containing gprestore report /data/coordinator/gpseg-1/backups/20250514/20250514202713/gprestore_20250514202713_20250515184040_report will not be sent
20250515:18:41:00 gprestore:gpadmin:whpg_cdw:033527-[INFO]:-Beginning cleanup
20250515:18:41:00 gprestore:gpadmin:whpg_cdw:033527-[INFO]:-Cleanup complete
20250515:18:41:00 gprestore:gpadmin:whpg_cdw:033527-[INFO]:-Restore completed successfully
[gpadmin@whpg_cdw ~]$
Report Files
When performing a backup or restore operation, gpbackup
and gprestore
generate a report file. When email notification is configured, the email sent contains the contents of the report file. For information about email notification, see Configuring Email Notifications.
The report file is placed in the WarehousePG Coordinator backup directory. The report file name contains the timestamp of the operation. These are the formats of the gpbackup
and gprestore
report file names.
gpbackup_<backup_timestamp>_report
gprestore_<backup_timestamp>_<restore_timesamp>_report
For these example report file names, 20250518010000
is the timestamp of the backup and 20250530234643
is the timestamp of the restore operation.
gpbackup_20250518010000_report
gprestore_20250518010000_20180213115426_report
This backup directory on a WarehousePG Coordinator host contains both a gpbackup
and gprestore
report file.
[gpadmin@cdw 20250530234643]$ ls -ltr
total 2124
-r--r--r-- 1 gpadmin gpadmin 2120143 May 30 23:46 gpbackup_20250530234643_metadata.sql
-r--r--r-- 1 gpadmin gpadmin 38064 May 30 23:46 gpbackup_20250530234643_toc.yaml
-r--r--r-- 1 gpadmin gpadmin 1499 May 30 23:46 gpbackup_20250530234643_config.yaml
-r--r--r-- 1 gpadmin gpadmin 1837 May 30 23:46 gpbackup_20250530234643_report
-r--r--r-- 1 gpadmin gpadmin 539 May 31 00:05 gprestore_20250530234643_20250531000515_report
The contents of the report files are similar. This is an example of the contents of a gprestore
report file.
WarehosuePG Report
timestamp key: 20250530234643
gpdb version: 6.27.1 build commit:ab5a612bfdc355ad2d601860dfb70a47778c8dd7
gprestore version: 1.30.5
database name: test
command line: gprestore --timestamp 20250530234643 --redirect-db test --create-db
backup segment count: 8
restore segment count: 8
start time: Sat May 31 2025 00:05:15
end time: Sat May 31 2025 00:05:57
duration: 0:00:42
restore status: Success
Backup History Database
gpbackup
stores details of each backup operation in a SQLite database found in $COORDINATOR_DATA_DIRECTORY/gpbackup_history.db
. Details such as timestamps, command line options, incremental backup details and status are stored in this database. gpbackup_history.db
is not backed up my gpbackup
, but can be copied to a secondary location if a backup copy is desired.
gpbackup
uses the metadata in gpbackup_history.db
to create the backup/restore plan for an incremental backup sets when you run gpbackup
with the --incremental
option and do not specify the --from-timesamp
option to indicate the backup that you want to use as the base backup of the incremental backup set. For information about incremental backups, refer to Incremental Backups with gpbackup
and gprestore
.
Filtering the Contents of a Backup or Restore
gpbackup
backs up all schemas and tables in the specified database, unless you exclude or include individual schema or table objects with schema level or table level filter options.
The schema level options are
--include-schema
--include-schema-file
--exclude-schema
--exclude-schema-file
command-line options togpbackup
. For example, if theww_customer
database contains three schemas,na_customer
,apac_customer
,emea_customer
, the following commands back up only theapac_customer
andemea_customer
schemas:
$ gpbackup --dbname ww_customer --exclude-schema na_customer
Multiple --include-schema
options may be used in a gpbackup
or multiple --exclude-schema
options to filter 2 or many schemas
$ gpbackup --dbname ww_customer --include-schema apac_customer --include-schema emea_customer
An alternative to multiple command line options is to use --include-schema-file
or --exclude-schema-file
. Each line in the file defines a single schema, and the file cannot contain trailing lines.
/tmp/nw_states.schema
contents
[gpadmin@whpg_cdw tmp]$ cat nw_states.schema
Washington
Oregon
Idaho
Montana
Wyoming
[gpadmin@whpg_cdw tmp]$
Example of the command:
gpbackup --dbname ww_customer --include-schema-file /tmp/nw_states.schema
Filtering included or excluded tables is similar process to schemas.
--include-table
--exclude-table
--include-table-file
--exclude-table-file
Options use the schema-name.table-name
format as input on the command line, and in the text file. The individual table filtering options can be used multiple times, but --include-table
and --exclude-table
cannot both be used in the same command.
You can create a list of qualified table names in a text file. Each line in the file defines a single schema-name.table-name
, and the file cannot contain trailing lines.
gpbackup --dbname ww_customer --include-table apac_customer.customer_fact
or
gpbackup --dbname ww_customer --exclude-table-file /tmp/exclude_tables.file
where /tmp/include_tables.file
contents
[gpadmin@whpg_cdw tmp]$ cat exclude_tables.file
emea_customer.customer_fact
na_customer.customer_fact
[gpadmin@whpg_cdw tmp]$
Table and schema names containing upper case letters or spaces must be enclosed with double quotes.
[gpadmin@whpg_cdw tmp]$ cat exclude_tables_2.file
emea_customer.customer_fact
na_customer.customer_fact
na_customer."ZipCodes"
"WW_GEO".holidays
"WW_GEO"."time zones"
[gpadmin@whpg_cdw tmp]$
When --include-table
or --include-table-file
is specified on the command line, dependent objects are not automatically backed up or restored. Depenedent objects must be specified in your filter string or file. For example, if you back up or restore a view or materialized view, you must also list the table(s) the view or the materialized view require. If you backup or restore a table containing a sequence, you must also specify the sequence name.
Filtering by Leaf Partition
By default, gpbackup
creates one file for each table on a data segment. When the --leaf-partition-data
option is used, gpbackup
will create one data file per leaf partition of a partitioned table, instead of a single file data file for the root table. You can also filter backups to specific leaf partitions by including the names of the leaf partitions names as you would a stand along table, using the schema_name.table_name
format.
gpadmin=# \d+ ww_inventory
Table "WW_GEO.ww_inventory"
Column | Type | Modifiers | Storage | Stats target | Description
-----------------------+-------------------+-----------+----------+--------------+-------------
prod_id | integer | | plain | |
prod_sku | character varying | | extended | |
prod_warehouse | character varying | | extended | |
prod_qty_on_hand | integer | | plain | |
prod_date_inventoried | date | | plain | |
Child tables: ww_inventory_1_prt_1,
ww_inventory_1_prt_10,
ww_inventory_1_prt_11,
ww_inventory_1_prt_12,
ww_inventory_1_prt_13,
ww_inventory_1_prt_14,
ww_inventory_1_prt_15,
ww_inventory_1_prt_16,
ww_inventory_1_prt_17,
ww_inventory_1_prt_18,
ww_inventory_1_prt_19,
ww_inventory_1_prt_2,
ww_inventory_1_prt_20,
ww_inventory_1_prt_21,
ww_inventory_1_prt_22,
ww_inventory_1_prt_23,
ww_inventory_1_prt_24,
ww_inventory_1_prt_25,
ww_inventory_1_prt_26,
ww_inventory_1_prt_27,
ww_inventory_1_prt_28,
ww_inventory_1_prt_29,
ww_inventory_1_prt_3,
ww_inventory_1_prt_30,
ww_inventory_1_prt_4,
ww_inventory_1_prt_5,
ww_inventory_1_prt_6,
ww_inventory_1_prt_7,
ww_inventory_1_prt_8,
ww_inventory_1_prt_9
Distributed by: (prod_id)
Partition by: (prod_date_inventoried)
The following file /tmp/may_week1.include
contains the partitions for the first week of May which will be included in our gpbackup
[gpadmin@whpg_cdw ~]$ cat /tmp/may_week1.include
"WW_GEO".ww_inventory_1_prt_1
"WW_GEO".ww_inventory_1_prt_2
"WW_GEO".ww_inventory_1_prt_3
"WW_GEO".ww_inventory_1_prt_4
"WW_GEO".ww_inventory_1_prt_5
"WW_GEO".ww_inventory_1_prt_6
"WW_GEO".ww_inventory_1_prt_7
Using the --include-table-file
and --leaf-partition-data
options, gpbackup
will create one data file for each leaf partition specified in the input file
$ gpbackup --dbname ww_sales --include-table-file /tmp/may_week1.include --leaf-partition-data
The --exclude-table-file
option and --leaf-partition-data
are not compatible. Although you can specify leaf partition names in a file specified with --exclude-table-file
, gpbackup
ignores the partition names.
Filtering with gprestore
After creating a backup set with gpbackup
, you can filter the schemas and tables that you want to restore from the backup set using the gprestore --include-schema
and --include-table-file
options. These options work in the same way as their gpbackup
counterparts, but have the following restrictions:
The tables that you attempt to restore must not already exist in the database.
If you attempt to restore a schema or table that does not exist in the backup set, the gprestore
does not run.
If you use the --include-schema
option, gprestore
cannot restore objects that have dependencies on multiple schemas.
If you use the --include-table-file
option, gprestore
does not create roles or set the owner of the tables. The utility restores table indexes and rules. Triggers are also restored but are not supported in WarehousePG.
The file that you specify with--include-table-file
cannot include a leaf partition name, as it can when you specify this option with gpbackup
. If you specified leaf partitions in the backup set, specify the partitioned table to restore the leaf partition data.
When restoring a backup set that contains data from some leaf partitions of a partitioned table, the partitioned table is restored along with the data for the leaf partitions. For example, you create a backup with the gpbackup
option --include-table-file
and the text file lists some leaf partitions of a partitioned table. Restoring the backup creates the partitioned table and restores the data only for the leaf partitions listed in the file.
Setting Up Email Alerts
gpbackup
and gprestore
can send email notifications via sendmail
after a backup or restore run completes.
To have gpbackup
or gprestore
send out status email notifications, a gp_email_contacts.yaml
file must exist in either home directory of the user running gpbackup
or gprestore
or the same directory as the utilities ($GPHOME/bin).
If the gp_email_contacts.yaml
file is not present, the gpbackup/gprestore log file will have a message similar to:
20250530:23:46:52 gpbackup:gpadmin:cdw:022290-[INFO]:-Data backup complete
20250530:23:46:52 gpbackup:gpadmin:cdw:022290-[INFO]:-Skipped data backup of 24 external/foreign table(s).
20250530:23:46:52 gpbackup:gpadmin:cdw:022290-[INFO]:-See /home/gpadmin/gpAdminLogs/gpbackup_20250530.log for a complete list of skipped tables.
20250530:23:46:53 gpbackup:gpadmin:cdw:022290-[INFO]:-Found neither /usr/local/greenplum-db-6.27.1/bin/gp_email_contacts.yaml nor /home/gpadmin/gp_email_contacts.yaml
20250530:23:46:53 gpbackup:gpadmin:cdw:022290-[INFO]:-Email containing gpbackup report /data/coordinator/gpseg-1/backups/20250530/20250530234643/gpbackup_20250530234643_report will not be sent
20250530:23:46:53 gpbackup:gpadmin:cdw:022290-[INFO]:-Beginning cleanup
20250530:23:46:53 gpbackup:gpadmin:cdw:022290-[INFO]:-Cleanup complete
20250530:23:46:53 gpbackup:gpadmin:cdw:022290-[INFO]:-Backup completed successfully
If the gp_email_contacts.yaml
file is present, can configured properly, a similar message will be printed to the logs:
20250514:20:27:23 gpbackup:gpadmin:whpg_cdw:027069-[INFO]:-/home/gpadmin/gp_email_contacts.yaml list found, /data/coordinator/gpseg-1/backups/20250514/20250514202713/gpbackup_20250514202713_report will be sent```
The $HOME/gp_email_contacts.yaml
file will override any configurations found in the $GPHOME/bin/gp_email_contacts.yaml
The email subject line includes the utility name, timestamp, status, and the name of the WarehousePG Coordinator. This is an example subject line for a gpbackup
email.
gpbackup 20250514202713 on whpg_cdw completed: Success
or
gprestore 20250515182209 on whpg_cdw completed: Failure
The email contains summary information about the operation including options, duration, and number of objects backed up or restored. For information about the contents of a notification email, see Report Files.
gp_email_contacts.yaml file format
The gpbackup
and gprestore
email notification YAML file gp_email_contacts.yaml uses indentation (spaces) to determine the document hierarchy and the relationships of the sections to one another. The use of white space is significant. White space should not be used simply for formatting purposes, and tabs should not be used at all.
Note: If the status parameters are not specified correctly, the utility does not issue a warning. For example, if the success parameter is misspelled and is set to true, a warning is not issued and an email is not sent to the email address after a successful operation. To ensure email notification is configured correctly, run tests with email notifications configured.
This is the format of the gp_email_contacts.yaml YAML file for gpbackup
email notifications:
contacts:
gpbackup:
- address: name@domain
status:
success: [true | false]
success_with_errors: [true | false]
failure: [true | false]
gprestore:
- address: name@domain
status:
success: [true | false]
success_with_errors: [true | false]
failure: [true | false]
Email YAML File Sections
contacts: Required. The section that contains the gpbackup
and gprestore
sections. The YAML file can contain a gpbackup
section, a gprestore
section, or one of each.
gpbackup : Optional. Begins the gpbackup email section.
address : Required. At least one email address must be specified. Multiple email address parameters can be specified. Each address requires a status section.
Note
name@domainis a single, valid email address.
status : Required. Specify when the utility sends an email to the specified email address. The default is to not send email notification.
You specify sending email notifications based on the completion status of a backup or restore operation. At least one of these parameters must be specified and each parameter can appear at most once.
success : Optional. Specify if an email is sent if the operation completes without errors. If the value is true, an email is sent if the operation completes without errors. If the value is false (the default), an email is not sent.
success_with_errors : Optional. Specify if an email is sent if the operation completes with errors. If the value is true, an email is sent if the operation completes with errors. If the value is false (the default), an email is not sent.
failure : Optional. Specify if an email is sent if the operation fails. If the value is true, an email is sent if the operation fails. If the value is false (the default), an email is not sent.
gprestore : Optional. Begins the gprestore email section. This section contains the address and status parameters that are used to send an email notification after a gprestore
operation. The syntax is the same as the gpbackup section.
Examples
This example YAML file specifies sending email to email addresses depending on the success or failure of an operation. For a backup operation, an email is sent to a different address depending on the success or failure of the backup operation. For a restore operation, an email is sent to single address only when the operation succeeds or completes with errors.
contacts:
gpbackup:
- address: dba_backup_success@whpg.io
status:
success:true
- address: dba_backup_failure@whpg.io
status:
success_with_errors: true
failure: true
gprestore:
- address: dba_restore_status@example.com
status:
success: true
success_with_errors: true
Backup Files Details
A complete backup set for gpbackup
includes multiple metadata files, supporting files, and CSV data files, each designated with the timestamp at which the backup was created.
By default, metadata and supporting files are stored on the WarehousePG master host in the directory $COORDINATOR_DATA_DIRECTORY/backups/YYYYMMDD/YYYYMMDDHHMMSS/
. If you specify a custom backup directory, this same file path is created as a subdirectory of the backup directory. The following table describes the names and contents of the metadata and supporting files.
Warning:
All gpbackup
metadata files are created with read-only permissions. Never delete or modify the metadata files for a gpbackup
backup set. Doing so may render the backup files non-functional.
Coordinator Metadata Files
gpbackup_<YYYYMMDDHHMMSS>_metadata.sql
Contains global and database-specific metadata:
- DDL for objects that are global to the WarehousePG cluster, and not owned by a specific database within the cluster.
- DDL for objects in the backed-up database (specified with --dbname) that must be created before to restoring the actual data, and DDL for objects that must be created after restoring the data.
Global objects include:
- Tablespaces
- Databases
- Database-wide configuration parameter settings (GUCs)
- Resource group definitions
- Resource queue definitions
- Roles
- GRANT assignments of roles to databases
Note
Note: Global metadata is not restored by default. You must include the --with-globals option to the gprestore
command to restore global metadata.
Database-specific objects that must be created before to restoring the actual data include:
- Session-level configuration parameter settings (GUCs)
- Schemas
- Procedural language extensions
- Types
- Sequences
- Functions
- Tables
- Protocols
- Operators and operator classes
- Conversions
- Aggregates
- Casts
- Views
- Materialized Views (only view definition is backed up / restored, not data)
- Constraints
- Database-specific objects that must be created after restoring the actual data include:
- Indexes
- Rules
- Triggers. (While WarehousePG does not support triggers, any trigger definitions that are present are backed up and restored.)
example:
CREATE TABLE uat.refund (
returned_date_sk integer,
returned_time_sk integer,
item_sk integer,
refunded_customer_sk integer,
refunded_cdemo_sk integer,
refunded_hdemo_sk integer,
) DISTRIBUTED RANDOMLY;
ALTER TABLE uat.refund OWNER TO gpadmin;
CREATE INDEX item_sk_cr_fee_idx ON uat.refund USING btree (item_sk, fee);
CREATE INDEX item_sk_idx ON uat.refund USING btree (item_sk);
gpbackup_<YYYYMMDDHHMMSS>_toc.yaml
Table of contents file, containing location information of the various object DDL in the gpbackup_<YYYYMMDDHHMMSS>_metadata.sql
files
This file also contains the table names and OIDs used for locating the corresponding table data in CSV data files that are created on each segment.
example:
- schema: tpcds
name: household_demographics
oid: 37231
attributestring: (hd_demo_sk,hd_income_band_sk,hd_buy_potential,hd_dep_count,hd_vehicle_count)
rowscopied: 7200
partitionroot: ""
isreplicated: false
distbyenum: false
- schema: tpcds
name: income_band
oid: 37238
attributestring: (ib_income_band_sk,ib_lower_bound,ib_upper_bound)
rowscopied: 20
partitionroot: ""
isreplicated: false
distbyenum: false
- schema: tpcds
name: inventory
oid: 37245
attributestring: (inv_date_sk,inv_item_sk,inv_warehouse_sk,inv_quantity_on_hand)
rowscopied: 11745000
partitionroot: ""
isreplicated: false
distbyenum: false
gpbackup_<YYYYMMDDHHMMSS>_report
Contains information about the backup operation that is used to populate the email notice (if configured) that is sent after the backup completes. This file contains information such as:
- Command-line options that were provided
- Database that was backed up
- Database version
- Backup type
example:
WarehousePG Backup Report
timestamp key: 20250530232002
gpdb version: 6.27.1 build commit:ab5a612bfdc355ad2d601860dfb70a47778c8dd7
gpbackup version: 1.30.5
database name: whpg_tpcds
command line: gpbackup --dbname whpg_tpcds --no-compression --single-data-file --backup-dir /tmp/whpg_tpcds_backups
compression: None
plugin executable: None
backup section: All Sections
object filtering: None
includes statistics: No
data file format: Single Data File Per Segment
incremental: False
start time: Fri May 30 2025 23:20:02
end time: Fri May 30 2025 23:20:13
duration: 0:00:11
backup status: Success
database size: 1699 MB
segment count: 3
count of database objects in backup:
aggregates 0
casts 0
collations 0
constraints 0
conversions 0
default privileges 0
database gucs 1
event triggers 0
extensions 0
foreign data wrappers 0
foreign servers 0
functions 0
indexes 2
gpbackup_<YYYYMMDDHHMMSS>_config.yaml
Contains metadata about the execution of the particular backup task, including:
gpbackup
version- Database name
- WarehousePG version
- Additional option settings such as
--no-compression
,--compression-level
,--metadata-only
,--data-only
, and--with-stats
.
example:
backupdir: /tmp/whpg_tpcds_backups
backupversion: 1.30.5
compressed: false
compressiontype: gzip
databasename: whpg_tpcds
databaseversion: 6.27.1 build commit:ab5a612bfdc355ad2d601860dfb70a47778c8dd7
segmentcount: 8
dataonly: false
datedeleted: ""
excluderelations: []
excludeschemafiltered: false
excludeschemas: []
excludetablefiltered: false
includerelations: []
includeschemafiltered: false
includeschemas: []
includetablefiltered: false
incremental: false
leafpartitiondata: false
metadataonly: false
plugin: ""
pluginversion: ""
restoreplan:
- timestamp: "20250530232002"
tablefqns:
- tpcds.call_center
- tpcds.catalog_page
- tpcds.catalog_returns
- tpcds.catalog_sales
- tpcds.customer
- tpcds.customer_address
- tpcds.customer_demographics
Segment Data Files
By default, each segment creates one compressed CSV file for each table that is backed up on the segment. You can optionally specify the --single-data-file
option to create a single data file on each segment. The files are stored in <seg_dir>/backups/YYYYMMDD/YYYYMMDDHHMMSS/
.
If you specify a custom backup directory, segment data files are copied to this same file path as a subdirectory of the backup directory. If you include the --leaf-partition-data
option, gpbackup
creates one data file for each leaf partition of a partitioned table, instead of just one table for file.
By default, each table is backed up into a distinct file on the segment hosts: The file uses a name format gpbackup_<content_id>_<YYYYMMDDHHMMSS>_<oid>.gz
where:
<content_id>
is the content ID of the segment. <YYYYMMDDHHMMSS>
is the timestamp of the gpbackup
operation. <oid>
is the object ID of the table.
default multiple data file example
-rw------- 1 gpadmin gpadmin 216 May 30 23:46 gpbackup_1_20250530234643_32812.zst
-rw------- 1 gpadmin gpadmin 177641 May 30 23:46 gpbackup_1_20250530234643_32822.zst
-rw------- 1 gpadmin gpadmin 3080557 May 30 23:46 gpbackup_1_20250530234643_32829.zst
-rw------- 1 gpadmin gpadmin 32449514 May 30 23:46 gpbackup_1_20250530234643_36476.zst
-rw------- 1 gpadmin gpadmin 1989827 May 30 23:46 gpbackup_1_20250530234643_37203.zst
-rw------- 1 gpadmin gpadmin 475551 May 30 23:46 gpbackup_1_20250530234643_37210.zst
-rw------- 1 gpadmin gpadmin 3002507 May 30 23:46 gpbackup_1_20250530234643_37217.zst
-rw------- 1 gpadmin gpadmin 535332 May 30 23:46 gpbackup_1_20250530234643_37224.zst
-rw------- 1 gpadmin gpadmin 8895 May 30 23:46 gpbackup_1_20250530234643_37231.zst
-rw------- 1 gpadmin gpadmin 74 May 30 23:46 gpbackup_1_20250530234643_37238.zst
-rw------- 1 gpadmin gpadmin 19518846 May 30 23:46 gpbackup_1_20250530234643_37245.zst
-rw------- 1 gpadmin gpadmin 606613 May 30 23:46 gpbackup_1_20250530234643_37459.zst
-rw------- 1 gpadmin gpadmin 4595 May 30 23:46 gpbackup_1_20250530234643_37466.zst
-rw------- 1 gpadmin gpadmin 177 May 30 23:46 gpbackup_1_20250530234643_37473.zst
-rw------- 1 gpadmin gpadmin 152 May 30 23:46 gpbackup_1_20250530234643_37480.zst
-rw------- 1 gpadmin gpadmin 327 May 30 23:46 gpbackup_1_20250530234643_37487.zst
-rw------- 1 gpadmin gpadmin 4710343 May 30 23:46 gpbackup_1_20250530234643_37494.zst
--single-data-file
example
All table data for a particular segment is written to a single file:
gpbackup_<content_id>_<YYYYMMDDHHMMSS>
With a corresponding table of contents files:
gpbackup_<content_id>_<YYYYMMDDHHMMSS>_toc.yaml
-rw-rw-r-- 1 gpadmin gpadmin 417025744 May 30 23:20 gpbackup_0_20250530232002
-r--r--r-- 1 gpadmin gpadmin 2035 May 30 23:20 gpbackup_0_20250530232002_toc.yaml
The metadata file gpbackup_<YYYYMMDDHHMMSS>_toc.yaml
references this <oid>
to locate the data for a specific table in a schema.
You can optionally specify the gzip compression level (from 1-9) using the --compression-level
option, or disable compression entirely with --no-compression
. If you do not specify a compression level, gpbackup
uses compression level 1 by default.
Return Codes
One of these codes is returned after gpbackup
or gprestore
completes.
0 – Backup or restore completed with no problems
1 – Backup or restore completed with non-fatal errors. See log file for more information.
2 – Backup or restore failed with a fatal error. See log file for more information.
Supported WHPG versions
The WarehousePG provided gpbackup
and gprestore
utilities are compatible with WarehousePG versions
- 6.27.1 or later
- 7.2.1-WHPG or later
Limitations
gpbackup
and gprestore
have the following limitations:
If you create an index on a parent partitioned table, gpbackup
does not back up that same index on child partitioned tables of the parent, as creating the same index on a child would cause an error. However, if you exchange a partition, gpbackup
does not detect that the index on the exchanged partition is inherited from the new parent table. In this case, gpbackup
backs up conflicting CREATE INDEX statements, which causes an error when you restore the backup set.
You can execute multiple instances of gpbackup
, but each execution requires a distinct timestamp.
Database object filtering is currently limited to schemas and tables.
When backing up a partitioned table where some or all leaf partitions are in different schemas from the root partition, the leaf partition table definitions, including the schemas, are backed up as metadata. This occurs even if the backup operation specifies that schemas that contain the leaf partitions should be excluded. To control data being backed up for this type of partitioned table in this situation, use the --leaf-partition-data
option.
If the --leaf-partition-data
option is not specified, the leaf partition data is also backed up even if the backup operation specifies that the leaf partition schemas should excluded. If the --leaf-partition-data
option is specified, the leaf partition data is not be backed up if the backup operation specifies that the leaf partition schemas should excluded. Only the metadata for leaf partition tables are backed up. If you use the gpbackup
--single-data-file option to combine table backups into a single file per segment, you cannot perform a parallel restore operation with gprestore
(cannot set --jobs to a value higher than 1).
You cannot use the --exclude-table-file
with --leaf-partition-data
. Although you can specify leaf partition names in a file specified with --exclude-table-file
, gpbackup
ignores the partition names.
Backing up a database with gpbackup
while simultaneously running DDL commands might cause gpbackup
to fail, in order to ensure consistency within the backup set. For example, if a table is dropped after the start of the backup operation, gpbackup
exits and displays the error message ERROR: relation <schema.table>
does not exist.
gpbackup
might fail when a table is dropped during a backup operation due to table locking issues. gpbackup
generates a list of tables to back up and acquires an ACCESS SHARED lock on the tables. If an EXCLUSIVE LOCK
is held on a table, gpbackup
acquires the ACCESS SHARED
lock after the existing lock is released. If the table no longer exists when gpbackup
attempts to acquire a lock on the table, gpbackup
exits with the error message.
For tables that might be dropped during a backup, you can exclude the tables from a backup with a gpbackup
table filtering option such as --exclude-table
or --exclude-schema.
A backup created with gpbackup
can only be restored to a WarehousePG cluster with the same number of segment instances as the source cluster. If you run gpexpand to add segments to the cluster, backups you made before starting the expand cannot be restored after the expansion has completed.
Parent topic: WarehousePG Administrator Guide