DZone
Thanks for visiting DZone today,
Edit Profile
  • Manage Email Subscriptions
  • How to Post to DZone
  • Article Submission Guidelines
Sign Out View Profile
  • Post an Article
  • Manage My Drafts
Over 2 million developers have joined DZone.
Log In / Join
Please enter at least three characters to search
Refcards Trend Reports
Events Video Library
Refcards
Trend Reports

Events

View Events Video Library

Zones

Culture and Methodologies Agile Career Development Methodologies Team Management
Data Engineering AI/ML Big Data Data Databases IoT
Software Design and Architecture Cloud Architecture Containers Integration Microservices Performance Security
Coding Frameworks Java JavaScript Languages Tools
Testing, Deployment, and Maintenance Deployment DevOps and CI/CD Maintenance Monitoring and Observability Testing, Tools, and Frameworks
Culture and Methodologies
Agile Career Development Methodologies Team Management
Data Engineering
AI/ML Big Data Data Databases IoT
Software Design and Architecture
Cloud Architecture Containers Integration Microservices Performance Security
Coding
Frameworks Java JavaScript Languages Tools
Testing, Deployment, and Maintenance
Deployment DevOps and CI/CD Maintenance Monitoring and Observability Testing, Tools, and Frameworks

Last call! Secure your stack and shape the future! Help dev teams across the globe navigate their software supply chain security challenges.

Modernize your data layer. Learn how to design cloud-native database architectures to meet the evolving demands of AI and GenAI workloads.

Releasing software shouldn't be stressful or risky. Learn how to leverage progressive delivery techniques to ensure safer deployments.

Avoid machine learning mistakes and boost model performance! Discover key ML patterns, anti-patterns, data strategies, and more.

Related

  • Enhancing Avro With Semantic Metadata Using Logical Types
  • Controlling Access to Google BigQuery Data
  • The Role of Data Governance in Data Strategy: Part II
  • How to Build Your Exchange Server Recovery Strategy to Overcome Ransomware Attacks

Trending

  • From Zero to Production: Best Practices for Scaling LLMs in the Enterprise
  • Kubeflow: Driving Scalable and Intelligent Machine Learning Systems
  • Microsoft Azure Synapse Analytics: Scaling Hurdles and Limitations
  • Docker Model Runner: Streamlining AI Deployment for Developers
  1. DZone
  2. Data Engineering
  3. Databases
  4. How to Check DAG Health Status for All Exchange Servers

How to Check DAG Health Status for All Exchange Servers

Although DAG provides protection against data loss and helps prevent downtime, it is susceptible to failures. Here's how to check its health status.

By 
Shelly Bhardwaj user avatar
Shelly Bhardwaj
·
Oct. 26, 21 · Tutorial
Likes (2)
Comment
Save
Tweet
Share
41.2K Views

Join the DZone community and get the full member experience.

Join For Free

Database Availability Group (DAG) is a built-in framework in Microsoft Exchange Server that uses continuous replication and failover clustering to ensure high availability and site resilience.

In Exchange Server, DAG refers to a cluster of Exchange Servers (up to 16 Exchange Mailbox Servers) that hosts a set of database copies and provides protection against switchover and failover. In DAG, there is one active server and a copy of the database on the active server is replicated across all passive servers. 

DAG members continuously monitor each other for failure and provide automatic database-level recovery in case of a database, disk, server, or network failure.

Although DAG provides protection against data loss and helps prevent downtime, it is susceptible to failures. Common failures detected in the DAG environment are as follows:

  • Witness server failure
  • DAG member failure
  • MAPI network failure
  • Virtual Directory failure
  • DAG member failure
  • Replication failure

These failures can prevent DAG members from providing automatic database recovery and may lead to downtime and data loss. 

It is also a reason why DAG is not considered as an alternative to backups. Even though you have set up Exchange Server in a DAG environment, regular VSS-based backups using application-aware backup tools, such as Windows Server Backup, are critical.

Below, we have discussed steps to check and monitor health for all member Exchange Servers in the DAG environment to ensure high availability and site resilience and prevent failures.

Steps to Check and Monitor DAG Health Status for All Member Exchange Servers

In Microsoft Exchange 2010 SP1 and later versions, you can use the Get-MailboxDatabaseCopyStatus and Test-ReplicationHealth PowerShell cmdlets in Exchange Management Shell (EMS) to check the status of all DAG members, replication health, and database copies in your Exchange environment. 

These PowerShell cmdlets provide an overview of all Exchange Servers’ and mailbox databases’ health status in a DAG.

Step 1: Assign Permissions

You need to assign permissions to run these cmdlets for checking the health and replication status of the Exchange Server in a DAG. The steps are as follows:

  • Open Exchange Management Shell as administrator and execute the following cmdlets to view permissions needed to run the cmdlets:

$Perms = Get-ManagementRole -Cmdlet <Cmdlet>

Replace <Cmdlet> with the cmdlet for which you need to know the permissions required. For instance,

$Perms = Get-ManagementRole -Cmdlet Get-MailboxDatabaseCopyStatus

$Perms | foreach {Get-ManagementRoleAssignment -Role $_.Name -Delegating $false | Format-Table -Auto Role,RoleAssigneeType,RoleAssigneeName}screenshot of exchange management shellAssign Permissions

  • Similarly, find the permission and roles required to run the Test-ReplicationHealth:

$Perms = Get-ManagementRole -Cmdlet Test-ReplicationHealth


$Perms | foreach {Get-ManagementRoleAssignment -Role $_.Name -Delegating $false | Format-Table -Auto Role,RoleAssigneeType,RoleAssigneeName}screenshot of permission and roles in terminalTest-ReplicationHealth

  • Assign the displayed roles and permission via New-ManagementRoleAssignment PowerShell cmdlet,

New-ManagementRoleAssignment –role <role-name> -user <username>

For instance,

New-ManagementRoleAssignment –role “View-only Configuration” -user “administrator”

View-Only Configurationscreenshot of a view only configuration

New-ManagementRoleAssignment –role “Monitoring” -user “administrator.”

Monitoring

screenshot of a monitoring configurationStep 2: Check Databases Copy Status in All Exchange Servers 

You can use the Get-MailboxDatabaseCopyStatus cmdlet to view information of the mailbox database copies that are part of the Database Availability Group (DAG). You can use the cmdlet to view information related to,

  • All database copies of a particular database

Get-MailboxDatabaseCopyStatus -Identity DB2 | Format-List

  • All database copies on a particular DAG Exchange Server

Get-MailboxDatabaseCopyStatus -Server MBX2 | Format-List

  • Specific database copy of a database on a particular DAG Exchange Server

Get-MailboxDatabaseCopyStatus -Local | Format-List

screenshot of database copy status

Database Copy Status

(Get-DatabaseAvailabilityGroup) | ForEach {$_.Servers | ForEach {Get-MailboxDatabaseCopyStatus -Server $_}}

Step 3: Check Replication Health of All Exchange Servers in DAG 

The Test-ReplicationHealth cmdlet allows you to check the information of continuous replication and replay status about the database copies. Besides proactively monitoring the continuous replication and replication pipeline status, the cmdlet helps administrators perform various other tests to keep an eye on the health status of quorum, cluster service, and network components.

You can run the cmdlet remotely or directly on any Exchange Server, a member of the DAG. For example, to test the replication health of Exchange Server EXCHSRV01, run the following command in the EMS.

Test-ReplicationHealth -Identity EXCHSRV01screenshot of replication healthReplication Health

You may also execute the following command to check all servers in the DAG environment. 

(Get-DatabaseAvailabilityGroup) | ForEach {$_.Servers | ForEach {Test-ReplicationHealth -Server $_}}

Step 4: Run Test-ExchangeServerHealth.ps1 or Get-DAGHealthPS1 PowerShell Scripts

The Test-ExchangeServerHealth.ps1 and Get-DAGHealth.ps1 scripts perform a health check on your Exchange 2010/2013 Servers in standalone and DAG environments. It displays a detailed report on the server health status in an HTML document.

The report displays a color-coded table that helps you quickly spot the issues and warnings and fix them before they lead to a disaster.

To run the script, follow these steps:

   1. Download the Test_ExchangeServerHealth.ps1 on your server and then open the PowerShell.

downloading test exchange server health on server

Test_ExchangeServerHealth.ps1

2. Navigate to the location where the script is stored and then execute the following command:

.\Test-ExchangeServerHealth.ps1administration panel of windows powershell.\Test-ExchangeServerHealth.ps1

This checks all the servers in your organization and displays a detailed report on the health status and issues.

  3. To check specific server status, execute the following command: 

.\Test-ExchangeServerHealth.ps1 -Server HO-EXCHSRV01report of exchange server health checkExchange Server Health Check Report

In case of error, such as script is not digitally signed, execute the following command and then run the Test-ExchangeServerHealthps1 script. 

Set-ExecutionPolicy -Scope Process -ExecutionPolicy Bypass

Set-ExecutionPolicy

executing a command in the event of an errorYou can follow the same steps to download and run the Get-DAGHealth.ps1 script to run series of health checks on the Database Availability Group and generate a much more detailed report.

.\Get-DAGHealth.ps1 -Detailed

To Wrap Up

Database integrity and consistency can only be ensured when the active and passive database copies on DAG member servers are in sync and healthy. Thus, it is critical to ensure the database copy status and replication health in a DAG environment. In Exchange Server 2010, 2013, 2016, and 2019, you can use the Get-MailboxDatabaseCopyStatus and Test-ReplicationHealth PowerShell cmdlets to check DAG health status for database copies on all Exchange Servers. You may also run the PowerShell scripts to get a detailed report on the DAG health status. In case of failure, you can use your backup to restore a copy of the database or use an exchange recovery software to recover mailboxes from damaged or corrupt databases. The software helps you restore mailboxes from inconsistent Exchange Databases (EDB) when backups are obsolete, do not work, or are unavailable.

Database Microsoft Exchange Server Data security

Opinions expressed by DZone contributors are their own.

Related

  • Enhancing Avro With Semantic Metadata Using Logical Types
  • Controlling Access to Google BigQuery Data
  • The Role of Data Governance in Data Strategy: Part II
  • How to Build Your Exchange Server Recovery Strategy to Overcome Ransomware Attacks

Partner Resources

×

Comments
Oops! Something Went Wrong

The likes didn't load as expected. Please refresh the page and try again.

ABOUT US

  • About DZone
  • Support and feedback
  • Community research
  • Sitemap

ADVERTISE

  • Advertise with DZone

CONTRIBUTE ON DZONE

  • Article Submission Guidelines
  • Become a Contributor
  • Core Program
  • Visit the Writers' Zone

LEGAL

  • Terms of Service
  • Privacy Policy

CONTACT US

  • 3343 Perimeter Hill Drive
  • Suite 100
  • Nashville, TN 37211
  • support@dzone.com

Let's be friends:

Likes
There are no likes...yet! 👀
Be the first to like this post!
It looks like you're not logged in.
Sign in to see who liked this post!