Server reboots, Domain Controller issues and other interruptions can cause databases to fail-over to another healthy database in the DAG. Since our DAG was designed to keep roughly half of the mailboxes in the Mount Washington Datacenter and the remainder in the East Baltimore Data Center it is important to be sure that the active databases are balanced and on the copy with an activation preference of 1.
To help with this, Exchange 2010 SP1 includes the script RedistributeActiveDatabases.ps1.
To use this script logon on to a Mailbox server in the DAG and go to the scripts directory by entering the following in the Exchange Management Shell:
cd ‘E:Program FilesMicrosoftExchange ServerScripts’
To determine which copy each database is active, run the RedistributeActiveDatabases.ps1 script with the following syntax:
.RedistributeActiveDatabases.ps1 -ShowDatabaseCurrentActives >C:db.txt
This will output a list detailing the activation preference of each active database to file on the root of C: called db.txt.
After reviewing this file, you may find that some of the databases are active on lower preference copies. To rebalance them run the RedistributeActiveDatabases.ps1 script with the following syntax:
.RedistributeActiveDatabases.ps1 -dagname <dagname> -BalanceDbsByActivationPreference -ShowFinalDatabaseDistribution -Confirm:$false
This will attempt to balance the number of active databases on each server by moving them to the copy with an activation preference of 1. Depending on how unbalanced the databases are, this may have to be run more than once.