Availability Replica Data Synchronization

Microsoft.SQLServer.2012.AlwaysOn.AvailabilityReplicaDataSynchronizationHealth (UnitMonitor)

Knowledge Base article:

Summary

This monitor rolls up the data synchronization state of all database replica in the availability replica. The monitor is in unhealthy state when any database replica is not in the expected data synchronization state. The monitor is healthy otherwise.

Causes

At least one availability database on this availability replica has an unhealthy data synchronization state. If this is an asynchronous-commit availability replica, all availability databases should be in the SYNCHRONIZING state. If this is a synchronous-commit availability replica, all availability databases should be in the SYNCHRONIZED state.

Resolutions

Find the database replica with unhealthy data synchronization state using database replica monitor and resolve the issue at the database replica.

Overridable Parameters

Name

Description

Default Value

Enabled

Enables or disables the workflow.

Yes

Generates Alerts

Defines whether the workflow generates an Alert.

No

Interval (seconds)

The recurring interval of time in seconds in which to run the workflow.

900

Policy Name

 

$Target/Property[Type="AlwaysOnDisc!Microsoft.SQLServer.2012.AlwaysOn.AvailabilityReplica"]/AvailabilityGroupName$-$Target/Property[Type="System!System.Entity"]/DisplayName$-AlwaysOnArDataSynchronizationHealthPolicy

Timeout (seconds)

Specifies the time the workflow is allowed to run before being closed and marked as failed.

300

Element properties:

TargetMicrosoft.SQLServer.2012.AlwaysOn.AvailabilityReplica
Parent MonitorSystem.Health.AvailabilityState
CategoryAvailabilityHealth
EnabledTrue
Alert GenerateFalse
Alert Auto ResolveFalse
Monitor TypeMicrosoft.SQLServer.2012.AlwaysOn.SystemPolicyScriptMonitorType
RemotableTrue
AccessibilityPublic
RunAsMicrosoft.SQLServer.2012.AlwaysOn.MonitoringAccount

Source Code:

<UnitMonitor ID="Microsoft.SQLServer.2012.AlwaysOn.AvailabilityReplicaDataSynchronizationHealth" RunAs="Microsoft.SQLServer.2012.AlwaysOn.MonitoringAccount" TypeID="Microsoft.SQLServer.2012.AlwaysOn.SystemPolicyScriptMonitorType" Accessibility="Public" Enabled="true" ParentMonitorID="Health!System.Health.AvailabilityState" Remotable="true" Target="AlwaysOnDisc!Microsoft.SQLServer.2012.AlwaysOn.AvailabilityReplica" Priority="Normal">
<Category>AvailabilityHealth</Category>
<OperationalStates>
<OperationalState ID="Success" MonitorTypeStateID="HealthState" HealthState="Success"/>
<OperationalState ID="Critical" MonitorTypeStateID="ErrorState" HealthState="Warning"/>
</OperationalStates>
<Configuration>
<Interval>900</Interval>
<TimeoutSeconds>300</TimeoutSeconds>
<PolicyName>$Target/Property[Type="AlwaysOnDisc!Microsoft.SQLServer.2012.AlwaysOn.AvailabilityReplica"]/AvailabilityGroupName$-$Target/Property[Type="System!System.Entity"]/DisplayName$-AlwaysOnArDataSynchronizationHealthPolicy</PolicyName>
<InstanceName>$Target/Property[Type="System!System.Entity"]/DisplayName$</InstanceName>
</Configuration>
</UnitMonitor>