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

  • Recovering an MS SQL Database From Suspect Mode: Step-By-Step Guide
  • SQL Commands: A Brief Guide
  • How to Build Your Exchange Server Recovery Strategy to Overcome Ransomware Attacks
  • How to Integrate a Distributed Database With Event Streaming

Trending

  • A Complete Guide to Modern AI Developer Tools
  • Medallion Architecture: Why You Need It and How To Implement It With ClickHouse
  • Is Agile Right for Every Project? When To Use It and When To Avoid It
  • Automatic Code Transformation With OpenRewrite
  1. DZone
  2. Data Engineering
  3. Data
  4. Are You Facing an Error When You Run the StartDagServerMaintenance.ps1 Script?

Are You Facing an Error When You Run the StartDagServerMaintenance.ps1 Script?

Learn how to address errors with the StartDagServerMaintenance.ps1 script in Exchange Server, and discover reliable recovery solutions for database issues.

By 
Shelly Bhardwaj user avatar
Shelly Bhardwaj
·
Nov. 28, 23 · Tutorial
Likes (4)
Comment
Save
Tweet
Share
2.2K Views

Join the DZone community and get the full member experience.

Join For Free

In Exchange Server, if you need to do some maintenance work on a node and need to stop the services, restart the server, or shut down the server, it’s important to set the Exchange Server in maintenance mode. This allows you to stop and start the server with no impact. In the Exchange Server, the StartDagServerMaintenance.ps1 script is used to run various commands to put the Exchange server in maintenance mode. However, sometimes, when running the script, you may get the following error:

 
VERBOSE: [Time UTC] Move-DagActiveCopy: Entering: `$MailboxServer=ExServer, `$Database=
VERBOSE: [Time UTC] Move-DagActiveCopy: Moving all replicated active databases off server ExServer
VERBOSE: [Time UTC] Move-DagActiveCopy: moving database 'DBName' off server 'ExServer'
VERBOSE: [Time UTC] Move-DagMasterCopy: Entering: `$db=DBName, `$srcServer=ExServer, `$preferredTarget=
VERBOSE: [Time UTC] Test-DagTargetCopy: Testing move criteria for DatabaseName\ExchangeServer, with `$Lossless=True and `$CICheck=False …
VERBOSE: [Time UTC] Test-DagTargetCopy: Name='DatabaseName\ExchangeServer', Status='DisconnectedAndHealthy', CIStatus='Healthy', CopyQueueLength=0, ReplayQueueLength=0
VERBOSE: [Time UTC] Test-DagTargetCopy: Leaving (returning 'False')
VERBOSE: [Time UTC] Test-DagTargetCopy: Testing move criteria for DBName\DR-ExServer, with `$Lossless=True and `$CICheck=False …
VERBOSE: [Time UTC] Test-DagTargetCopy: Name='DBName\DR-ExServer', Status='DisconnectedAndHealthy', CIStatus='Healthy', CopyQueueLength=0, ReplayQueueLength=0
VERBOSE: [Time UTC] Test-DagTargetCopy: Leaving (returning 'False')
VERBOSE: [Time UTC] Move-DagMasterCopy: 0 copies out of 3 for database DBName will be attempted for move.
 Log-Error : [Time UTC] Move-DagMasterCopy: Database 'DBName' *FAILED* to move! Now attempting to perform rollback to prevent a DB outage…

At D:\Program Files\Microsoft\Exchange\V14\scripts\DagCommonLibrary.ps1:483 char:14 + Log-Error <<<< ($DagCommonLibrary_LocalizedStrings.res_0064 –f $db,"Move-DagMasterCopy") + CategoryInfo : NotSpecified: ( : ) [Write-Error], WriteErrorException + FullyQualifiedErrorId :   Microsoft.PowerShell.Commands.WriteErrorException,Log-Error


The error is a bit misleading. You run the Get-MailboxDatabaseCopy command in the Exchange Management Shell (EMS). However, the report doesn’t show any errors.

Possible Solutions to Resolve the Error

You can try to run the manual command to put the server in maintenance mode.

Run the below command to confirm that all databases are healthy.

Get-MailboxDatabase -Server 'MaintenanceServerName' | Get-MailboxDatabaseCopyStatus 

Next, you need to move the active databases from the server.

Move-ActiveMailboxDatabase -Server 'MaintenanceServerName' 

Then, move the cluster services to another node.

cluster.exe DAGFQDN group "ClusterGroup" /moveto: 'MaintenanceServerName' 

Suspend all the copies on the server.

Get-MailboxDatabaseCopyStatus -Server 'MaintenanceServerName' | Suspend-MailboxDatabaseCopy -ActivationOnly:$true 

Pause the node in the cluster.

cluster.exe DAGFQDN node '**MaintenanceServerName**' /pause 

Stop the database from failing over.

Set-MailboxServer -Identity 'MaintenanceServerName' -DatabaseCopyAutoActivationPolicy:BLOCKED 

This will put the server in question under maintenance, and you will be able to proceed with the maintenance work. 

It is possible that a typo or an issue would cause a server to reboot, making it unresponsive, or an issue might occur, which could hinder the manual setting to maintenance mode. This will cause disruption to the system, especially to the mail flow and activation of the services.

You must also consider the impact on the servers that will be active and ensure that the servers are well-equipped to take on the added load. The performance of the servers and storage needs to be considered. When setting up multiple servers in maintenance mode, you must ensure that the rest of the servers can take the added load.

Recovering From a Failing Exchange Server

As you have seen, you can manually set the maintenance mode using the Exchange Management Shell (EMS). In case of any issue with the mailbox databases or Exchange Server, you can use a third-party application to recover from such a situation. Stellar Repair for Exchange is the right application, as it is recommended by MVPs.

With Stellar Repair for Exchange, you can open offline or damaged databases from any Exchange version with no size limit. If you have just the EDB file, the application will be able to open it. After a quick/deep scan, you will have access to the entire structure of the database/s.

You can granularly pick the user mailboxes, user archives, shared mailboxes, disabled mailboxes, and public folders and export them directly to a new Exchange Server mailbox database or another Exchange Server, with automatic mailbox matching. You can use the application to export the EDB data to PST and Exchange Online.

Conclusion

The StartDagServerMaintenance.ps1 script may fail to run if there is an underlying problem with the server or database. When running the commands manually, if the process is not done correctly, there could be repercussions to the health of the server or database. In this case, you can take the help of Stellar Repair for Exchange to recover the data and migrate to a new Exchange Server database. The application helps facilitate speedy recovery with no data loss.

Data loss Database Command (computing) Data (computing)

Opinions expressed by DZone contributors are their own.

Related

  • Recovering an MS SQL Database From Suspect Mode: Step-By-Step Guide
  • SQL Commands: A Brief Guide
  • How to Build Your Exchange Server Recovery Strategy to Overcome Ransomware Attacks
  • How to Integrate a Distributed Database With Event Streaming

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!