Hot backups should be your first choice of backup when your live database is corrupted. To restore a hot backup, follow these steps:
Identify any log files that were unapplied or open for writing in the corrupted live database directory.
Close the log that was open for writing. It contains the most recent transactions.
Create a new (recovery) directory.
Copy the current hot backup copy into the new recovery database directory.
Copy the log.* files from your corrupted live database directory into your new recovery database directory.
If you are keeping an archive copy of the database, copy the logs that had not been applied to the live database into the archive directory, so your archive backup copy will be complete.
Run db_recover with the -c -h options specified against the new recovery database.
For example, if your new recovery directory is called recoverydb, then the command would be as follows:
db_recover -c -h recoverydb
Leave the log.* files in the new recovery directory.
The db_recover program applied the log files to the new recovery databases, but starting with version 42, the Berkeley DB expects them to remain.
Run db_verify against the database files in the new recovery directory.
For instructions, see To Check for Calendar Database Corruption.
Run csdb -v list against the new recovery directory.
If the new recovery directory passed all three preceding recovery steps, replace the old corrupted live database with the new recovery database.
Copy the new live database into your hot backup directory to function as the new snapshot.
All new logs will be applied to this copy until the next regular snapshot is taken.
Start Calendar Server.
If the new recovery directory failed any of the steps, identify an uncorrupted older hot backup as follows:
Working backward through your hot backups, find the most recent copy that is not corrupted by running db_verify and csdb -v list on each in turn.
The first hot backup copy that passes can be restored to your live database directory.
If none of your hot backups work and you do not have archive backups to try, call technical support. If you do have archive backups, follow the procedure that followsTo Restore an Archive Backup. (See also, Before You Restore.)