Use AlwaysOn Policies to View the Health of an Availability Group (SQL Server)
This topic describes how to determine the operational health of an AlwaysOn availability group by using an AlwaysOn policy in SQL Server Management Studio or PowerShell in SQL Server 2012. For information about AlwaysOn Policy Based Management, see AlwaysOn Policies for Operational Issues with AlwaysOn Availability Groups (SQL Server).
For AlwaysOn policies, the category names are used as IDs. Changing the name of an AlwaysOn category would break its health-evaluation functionality. Therefore, the names of AlwaysOn category should never be modified.
Requires CONNECT, VIEW SERVER STATE, and VIEW ANY DEFINITION permissions.
To open the AlwaysOn Dashboard
In Object Explorer, connect to the server instance that hosts one of the availability replicas. To view information about all of the availability replicas in an availability group, use to the server instance that hosts the primary replica.
Click the server name to expand the server tree.
Expand the AlwaysOn High Availability node.
Either right-click the Availability Groups node or expand this node and right-click a specific availability group.
Select the Show Dashboard command.
For information about how to use the AlwaysOn Dashboard, see Use the AlwaysOn Dashboard (SQL Server Management Studio).
Use AlwaysOn policies to view the health of an availability group
Set default (cd) to a server instance that hosts one of the availability replicas. To view information about all of the availability replicas in an availability group, use to the server instance that hosts the primary replica.
Use the following cmdlets:
These cmdlets accept the following options:
Runs user policies found in the AlwaysOn policy categories.
A collection of objects that, represent availability groups, availability replicas, or availability database states (depending on which cmdlet you are using). The cmdlet will compute the health of the specified objects.
When this parameter is set, the cmdlet will not manually refresh the objects specified by the -Path or -InputObject parameter.
The path to the availability group, one or more availability replicas, or database replica cluster state of the availability database (depending on which cmdlet you are using). This is an optional parameter. If not specified, the value of this parameter defaults to the current working location.
Shows the result of each policy evaluation performed by this cmdlet. The cmdlet outputs one object per policy evaluation, and this object has fields describing the results of evaluation (whether the policy passed or not, the policy name and category, and so forth).
For example, the following Test-SqlAvailabilityGroup command specifies the -ShowPolicyDetails parameter to show the result of each policy evaluation performed by this cmdlet for each policy-based management (PBM) policy that was executed on the availability group named MyAg.
Test-SqlAvailabilityGroup ` -Path SQLSERVER:\Sql\Computer\Instance\AvailabilityGroups\AgName ` -ShowPolicyDetails
To view the syntax of a cmdlet, use the Get-Help cmdlet in the SQL Server PowerShell environment. For more information, see Get Help SQL Server PowerShell.
To set up and use the SQL Server PowerShell provider