RESTORE(1) | General Commands Manual | RESTORE(1)

# NAME

`restore` —
recover an INGRES database after a crash

# SYNOPSIS

`restore` | [`-a`] [`-f`] [`-p`] [`-s`] [`-+-w`] [database ...]

# DESCRIPTION

The `restore` utility is used to restore a database after an INGRES or system crash. It should always be run after any abnormal termination to ensure the integrity of the database.

In order to run `restore`, the user must be the DBA for the database being restored, or be the INGRES superuser and specify the `-s` flag.

If no databases are specified, all databases for which the current user is the DBA are restored. All databases will be restored if the INGRES superuser has specified the `-s` flag.

If there were no errors while restoring a database, purge(1) will be called (with the same flags that were given to `restore`) to remove unwanted files and system temporaries.

The `restore` utility can recover a database from an update which had finished filling the batch file. Updates which did not make it to this stage should be rerun. Similarly, modifies which have finished recreating the relation will be completed (the relation and attribute relations will be updated). If a destroy was in progress, it will be carried to completion, while a create will almost always be backed out.

The `restore` utility locks the database while it is being processed.

The options are as follows:

`-a`
  Ask before taking any serious actions. It is advisable to use this flag if the database is suspected to be in bad shape. Using /dev/null as input with the `-a` flag will provide a report of problems in the database without making any changes.
`-f`
  Pass the `-f` flag to purge(1) to delete unrecognizable files. In the case of an incomplete destroy, create, or index, `restore` will not delete files for partially created or destroyed relations; purge(1) must be called with the `-f` flag to accomplish this.
`-p`
  Pass the `-p` flag to purge(1) to delete expired user relations.
`-s`
  Allow the INGRES superuser to restore any database.
`-+-w`
  Control database wait behavior. If `-w` is set, `restore` will not wait for a busy database regardless of standard input. If `+w` is set, it will always wait. If a database is busy and waiting is not enabled, `restore` will report it and go on to the next database. If standard input is not a terminal, `restore` will wait for the database to be free by default.

If an interrupt signal is received, the current database is closed and the next one, if any, is processed. A quit signal will cause `restore` to terminate.

# EXAMPLES

`restore -f demo`
`restore -a grants < /dev/null`

# DIAGNOSTICS

All diagnostics are followed by a tuple from a system relation.

relation for attribute(s)
  The listed attributes have no corresponding entry in the relation relation.
primary relation for index
  The tuple is for a secondary index for which there is no primary relation. The secondary will be destroyed.
indexes entry for primary relation
  The tuple is for a primary relation whose relindxd domain will be set to zero. This is the product of an incomplete destroy.
indexes entry for index
  The tuple is for a secondary index which will be destroyed. This is the product of an incomplete destroy.
relname is index for
  An index has been found for a primary which is not marked as indexed. The primary will be so marked. This is probably the product of an incomplete index command.
file for
  There is no data for this relation tuple; the tuple will be deleted.
secondary index for indexes entry
  An entry has been found in the indexes relation for which the secondary index does not exist. The entry will be deleted.

# SEE ALSO

purge(1), sysmod(1)

# BUGS

If no database names are given, only the databases located in the data/base directory are restored, and not old databases in the datadir directory. Explicit database names still work for databases in either directory.

# HISTORY

Originally part of UC Berkeley INGRES 8.9 (1988).

March 28, 2026 | NetBSD 10.1_STABLE