Setting a Database Activation Preference

forbidden-planet (1)

Recently, I had to recreate one of my DAGs (a topic I’ll get into another time). At the end of the process, I had to alter the activation preference of the member databases.  Via PowerShell this is easily achieved.

Let’s say, for example, that your DAG has two servers, EXCHSRV01 and EXCHSRV02 and two databases, MBDB01 and MBDB02. To view the current activation preferences for one of the hosted databases you can issue the following command from an Exchange Management Shell window:

Get-MailboxDatabase “MBDB01″|fl server, databaseCopies, activationPreference

The output will be similar to this:

Server: EXCHSRV01
DatabaseCopies: {MBDB01\EXCHSRV01, MBDB01\EXCHSRV02}
ActivationPreference: {[EXCHSRV02, 1], [EXCHSRV01, 2]}

In this scenario, I’d like to change the activation preference so that MBDB01\EXCHSRV01 is the primary DAG database\host.  To do this I issue the following cmdlet and switch combination:

Set-MailboxDatabaseCopy -identity ‘MBDB01\EXCHSRV01’ -ActivationPreference 1

To confirm, simply re-use: Get-MailboxDatabase “MBDB01″|fl server, databaseCopies, activationPreference