Database Restore (PostgreSQL)

From DBArtisan
Jump to: navigation, search

Go Up to Database Recover/Restore

This wizard lets you generate and submit a pg_restore utility operation, restoring one or more tables or views of a database from a previous backup.

Note: For information on generating a pg_dump backup script, see Database Backup (PostgreSQL).

To restore a database from backup

  1. Connect to the datasource where the database to be restored is located and ensure that it is the currently selected datasource. For details, see Connected/Selected Datasource options.
  2. Select Utilities > Database Restore to open the Restore Wizard.
  3. Use the following table as a guide to performing tasks as you pass through the wizard panels:
Panel Option Description

Playback

New Backup Operation

Select to define a new backup operation.

Previous Backup Operation

Lets you specify a previously saved operation.

Datasource and Input options

What are the destination datasource and database

Lets you specify the specific datasource and database where the tables and views in the backup script are to be restored..

Specify the format for the data file(s) to be generated

Lets you specify a -F (--format) archive format option of Custom or Tar or Directory.

Number of jobs

Lets you provide a --j (--jobs) option value, specifing that the most time-consuming parts of the restore run as separate, concurrent jobs.

Rolename

Lets you provide a --role option value, specify the role used to perform the restore.

Files

Specify the data input file to be restored, Specify a path for the message file to be generated, and Do you wish to re-use this restore operation

These settings lets you select the archive file used for the restore, specify the paths for the message file, and specify the path for the optional file that lets you reuse the current backup operation.

Options

Sections

Lets you provide one or more --section option values ( Pre-data. Data, Post-data) specifying that the selected sections are restored.

Type of Objects

Only data - corresponds to a -a (--data-only) option, specifying that only data be restored. Only schema - corresponds to a -s (--schema-only) option, specifying that only object definitions be restored.

Don’t save

Owner- corresponds to a -O (--no-owner) option, specifying no output commands to set ownership of objects to match the original database. Privilege - corresponds to a -X (--no-privileges) option, preventing restoration of access privileges. Tablespace - corresponds to a --no-tablespaces) option, specifying no output commands to select tablespaces.

Queries

Include CREATE DATABASE statement - corresponds to a -C (--create) option, specifying that the database be created before restoring into it. Clean before restore - corresponds to a -C (--clean) option, specifying that the commands to drop objects are specified before commands to create them.. Use Column Inserts - corresponds to a --column-inserts option, specifying that data is dumped as INSERT commands with explicit column names Single transaction - corresponds to a -1 (--single-transaction) option, specifying that the restore be executed as a single transaction.

Miscellaneous

Use SET SESSION AUTHORIZATION - corresponds to a --use-set-session-authorization option, specifying that object ownership is determined using SET SESSION AUTHORIZATION commands instead of ALTER OWNER commands. Exit on error - corresponds to a --exit-on-erroroption, specifying that the restore is aborted if an error is encountered. Verbose messages - corresponds to a --verbose option, specifying that verbose mode be used.

Objects

Use the object list to select each specific object that is to be restored. The Schema dropdown can be used to reduce the number of objects displayed to only those objects within a selected schema.

Summary

Provides a short summary of the dump operation options.

4. Finally, use the Finish button to perform the backup.