Database recovery

The -R option controls the recovery actions QDB performs when it encounters a missing or corrupt database file. The options are:
File manipulation is fully automatic and a best effort is always made to establish a valid database connection at startup. Files are backed up individually and restored individually.
A corrupt or missing database file is restored from the most recent valid backup that can be located. If there's no such backup, a blank database is recreated from the original schema definition.
The only action performed is to create a blank database from the original schema definition if the database file is missing at startup. Databases are not restored from backups. If the file is corrupt, the server will not start. If the file is missing or corrupt at runtime, no access to that database is permitted and it will not be restored or recreated. This mode is intended to allow the creation of a new system or to give manual control over error recovery (e.g., to preserve the corrupt database for later analysis).
Backups of attached databases are treated as a coherent set, so an error with any of the component databases causes QDB to restore a complete and matching set of all database files. This is useful if attached databases refer to each other.
The set master is the database that attaches other databases (by using the AutoAttach option in the configuration object). The backup set contains the set master and all attached databases that have BackupAttached enabled. Note that the set master can be backed up incrementally and still belong to the set.
We recommend the following actions to back up and restore your databases as a coherent set:
  • For the set master database, in the database configuration object:
    • In the AutoAttach option, list all the databases you want to attach. For example:
    • In the BackupAttached option, list all dependant databases. For example:
  • Use the -R set option when starting qdb.
  • When doing backups, call qdb_backup() on the set master with the scope argument set to QDB_ATTACH_DEFAULT.