As known, there is a policy on SQL Server to check the data synchronization state of the database replica. The policy is in an unhealthy state when the data synchronization state is NOT SYNCHRONIZING or the state is not SYNCHRONIZED for the synchronous-commit database replica.
After investigating the sql server errorlog, I got the following msg:
The target database, ‘YourDatabase’, is participating in an availability group and is currently not accessible for queries. Either data movement is suspended or the availability replica is not enabled for read access. To allow read-only access to this and other databases in the availability group, enable read access to one or more secondary availability replicas in the group. For more information, see the ALTER AVAILABILITY GROUP statement in SQL Server Books Online. (Microsoft SQL Server, Error: 976)
According to Technet, this issue can be caused by the following:
- The availability replica might be disconnected.
- The data movement might be suspended.
- The database might not be accessible.
- There might be a temporary delay issue due to network latency or the load on the primary or secondary replica.
Further information: https://technet.microsoft.com/en-us/library/hh245199.aspx
You can fix it, using the following T-SQL command to force the resume synchronization:
ALTER DATABASE YourDatabase SET HADR RESUME;
You can also follow the link: How to resume an AG database.
Check out these related tips: