Exchange 2010 / Exchange 2013 – Determining the repair count of a database.

On the EHLO blog we recently announced a support change for databases that have been repaired.  The updated policy can be found here - https://aka.ms/m6o4vl.

 

A question that has been asked after reading this policy is whether or not the repair count can be determined while the database is online.  The answer is – it depends.  Get-MailboxDatabase –status does not currently support returning the repair count of a database.  We are currently exploring options in Exchange 2013 of adding this functionality to get-mailboxDatabase.  In the meantime – how can an administrator determine the database repair count?  For the purposes of this blog we will be focusing on Exchange 2010 and newer.  If you are still on a version of Exchange less than Exchange 2010 you probably need to be less worried about the repair count on your database and more focused on getting that migration done.

 

Our preferred method of checking the repair count would be to suspend a passive copy of a database in a database availability group and perform the eseutil /mh operation.  When a passive copy is suspended log replay stops and active locks against the database are released allowing this to work. 

 

suspend-mailboxDatabaseCopy –identity <DBNAME>\<SERVERNAME>

 

For example:  Suspend-MailboxDatabaseCopy DAG-DB0\MBX-1

 

Using get-mailboxdatabasecopystatus we can verify the database is successfully suspended. 

 

[PS] C:\>Get-MailboxDatabaseCopyStatus DAG-DB0\MBX-1

Name Status CopyQueue ReplayQueue LastInspectedLogTime ContentIndex
Length Length State
---- ------ --------- ----------- -------------------- ------------
DAG-DB0\MBX-1 Suspended 0 0 5/6/2015 12:54:27 PM Suspended

 

With the database suspended and locks released an administrative command prompt can be utilized to dump the header of the database with eseutil. 

 

PS C:\ExchangeDatabases\DAG-DB0\DAG-DB0.db> eseutil /mh .\DAG-DB0.edb

 

Extensible Storage Engine Utilities for Microsoft(R) Exchange Server
Version 15.00
Copyright (C) Microsoft Corporation. All Rights Reserved.

Initiating FILE DUMP mode...
Database: .\DAG-DB0.edb

……

    Repair Count: 0
Repair Date: 00/00/1900 00:00:00.000
Old Repair Count: 0

……

  Last checksum finish Date: 04/28/2015 11:21:24.442
Current checksum start Date: 00/00/1900 00:00:00.000
Current checksum page: 0

Operation completed successfully in 0.125 seconds.

 

When this operation is completed the database can be resumed with resume-mailboxdatabasecopy and validated with get-mailboxdatabasecopystatus.

 

Resume-MailboxDatabaseCopy DAG-DB0\MBX-1

 

[PS] C:\>Get-MailboxDatabaseCopyStatus DAG-DB0\MBX-1

Name Status CopyQueue ReplayQueue LastInspectedLogTime ContentIndex
Length Length State
---- ------ --------- ----------- -------------------- ------------
DAG-DB0\MBX-1 Healthy 0 0 5/6/2015 1:29:31 PM Healthy

 

Bonus:  If using Exchange 2007 with cluster continuous replication (CCR) you should be able to use a very similar process.

 

What happens when I have only a single copy database – for example public folder databases or in single server shops.  Fear not – there is a way to do this without dismounting the database.  The ESEUTIL command has been extended with a function /vss.  The /vss extension invokes a VSS copy of the database file and then performs the specified eseutil command.  This can be used against any active or passive database copy without dismounting or suspending.

 

In this example DAG-DB3 is mounted on server MBX-1. 

 

[PS] C:\>Get-MailboxDatabaseCopyStatus DAG-DB2\MBX-1

Name Status CopyQueue ReplayQueue LastInspectedLogTime ContentIndex
Length Length State
---- ------ --------- ----------- -------------------- ------------
DAG-DB2\MBX-1 Mounted 0 0 Healthy

 

Using an administrative command prompt and navigating to the database directory the eseutil command is issued.

 

PS C:\ExchangeDatabases\DAG-DB3\DAG-DB3.db> eseutil /mh /vss .\DAG-DB3.edb

Extensible Storage Engine Utilities for Microsoft(R) Exchange Server
Version 15.00
Copyright (C) Microsoft Corporation. All Rights Reserved.

Initializing VSS subsystem...

Initiating FILE DUMP mode...
Database: \\?\GLOBALROOT\Device\HarddiskVolumeShadowCopy283\DAG-DB3.db\DAG-DB3.edb

DATABASE HEADER:
Checksum Information:
Expected Checksum: 0x3d36a729
Actual Checksum: 0x3d36a72

……

    Repair Count: 0
Repair Date: 00/00/1900 00:00:00.000
Old Repair Count: 0

……

  Last checksum finish Date: 04/30/2015 22:37:58.860
Current checksum start Date: 00/00/1900 00:00:00.000
Current checksum page: 0

Operation completed successfully in 2.516 seconds.

 

The passive database copy for DAG-DB2 resides on MBX-2

 

[PS] C:\>Get-MailboxDatabaseCopyStatus DAG-DB2\MBX-2

Name Status CopyQueue ReplayQueue LastInspectedLogTime ContentIndex
Length Length State
---- ------ --------- ----------- -------------------- ------------
DAG-DB2\MBX-2 Healthy 0 0 5/6/2015 2:06:10 PM Healthy

 

Using an administrative command prompt and navigating to the database directory the eseutil command is issued.

 

PS C:\ExchangeDatabases\DAG-DB3\DAG-DB3.db> eseutil /mh /vss .\DAG-DB3.edb

Extensible Storage Engine Utilities for Microsoft(R) Exchange Server
Version 15.00
Copyright (C) Microsoft Corporation. All Rights Reserved.

Initializing VSS subsystem...

Initiating FILE DUMP mode...
Database: \\?\GLOBALROOT\Device\HarddiskVolumeShadowCopy127\DAG-DB3.db\DAG-DB3.edb

DATABASE HEADER:
Checksum Information:
Expected Checksum: 0x3b39abb6
Actual Checksum: 0x3b39abb6

……

    Repair Count: 0
Repair Date: 00/00/1900 00:00:00.000
Old Repair Count: 0

……

  Last checksum finish Date: 02/11/2015 05:55:51.971
Current checksum start Date: 03/11/2015 05:10:50.540
Current checksum page: 297568

Operation completed successfully in 2.172 seconds.

 

The ESEUTIL /vss option is an excellent method to determine the repair count without taking your database offline.

 

What if you are running Exchange 2007 or older?  Unfortunately you will have to dismount your databases to make this determination.