Backup Overview
Topic Last Modified: 2006-06-12
The backup applications use the following application programming interfaces (APIs) to back up a set of databases and their corresponding log files. The Backup/Restore client receives the list of servers and applications to back up by calling the hrESEBackupRestoreGetNodes and hrESEBackupRestoreGetRegistered functions. To back up the data, the client performs the following call sequence.
Backup Sequence of Events
The following describes a typical scenario for backing up a Microsoft® Exchange database programmatically.
- Call HrESEBackupRestoreGetNodes to retrieve the list of servers.
- Call HrESEBackupPrepare to establish a remote procedure call (RPC) to the server application, and get information about the databases. The client will connect to the server and specify which service it is going to back up (for example, "Microsoft Information Store"). The server will return the number of instances of the Exchange Storage Engine (ESE) that are running on the server and a pointer to structures for each one. The structure will contain the:
- ESE instance identifier (ID)
- Name of the instance (storage group)
- Number of databases in this instance
- Database GUIDs
- Icon information
- Call HrESEBackupSetup to tell the server which instance to back up. None of the databases in the ESE instance can be mounted or unmounted during the backup. The client passes in the:
- ESE instance ID
- Type of backup
- Call HrESEBackupOpenFile to open the database for reading.
- Call HrESEBackupReadFile to read the database.
- Call HrESEBackupCloseFile to close the database.
- Repeat Steps 4 through 7 until all database files are read for each database that will be backed up. For databases with an STM file, such as the information store, both files must be backed up separately in two different open/read/close sequences.
- Call HrESEBackupGetLogAndPatchFiles to get a list of log file names and other file names.
- Call HrESEBackupOpenFile to open the file for reading.
- Call HrESEBackupReadFile to read the file.
- Call HrESEBackupCloseFile to close the file.
- Repeat Steps 9 through 12 until all log and other files are read.
- If the user wants the log files that will be truncated, HrESEBackupGetTruncateLogFiles will return the files that will be deleted by calling HrESEBackupTruncateLog.
- Call HrESEBackupTruncateLog to delete logs after backup.
- Call HrESEBackupInstanceEnd to end the backup for the instance.
- Call HrESEBackupEnd to disconnect from the server application.
Note
The backup API is based on storage groups. Currently, only one backup per storage group is allowed at one time. There may be backups of different storage groups occurring at the same time, but only one database in a storage groups may be backed up at a time.
Allowing a multiple storage group backups at the same time will help speed backup. To back up multiple storage groups in parallel, the backup application will be required to open multiple backup sessions. To restore multiple instances in parallel also requires multiple sessions. For a multi-instance restore, the server must have an additional ESE instances available for each restore instance. The store.exe process in Exchange 2000 can have at most four storage groups mounted at a time while clients are accessing databases in those four instances. However, ESE supports up to 16 instances on a server. The additional 12 instances may be used for restore only. Consider a server with four storage groups and four databases in each storage group. The entire server can be restored at the same time. The databases are copied to the correct location and the log files are all copied to their temporary directories.
Note that recovery can only be performed at the storage group level. In the preceding example, each database in a storage group would have to run through recovery sequentially.