Recovering from a Backup

Catastrophic Recovery

If you used standard Berkeley DB backup procedures to backup your database, then you can restore your database using the procedures described in this section.

Note that Berkeley DB supports two types of recovery:

Catastrophic Recovery

Use catastrophic recovery when you are recovering your database from a previously created backup. Note that to restore your database from a previous backup, you should copy the backup to a new environment directory, and then run catastrophic recovery. Failure to do so can lead to the internal database structures being out of sync with your log files.

To run catastrophic recovery:

  • Shutdown all database operations.

  • Restore the backup to an empty directory. This means you need your database file, as well as the -journal directory, and any available log files that the backup contains.

    Note that the backup database file and the journal directory must have the same name as the database and journal directory that you are restoring. You can put the backup in a different location on disk, but the name of the file and directory must remain the same.

  • Make sure that a DB_CONFIG file exists in the journal directory that you are using to restore your database. This file must contain a the following line:

    set_data_dir ..
  • Run the db_recover command line utility with the -c option.

Note that catastrophic recovery examines every available log file — not just those log files created since the last checkpoint as is the case for normal recovery. For this reason, catastrophic recovery is likely to take longer than does normal recovery.