gp_restore=>Restores Greenplum databases that were backed up using gp_dump.


gp_restore --gp-k=timestamp_key -d database_name [-i] [-v] [-a |
-s] [-c] [-h hostname] [-p port] [-U username] [-W] [--gp-c]
[--gp-i] [--gp-d=directoryname] [--gp-r=reportfile] [--gp-l=dbid
[, ...]]

gp_restore -? | -h | --help

gp_restore --version

Restoring a Database with gp_restore

The gp_restore utility recreates the data definitions (schema) and user data in a database using the backup files created by a gp_dump operation. To do a restore, you must have:

1.Backup files created by a gp_dump operation.

2.The backup files reside on the segment hosts in the location where gp_dump created them.

3.The Greenplum Database system up and running.

4.A Greenplum Database system with the exact same number of primary segment instances as the system that was backed up using gp_dump.

5.The database you are restoring to is created in the system.

6.If you used the options -s (schema only), -a (data only), --gp-c (compressed), --gp-d (alternate dump file location) when performing the gp_dump operation, you must specify these options when doing the gp_restore as well.

The gp_restore utility performs the following actions:

On the master host

1. Runs the SQL DDL commands in the gp_dump_1_<dbid>_<timestamp> file created by gp_dump to recreate the database schema and objects.

2. Creates a log file in the master data directory named gp_restore_status_1_<dbid>_<timestamp>.

3. gp_restore launches a gp_restore_agent for each segment instance to be restored. gp_restore_agent processes run on the segment hosts and report status back to the gp_restore process running on the master host.

On the segment hosts

1.Restores the user data for each segment instance using the gp_dump_1_<dbid>_<timestamp> files created by gp_dump. Each primary and mirror segment instance on a host is restored.

2. Creates a log file for each segment instance named gp_restore_status_1_<dbid>_<timestamp>.
Note that the 14 digit timestamp is the number that uniquely identifies the backup job to be restored, and is part of the filename for each dump file created by a gp_dump operation. This timestamp must be passed to the gp_restore utility when restoring a database.


The gp_restore utility recreates the data definitions (schema) and user data in a Greenplum database using the script files created by an gp_dump operation. The use of this utility assumes:

The functionality of gp_restore is analogous to PostgreSQL’s pg_restore utility, which restores a database from files created by the database backup process. It issues the commands necessary to reconstruct the database to the state it was in at the time it was saved.

The functionality of gp_restore is modified to accommodate the distributed nature of a Greenplum database, and to use files created by an gp_dump operation. Keep in mind that a database in Greenplum is actually comprised of several PostgreSQL database instances (the master and all segments), each of which must be restored individually. The gp_restore utility takes care of populating each segment in the system with its own distinct portion of data.


Required. The 14 digit timestamp key that uniquely identifies the backup set of data to restore. This timestamp can be found in the gp_dump log file output, as well as at the end of the dump files created by a gp_dump operation. It is of the form YYYYMMDDHHMMSS.

-d database_name | --dbname=dbname
Required. The name of the database to connect to in order to restore the user data. The database(s) you are restoring must exist, gp_restore does not create the

-i | --ignore-version
Ignores a version mismatch between gp_restore and the database server.

-v | --verbose
Specifies verbose mode.

-a | --data-only
Restore only the data, not the schema (data definitions).

-c | --clean
Clean (drop) database objects before recreating them.

-s | --schema-only
Restores only the schema (data definitions), no user data is restored.

-h hostname | --host=hostname
The host name of the Greenplum master host. If not provided, the value of PGHOST or the local host is used.

-p port | --port=port
The Greenplum master port. If not provided, the value of PGPORT or the port number provided at compile time is used.

-U username | --username=username
The database superuser account name, for example gpadmin. If not provided, the value of PGUSER or the current OS user name is used.

-W (force password prompt)
Forces a password prompt. This will happen automatically if the server requires password authentication.

--gp-c (use gunzip)
Use gunzip for inline decompression.

--gp-i (ignore errors)
Specifies that processing should ignore any errors that occur. Use this option to continue restore processing on errors.

Specifies the relative or absolute path to backup files on the hosts. If this is a relative path, it is considered to be relative to the data directory. If not specified, defaults to the data directory of each instance being restored. Use this option if you created your backup files in an alternate location when running gp_dump.

Specifies the full path name where the restore job report file will be placed on the master host. If not specified, defaults to the master data directory.

--gp-l=dbid [, ...] (restore certain segments)
Specifies whether to check for backup files on only the specified active segment instances (followed by a comma-separated list of the segments dbid). The default is
to check for backup files on all active segments, restore the active segments, and then syncronize the mirrors.

-? | -h | --help (help)
Displays the online help.

--version (show utility version)
Displays the version of this utility.


1. Restore an Greenplum database using backup files created by gp_dump:
gp_restore --gp-k=2005103112453 -d gpdb

2. Restore a single segment instance only (by noting the dbid of the segment instance):
gp_restore --gp-k=2005103112453 -d gpdb --gp-s=5

To restore from a backup created by gp_dump
1.Make sure the backup files created by gp_dump reside on the master host and segment hosts for the Greenplum Database system you are restoring.

2.Make sure the database you are restoring to has been created in the system. For example:
$ createdb database_name

3.From the master, run the gp_restore utility. For example (where --gp-k specifies the timestamp key of the backup job and -d specifies the database to connect to):
$ gp_restore -gp-k=2007103112453 -d database_name