HrESERestoreComplete Function

Topic Last Modified: 2007-11-09

The HrESERestoreComplete function informs the Exchange Storage Engine (ESE) application that the database files have been restored, and that the application can now recover the files. Microsoft® Exchange Server 2007 will then attempt to recover the databases and bring them to a consistent state.

Applies To

ESEbcli2 DLL Functions Interface

Syntax

HRESULT HrESERestoreComplete
(
        HCCX phccxRestoreContext,
        wchar* wszCheckpointFilePath,
        wchar* wszLogFilePath,
        wchar* wszTargetInstanceName,
        unsigned long fFlags
);

Parameters

  • phccxRestoreContext
    Input parameter. A handle to a restore context. The handle is passed to the various restore functions, and contains information about the current restore operations.
  • wszCheckpointFilePath
    Input parameter. The path to the temporary location of the checkpoint files that the ESE uses during recovery. This is usually the same as the wszLogFilePath.
  • wszLogFilePath
    Input parameter. The path to the temporary location of the log files that the ESE uses during recovery. This is the location where the restored log files were placed. This is usually the same as the wszCheckpointFilePath.
  • wszTargetInstanceName
    Input parameter. The name of a running instance of the ESE. This instance is used in the recover process to locate any additional log files that were created after the backup was performed. Those additional log files must be played back after the restored log files to bring the database up-to-date.
  • fFlags
    Input parameter. Bit-mapped flags specifying optional operations for the database recovery. The flags can be any combination of the following: ESE_RESTORE_COMPLETE_NOWAIT (0x00010000), ESE_RESTORE_COMPLETE_ATTACH_DBS (0x00000001), and ESE_RESTORE_KEEP_LOG_FILES (0x00020000).

Return Value

The following return codes can be returned. To retrieve the error string for an ESE error, use the standard FormatMessage function. For the general errors hrErrorFromESECall and hrErrorFromCallbackCall, more information about the error is available using the standard GetLastError function.

S_OK

Success

ESE-specific error codes

ESE-specific error codes, as defined in esebkmsg.h.

Other

Other Microsoft Win32® or remote procedure call (RPC) errors.

Remarks

The fFlags parameter specifies the following actions for the ESE to take after recovering the database:

  • ESE_RESTORE_COMPLETE_ATTACH_DBS (0x00000001) specifies that the ESE mount the database after recover completes.
  • ESE_RESTORE_COMPLETE_NOWAIT (0x00010000) specifies that the ESE should return from this function call immediately. When this flag is not provided, the function will not return until the recovery has been completed. When this flag is present, the recovery will be started asynchronous to the application.
  • ESE_RESTORE_KEEP_LOG_FILES (0x00020000) specifies that the unneeded log files be retained on the server. When this flag is not provided, unneeded log files will be deleted after database recovery has completed. When this flag is provided, the log files are not deleted.

The ESE saves the locations passed to this function in the wszCheckpointFilePath, wszLogFilePath and wszTargetInstanceName in the restore environment. The values are retried by the ESE when recovery begins.

When restoring via the HRESERestoreComplete with fFlags ESE_RESTORE_COMPLETE_ATTACH_DBS the databases are mounted, but the resources are not set to the online state for the SCC and CCR. The databases will be accessible at that time, but the corresponding cluster resource state will be offline. To bring the cluster resource online, mount the database.

Applications that use this function must be run under a user account having Microsoft Windows® server operating systems Backup and Restore privileges.