Today we look at Database Availability Groups. Database Availability Groups is set up for fail-over, replication and / or High Availability if you want to call it. Let me paint you a picture. Take a DAG, which may have 4 stores. It is good to have a few stores to as we mentioned for High Availability. How do you maintain High Availability? Positioning them on multiple servers. So let say, we have 2 server and 4 stores. Now we spread the four stores across the 2 servers. How do balance this stores spread across the two servers? You need to have 1 as primary and copy on the other. So on server 1, you would have store 1 and 2 as primary and a copy on server 2. Then on Server 2, you will have store 3 and 4 as primary and a copy will be residing on server 1. Hopes this paints a picture of a Database Availability Group.
Now, how do we check these Database Availability Groups? Firstly, there is a script comes built-in when you install Exchange called RedistributeActiveDatabases.PS1. Here is how you can locate it.In the Exchange Management Shell, type in Cd\ and press enter to take you to the root of C:\. Now navigate to the following folder: “Program Files\Microsoft\Exchange Server\V14\Scripts”. There you will find built-in script and the RedistributeActiveDatabases.ps1.
Here are some of the switches we can look at:
The first switch .\RedistributeActiveDatabases.ps1 –ShowDatabaseDistributionByServer.
This shows the server you, which Databases are mounted and copies.
It shows you the following: Server Name, Total DBs, and Active, Passive, Preference, Mounted DB , DismountedDB and the DAG name. Most of these are self-explanatory.
The second switch .\RedistributeActiveDatabases.ps1 – ShowDatabaseCurrentActives.
This is a report of all the Databases, active, passive etc. It shows if it has moved etc.
The third switch .\RedistributeActiveDatabases.ps1 –BalanceActivationPreferences.
THIS SHOULD NOT BE DONE IN THE DAY WHILE YOU HAVE USERS CONNECTING.
As you can see the above, it is showing the active preferences and it detects which is not the main one. It will prompt you before moving the DAGs. You can add a $Confirm:false switch to by-pass.
Hope this gives you a better understanding to Database Availability Groups and how to check them. I know, it can be daunting when you not sure what or how to manage it.