Skip to Content

Solved: How do I use Restore-DatabaseAvailabilityGroup to recover member servers in DAG?

Restore-DatabaseAvailabilityGroup is an Exchange Server PowerShell cmdlet used to activate a DAG member server in a cluster when it goes down after the Quorum. In this article, we have discussed how to use the Restore-DatabaseAvailabilityGroup cmdlet to recover member servers in a Database Availability Group (DAG).

Exchange Database Availability Group (DAG) provides automatic database-level recovery from database, server, or network failure. It replicates the mailbox database across all member servers and maintains the Quorum. If the Quorum is lost due to one or more failed or offline member servers for an extended time, the DAG may fail to provide any protection that can lead to a disaster. However, you can use the Restore-DatabaseAvailabilityGroup PowerShell cmdlet to restore the DAG functionality.

This article discusses how to use the Restore-DatabaseAvailabilityGroup cmdlet for Exchange disaster recovery when the Quorum is lost.

Content Summary

What is Quorum?
How ‘Restore-DatabaseAvailabilityGroup’ Restores Quorum?
Steps to Use Restore-DatabaseAvailabilityGroup Cmdlet
Conclusion

What is Quorum?

Quorum refers to the minimum number of member servers required at any given time for the normal functioning of a Database Availability Group (DAG):. It ensures at least one member server is always functioning at a time.

Quorum is most important as it helps ensure the following:

  • Exchange DAG consistency.
  • Cluster responsiveness.
  • Acts as a ‘Tie-Breaker’ to avoid partitioning.

Exchange Server 2010 and later versions support the following Quorum models:

  • Node Majority for DAG with an odd number of member servers.
  • File Share Majority for even number of member servers.

Both employ a witness server that acts as a tie-breaker. To learn more about Quorum and its importance in DAG, refer to this Microsoft documentation.

How ‘Restore-DatabaseAvailabilityGroup’ Restores Quorum?

The Restore-DatabaseAvailabilityGroup cmdlet helps restore lost Quorum by performing the following operations that affect the structure and membership of the DAG cluster.

  • It evicts the servers listed on the StoppedMailboxServers list forcibly from the DAG’s cluster. This re-establishes the Quorum for the cluster and enables the surviving DAG members to start and provide service.
  • If there is an even number of surviving DAG members or a single surviving DAG member, it configures the DAG to use the alternate witness server.

Steps to Use Restore-DatabaseAvailabilityGroup Cmdlet

Follow the steps discussed below to learn how to use the Restore-DatabaseAvailabilityGroup cmdlet.

Step 1: Assign Roles and Permissions

Before using the Restore-DatabaseAvailabilityGroup cmdlet for disaster recovery to restore the DAG cluster, you must have the right roles and permissions assigned to your username. To use this particular cmdlet, you must have the Disaster Recovery role assigned to your user account. To assign this role, open EAC, go to Permissions > admin roles, and assign the Disaster Recovery role under Organization Management.

Assign disaster recovery role under organization management exchange server

You may also assign the Disaster Recovery role to your account by using the following PowerShell cmdlet in Exchange Management Shell (EMS).

New-ManagementRoleAssignment -Role "Disaster Recovery" -User administrator

PowerShell cmdlet to assign disaster recovery role permission to a user

This command will assign the required Disaster Recovery role to the administrator.

Step 2: Activate DAG Member Servers

Using the Restore-DatabaseAvailabilityGroup, you can manually activate a DAG member server if the automatic failover fails due to the Quorum loss. For this, you also need to set alternate Witness Server and Witness Directory using the Set-DatabaseAvailabilityGroup cmdlet.

Set-DatabaseAvailabilityGroup -Identity DAG01 -AlternateWitnessDirectory -AlternateWitnessServer

For instance,

Set-DatabaseAvailabilityGroup -Identity DAG01 -AlternateWitnessDirectory D:\DAG01 -AlternateWitnessServer WS03

Once the AlternateWitnessDirectory and AlternateWitnessServer are set, you can execute the Restore-DatabaseAvailabilityGroup to activate the member servers in DAG01.

Restore-DatabaseAvailabilityGroup -Identity DAG1 -ActiveDirectorySite US

You may use the AlternateWitnessDirectory and AlternateWitnessServer parameters with the Restore-DatabaseAvailabilityGroup cmdlet if you don’t want to use the Set-DatabaseAvailabilityGroup cmdlet.

Restore-DatabaseAvailabilityGroup -Identity DAG01 -ActiveDirectorySite US -AlternateWitnessDirectory D:\DAG01 -AlternateWitnessServer WS03

Confirm by entering Y followed by pressing the Enter key. You may also use the -Confirm:$false parameter to execute the command without a confirmation prompt.

Important Note: The Restore-DatabaseAvailabilityGroup cmdlet works only in Exchange Server 2010 (SP1 and later), Exchange Server 2013, Exchange Server 2016, and Exchange Server 2019.

The parameters used with Restore-DatabaseAvailabilityGroup are as follows:

-Identity

Specifies the DAG server identity or name.

-ActiveDirectorySite

Specifies the location or site containing the DAG member server you want to restore.

-AlternateWitnessDirectory

Specifies the alternate directory name that is storing a copy of witness data. You can use this parameter with the Set-DatabaseAvailabilityGroup cmdlet to set the directory directly or with Restore-DatabaseAvailabilityGroup.

-AlternateWitnessServer

Specifies the new witness server name that will be a part of the DAG after the activation process. You may use this parameter with the Set-DatabaseAvailabilityGroup cmdlet to set the witness server ahead of Restore-DatabaseAvailabilityGroup.

There are a few other notable parameters that you can use with the Restore-DatabaseAvailabilityGroup cmdlet.

-DomainController

The parameter specifies the domain controller to read or write the data to Active Directory. You must specify the domain controller by its fully qualified domain name (FQDN). For instance, dag01.abc.com.

-UsePrimaryWitnessServer

The parameter specifies and uses the currently configured Witness Server for the DAG to activate the member server.

-WhatIf

The –WhatIf switch simulates the command action. You can use it with any of the commands to check what would happen when you run the command without actually applying the changes.

Conclusion

If the Restore-DatabaseAvailabilityGroup cmdlet fails to restore your DAG or subset of the cluster member, you can use a third-party Exchange recovery software, such as Stellar Repair for Exchange. The software can help extract the mailboxes and items from the failed Exchange DAG member server or corrupt Exchange mailbox database to PST files. You may also set up a new Exchange DAG member server and export the recovered mailboxes directly to this new server database. Further, you can also export the mailboxes to Office 365 tenant.

Tags

Tags

    Ads Blocker Image Powered by Code Help Pro

    Ads Blocker Detected!!!

    This site depends on revenue from ad impressions to survive. If you find this site valuable, please consider disabling your ad blocker.