3

I've added a database to an availability group that already has a few databases, all of which seeded and syncing fine to the secondary.

This last one gets added to the availability group, it would seem, but is marked as "not synchronizing" and no errors are returned. I've tried it multiple times with the same result.

I've looked in extended events, Event Viewer... nothing. Clicking on "warnings" in the dashboard says nothing useful. The database files do not exist on the secondary at all. I suspect that it was blocked right at the start of its seeding process (but clearly after the initial validations in the "add to AG" wizard).

I have this distinct feeling SQL server must be logging a relevant failure message to some DMV I'm not aware of.

Is there a canonical guide to ALL the places one is supposed to look for AlwaysOn related errors?

1
  • 2
    I've seen this on 2016 also. When you go through the wizard, generate the script at the end, cancel the wizard, and then run each part of the script separately and see if that works. Commented Jun 27, 2019 at 10:51

1 Answer 1

6

On the secondary replica, you should be able to see the status / outcome of seeding attempts in the sys.dm_hadr_automatic_seeding DMV. This includes columns like current_state, failure_state, and failure_state_desc, as well as timing related columns, that should give you a decent overview of seeding issues.

I have often seen seeding errors written to the SQL Server error log (also on the secondary replica), I don't think you mentioned looking there:

screenshot of SSMS error log

One thing I often forget to do is to run this on the secondary replica:

ALTER AVAILABILITY GROUP yourAgName GRANT CREATE ANY DATABASE;

Note: if you're interested in seeing which replicas have automatic seeding permissions, check out this blog post from Sean Gallardy: Automatic Seeding – Which Replicas Have Permission?

Once you've done that, you can attempt re-seeding by running this on the primary:

ALTER AVAILABILITY GROUP yourAgName
    MODIFY REPLICA ON 'SecondaryReplicaInstanceName' 
    WITH (SEEDING_MODE = AUTOMATIC);

That normally gets me up and running.


As far as this question:

Is there a canonical guide to ALL the places one is supposed to look for AlwaysOn related errors?

There is a great blog post from the SQL Server team here: Failover Detection Utility – Availability Group Failover Analysis Made Easy

It's about troubleshooting failovers specifically, but it lists out the main places where you'll see AG errors and diagnostic information:

  • SQL error logs
  • Always On Availability Groups Extended Event Logs
  • System Health Extended Event Logs
  • System log
  • Windows cluster log
1
  • been looking for this answer for a while. Thank you! Commented Jun 16, 2023 at 17:28

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.