Restore Overview

Topic Last Modified: 2006-06-12

The Exchange Storage Engine (ESE) restore capabilities support restoring from a full backup, and restoring from a full backup with incremental backups.

Restoring databases typically involves three steps.

  1. Load files from the backup storage media into place on the server.
  2. Recover the database using ESE to bring it back up-to-date.
  3. Perform application level fix-up, such as reference count between tables.

The restore environment can be accessed several different ways. HrESERestoreSaveEnvironment() should be called to save a restore session before calling HrESERestoreClose() or HrESERestoreComplete(). On subsequent calls to continue restoring (HrESERestoreReopen()), the restore environment will be loaded automatically. To view the restore data, either HrESERestoreGetEnvironment() or HrESERestoreLoadEnvironment() can be called to return the restore environment. Call HrESERestoreGetEnvironment() for the current restore session, and HrESERestoreLoadEnvironment() for any restore environment.

Restoring from a Full Backup

The following describes a typical scenario for restoring an Exchange Storage Group programmatically from a full backup.

Backup client ESE

Reading from the head of the tape, the client gets a list of databases to restore. This allows the user to pick the databases from the list to be restored.

 

HrESERestoreOpen(). The client can specify a destination directory or can ask the server to do that.

Provide a temporary destination directory for the restore process, if requested. This will be used to store the log and other files that were saved during the backup process, and the restore environment for this particular restore session. If multiple restores will be occurring, then the temporary destination directories must be different.

HrESERestoreAddDatabase() is called multiple times for each database to be restored.

The server will return the destination of the database files (EDB and STM).

Restore the files to the destination specified. A call to HrESERestoreOpenFile() is recommended for all files. Files that do not return the error hrRestoreAtFileLevel will require calls to HrESEWriteFile() and HrESECloseFile() to copy the data. Files that return the error code should be restored at the file system level in the restore directory. (All files that Exchange uses will return the error code.)

 

Restore the log and other files (returned by HrESEBackupGetLogAndPatchFiles()). A call to HrESERestoreOpenFile() is required for all log and other files. This call will fail with the error hrRestoreAtFileLevel, but the call is needed to build log sequence information.

 

HrESERestoreSaveEnvironment() will save the restore environment (database mapping, log range, and so on) into a file in the restore directory.

 

HrESERestoreComplete()

All the needed files are restored and the restore environment is saved. The server can start recovery.

HrESERestoreClose()

 

Restoring from Full and Incremental Backups

The following describes a typical scenario for restoring an Exchange Storage Group programmatically from a full backup with an incremental backup.

Backup client ESE

By reading from the head of the tape, the client gets a list of databases to restore. This allows the user to pick the databases from the list to be restored.

HrESERestoreOpen(). The client can specify a destination directory or can ask the server to do that.

Provide a temporary destination directory for the restore process, if requested. This will be used to store the log and other files, and the restore environment for this particular restore session. If multiple restores will be occurring, then the temporary destination directories must be different.

HrESERestoreAddDatabase() is called multiple times for each database to be to be restored

The server will return the destination of the database files (EDB and STM).

Restore the files to the destination specified. A call to HrESERestoreOpenFile() is recommended for all files. Files that do not return the error hrRestoreAtFileLevel will require calls to HrESEWriteFile() and HrESECloseFile() to copy the data. Files that return the error code should be restored at the file system level in the restore directory. (Most ESE known files will return the error code.)

Restore the log and other files (returned by HrESEBackupGetLogAndPatchFiles()). A call to HrESERestoreOpenFile() is required for all log and other files. This call will fail with the error hrRestoreAtFileLevel, but the call is needed to build log sequence information.

HrESERestoreSaveEnvironment() will save the restore environment (database mapping, log range, and so on) into a file in the restore directory.

HrESERestoreClose()

HrESERestoreReopen()

The backup client is reopening a restore process; the restore environment is specified using the restore directory provided as parameter to the callback.

Restore the log and other files (returned by HrESEBackupGetLogAndPatchFiles()). A call to HrESERestoreOpenFile() is required for all log and other files. This call will fail with the error hrRestoreAtFileLevel, but the call is needed to build log sequence information.

HrESERestoreSaveEnvironment() will save the restore environment (database mapping, log range, and so on) with the new information.

HrESERestoreComplete()

All the needed files are restored and the restore environment is saved. The server can start recovery.

HrESERestoreClose()