Restoring a Database Using gpdbrestore
The gpdbrestore
requires one of the following options to identify the backup set to restore:
-t timestamp
– restore the backup with the specified timestamp.-b YYYYYMMDD
– restore dump files for the specified date in thedb_dumps
subdirectories on the segment data directories.- – restore the backup set located in the specified directory of a remote host.
To restore an incremental backup, you need a complete set of backup files—a full backup and any required incremental backups. You can use the --list-backups
option to list the full and incremental backup sets required for an incremental backup specified by timestamp. For example:
You can restore a backup to a different database using the --redirect <database>
option. The database is created if it does not exist. The following example restores the most recent backup of the mydb
database to a new database named mydb_snapshot
:
$ gpdbrestore -s grants --redirect grants_snapshot
You can restore a backup saved on a host outside of the Greenplum cluster using the -R
option. Although the Greenplum Database software does not have to be installed on the remote host, the remote host must have a account configured with passwordless ssh access to all hosts in the Greenplum cluster. This is required because each segment host will use scp to copy its segment backup file from the archive host. See gpssh-exkeys
in the Greenplum Database Utility Guide for help adding the remote host to the cluster.
This procedure assumes that the backup set was moved off the Greenplum array to another host in the network.
Ensure that the archive host is reachable from the Greenplum master host:
Ensure that you can ping the master host from the archive host:
Ensure that the restore’s target database exists. For example:
From the master, run the
gpdbrestore
utility. The-R
option specifies the host name and path to a complete backup set:
Parent topic: