Backing Up and Restoring Data

The Microsoft Exchange Server SDK provides functions for backing up and restoring data in the Microsoft Exchange Server directory and information store. These functions perform backups online, which means that there is no need to stop the directory service or information-store service to back up directory or information-store data. Also, backup and restore operations can be performed remotely.

Files Needed to Call the Backup and Restore Functions

Files Purpose
EDBMSG.H Error codes
EDBBCLI.H Header file for the backup/restore functions
EDBBCLI.LIB Static LIB of backup/restore functions
EDBBCLI.DLL Backup/restore entry point DLL

The backup and restore functions provide three types of backup capabilities: full, incremental, and differential.

The following table lists the backup and restore functions and what they are used for.

List of Backup and Restore Functions

Function Purpose
BackupFree Frees memory allocated during one of the backup functions.
HrBackupClose Closes the current file being backed up.
HrBackupEnd Cleans up after a backup operation has been performed.
HrBackupGetBackupLogs Obtains the list of log files to be backed up. These are the only files that need to be backed up for a differential or incremental backup.
HrBackupGetDatabaseNames Returns the list of the attached databases on the remote machine.
HrBackupOpenFile Opens a remote file for backup and will perform whatever client and server side operations to prepare for the backup.
HrBackupPrepare Connects to a remote Microsoft Exchange Server database and prepares it for backup.
HrBackupRead Reads one block from a backup file.
HrBackupTruncateLogs Deletes the committed database log files.
HrRestoreEnd Cleans up after a restore operation has been performed.
HrRestoreGetDatabaseLocations Returns the database locations for the server and service referred to by the handle hbcRestoreContext.
HrRestorePrepare Connects to a remote Microsoft Exchange Server database and prepares it for restore.
HrRestoreRegister Registers a restore operation.
HrRestoreRegisterComplete Completes a restore operation.
HrSetCurrentBackupLog Sets the last log number that was backed up.

The directory and information store consist of the following files:

Because the log files log the changes made to the database, the backup functions use the log files to perform incremental and differential backups. After a full or incremental backup, the log files must be purged (that is, the logs that have been written to the EDB file are deleted) with a call to the HrBackupTruncateLogs function.

The location of the database and log files on a Microsoft Exchange Server computer can be changed dynamically by an administrator. The currently configured paths can be obtained using the HrRestoreGetDatabaseLocations function. For more information, see Backup File Locations.