Rebuild Exchange Content Index

Sometimes happen that Exchange Database Content Index switch from Healthy to Fail. The first behaviors the users experiences is a fail on Search in their Outlook client (even if on Premises and Outlook Web Access).

Usually this fail go unnoticed when everything else is working fine however they will eventually begin to cause problems if you have a Database Availability Group (DAG) in place, for example by preventing database switchovers, thus it’s a good practice to monitor the status.
To achieve monitoring, I’m using a specific powershell sensor when customers have active Monitoring Services (in my case Peassler PRTG), otherwise here you could download an usefull script provided by Paul Cunningham to use as your needs.

DAG: Fix All Failed Content Indexes

To check all indexes status use Get-MailboxDatabaseCopyStatus * | where {$_.ContentIndexState -eq “Failed”}, the output for this commad should be like this:

Get-MailboxDatabaseCopyStatus
Powershell Get-MailboxDatabaseCopyStatus | where {$_.ContentIndexState -eq “Failed”}

Next step we only need to do is pipe the output of that command into the Update-MailboxDatabaseCopy cmdlet with the -CatalogOnly switch to reseed the mailbox database copy (Get-MailboxDatabaseCopyStatus * | where {$_.ContentIndexState -eq “Failed”} | Update-MailboxDatabaseCopy -CatalogOnly).
Wait for the task to complete and check again all index status (remember to wait enought time based on how much lag you had: LastInspectedLogTime)

Powershell Get-MailboxDatabaseCopyStatus | Update-MailboxDatabaseCopy -CatalogOnly
Powershell Get-MailboxDatabaseCopyStatus

No DAG: Fix a Failed Content Index

To check the status we will use the same powershell used in DAG Enviroment: Get-MailboxDatabaseCopyStatus with this output:

Get-MailboxDatabaseCopyStatus
Powershell Get-MailboxDatabaseCopyStatus

We need to stop the search services on the Exchange server before to rebuild a failed content index. This activity may impact searches for other healthy databases and the rebuilding process will also create a significant load on the server.

Stop the following services:

  • Microsoft Exchange Search Host Controller
  • Microsoft Exchange Search

with services.msc or using Powershell stopservice MSExchangeFastSearch and stopservice HostControllerService.

Browse the Database folder (GetMailboxDatabase DB01 | select EdbFilePath if you need to know the path) and rename the folder named with the GUID of the database

GUID Database Index Folder
Database Index Folder

Repeat this operation for all Databases with Unhealthy Content Index State then restart the services using services.msc or even Powershell command: startservice MSExchangeFastSearch and startservice HostControllerService.

The content indexes will be rebuilt, starting with the status of Crawling to Healthy. It could take quite a while to complete depending on the amount of data in the databases.

Get-MailboxDatabaseCopyStatus
Powershell Get-MailboxDatabaseCopyStatus

Leave a Reply

Your email address will not be published. Required fields are marked *

Time limit is exhausted. Please reload the CAPTCHA.