Restore Database
Restore Database
(
) is used in the unfortunate (and
unlikely) event that the database has been damaged and needs to be restored from a
backup archive file. This feature allows a convenient way to perform a basic restore
operation using the PostgreSQL built-in pg_restore utility. The recommended
procedure is to do a full restore (Database drop and replace option) along with an
Analyze operation. There are a number of other options and alternative approaches to
restoring a database which are fairly involved and require multistep operations.
These may be best handled using a system administrator interface such as pgAdmin III
or PG Lightning Admin.
The Database Recovery Wizard
Selecting Restore Database opens a wizard page with nine options. Complete and review
these options carefully, then click Finish to start the restore operation.
-
Restore File. The location of the
database archive file to be used in the backup process is entered here. This is
done either by navigating to it with the Browse button (recommended) or manually
typing it into the text window.
-
Restore Engine. The location of
the PostgreSQL restore engine (pg_restore.exe) is entered here, either by
navigating to it with the Browse button of manually typing it into the text
window. This program is part of the PostgreSQL installation and if the JDBC .jar
file has been entered (see Connection Settings), Komo will try to locate it for
you.
-
Delete Utility. As with the
Restore Engine described above, the PostgreSQL database deletion utility
(dropdb.exe) is included in the PostgreSQL installation and its location is
entered here. This program is necessary to delete a corrupted or nonfunctioning
database before a clean backup copy can be installed. If the JDBC .jar file has
been entered (see Connection Settings), Komo will try to locate it for you.
-
Restore Items. Use this option to
select the items to restore. In most cases, the "Database, drop and replace"
selection is best. This will delete the current database and replace it with the
database from the archive file. If the database has already been deleted, then
the "All, create new database first" option would be most appropriate.
CAUTION. Once a database is
deleted it cannot be recovered. Double check all your settings before using
either of these two options. The "All, do not create database" option is useful if
a basic database has already been created using template0. The remaining
options are less likely to be used, as they allow for a limited restore of specific
database elements (either data or the schema). Additional options are
available (see the PostgreSQL documentation) and are best accessed from an
administrator interface.
-
Clean. This option allows
database objects to be deleted before being restored. Note that this option is
not available with the Select Items "Database, drop and replace" and "All,
create new database first" options.
-
Exit on Error. The default
behavior of pg_restore is to count non-fatal errors and warnings during the
restore process and present this tally at the end of the operation. Enabling this
option causes pg_restore to stop when such non-fatal events are encountered.
Note that this option is not available with the Select Items "Database, drop and
replace" and "All, create new database first" options.
-
Verbose. Enabling this option
results in detailed information about the restore operation to be presented
upon completion of the process. This information can be useful, so enabling the
option is recommended.
-
Ignore Version. Enabling this
option causes version warnings to be ignored during the restore operation. This
can be particularly useful when a database is migrated to an updated version of
PostgreSQL. However, problems may occur, particularly with databases that
were developed in older versions of PostgreSQL or when attempting to migrate
newer version tables to an older version of PostgreSQL. Review the relevant
PostgreSQL documentation before enabling this option.
-
Analyze after Restore. This
option causes an Analyze operation to be performed after the restore is
completed. Analyze collects statistics about the database tables that are used
by the query planner and increase the efficiency of PostgreSQL. Enabling this
option is recommended, although it may add some time to the total restore
process. Alternatively, Analyze can be omitted and accessed at a later time
using the Clean Database selection.