After removing and re-adding an Exchange Server to a Database Availability Group (DAG), I wanted to activate a database copy from this Exchange Server and run into the following error.

An Active Manager operation failed. Error: The database action failed. Error: An error occurred while trying to validate the specified database copy for possible activation.

Error:

Database copy ‘Leinfelden’ on Server ‘MAIL’ component (HighAvailability) state is offline. If you need to activate this copy of the database, you can use Set-ServerComponentState -Component ‘HighAvailability’ -State ‘Active’ and retry Move-ActiveMailboxDatabase.


You can check the Component Status on an Exchange Server as follows.


Get-ServerComponentState -Identity <server>


So the components failed to switched to Active State at rejoining the Server to the DAG.


On the second server where the databases are mounted, I will get the following output and looks fine.

ForwardSyncDaemon and ProvisioningRps are by default in on-premises environments Inactive

In order to switch the state back to Active for the HighAvailability component, I can run the following command

Set-ServerComponentState -Identity MAIL -Component HighAvailability -State Active -Requester maintenance


But as in my case all components in state Inactive, I can use the script below to change all states in one step.

The following Script can be used to change all component states to active besides the above two mentioned which should be Inactive by default. The Script will change the states from all Exchange Servers in your organization to Active.
Source: https://www.frankysweb.de/exchange-2016-server-component-states


$ComponentStates = Get-ExchangeServer | Get-ServerComponentState | where {$_.Component -ne "ForwardSyncDaemon" -and $_.Component -ne "ProvisioningRps" -and $_.State -eq "Inactive"}
foreach ($ComponentState in $ComponentStates)
 {
  $LocalStates = $ComponentState.LocalStates | where {$_.State -eq "Inactive"}
  foreach ($LocalState in $LocalStates)
   {
    Set-ServerComponentState -Identity $ComponentState.Identity.Name -Component $LocalState.Component -State Active -Requester $LocalState.Requester
   }
 }



After changing the Component State to Active back, I was able to activate the database copy on this server.



Links

Exchange 2016: Server Component States
https://www.frankysweb.de/exchange-2016-server-component-states

(detailed explained in this post, unfortunately only in german)