다음을 통해 공유


ErrCheckLogs Function (CHKSGFILES)

Topic Last Modified: 2006-12-01

The ErrCheckLogs() function validates the log files of the database files that were specified to ErrInit(). The logs validated are those that exist in the path, and that have the three-letter base log file name passed to ErrInit().

Syntax

Vitual ERR ErrCheckLogs
(
        BOOL * const pfOnlyUnnecessaryLogsCorrup,
    Const ULONG ulFlags = NO_FLAGS
);

Parameters

  • pfOnlyUnnecessaryLogsCorrupt
    Output parameter. Indicates when TRUE that errors were found in the transaction log files. However, those errors were all found in log filtes that are not needed to bring the database to a clean-shutdown state without data loss. A TRUE value returned in this parameter is only valued when ErrCheckLogs() returns errSuccess.
  • ulFlags
    Optional input parameter. This value is reserved for future use. The value passed should be zero.

Return Value

This function returns an error code from the ERR Enum (CHKSGFILES).

It is important to remember that this function can return errSuccess even when errors are found in the log files. For this reason, when ErrCheckLogs() returns errSuccess, the application should also check the pfOnlyUnnecessaryLogsCorrupt return parameter. If pfOnlyUnnecessaryLogsCorrupts is TRUE when ErrCheckLogs() returns errSuccess, this indicates that one or more errors were found, but only in log files not needed to bring the database up-to-date.

Remarks

ErrCheckDbHeaders() must be called before this function can be called.

When checking Exchange database transaction log files, some of the log files will be necessary in order to bring the databases in the storage group to a clean-shutdown state without data loss, while other log files might not be needed. The ErrCheckLogs() function determines both the oldest and the newest log files that will be needed to bring the databases up to date.

The ErrCheckLogs() function verifies all the log files in the specified paths that also have the specified three-letter base name, as passed to ErrInit().

If no errors are found in the log files, ErrCheckLogs() returns errSuccess.

If corruption is detected in any of the needed log files, ErrCheckLogs() returns an error.

If errors are only found in log files that are older than the earliest ones needed, the function returns errSuccess and sets the return parameter pfOnlyUnnecessaryLogCorrupt to TRUE. The application should recognize that there are errors in some of those old log files, and possibly alert the user, but also realize that those errors should not affect the overall integrity of the database nor affect whether playing the logs forward will succeed.

If errors are found in any log file created after the earliest log that ErrCheckLogs() determines is needed, the function returns an error. The error will be returned even if the error is found in a log file that was generated later than what is needed to bring the database up-to-date. Although it would be possible to bring the databases to a clean-shutdown state using the identified log files, transactions indicated in the later corrupted log files would not be applied, resulting in data loss when the database was restored.

The CChkSGFiles instance tracks whether all the log files registered with ErrInit() were actually checked. If all the logs were not successfully checked, the ErrTerm() function will return an error.

Requirements

When calling this API on a computer where the Exchange Server 2007 Administrative Tools role is installed on Microsoft Windows XP, use the 32-bit version of this API.

When calling this API on a computer when Exchange Server 2007 is installed on a 64-bit version of Windows, use the 64-bit version of this API.

The account that the application is running under must have read access permissions to the database and log files to be checked.