r/SQLServer • u/paultoc • Jun 09 '26
Solved Sql AG breaking when secondary node is restarted as part of patching.
Hi all
I have multiple 2 node AG clusters. One node for production and one for DR.
The AG is configured in synchronous commit manual failover.
When we patch the DR node and reboot the server sometime the primary db also becomes un available for some reason
Can you suggest why this might be happening
We do Prod and DR on different days. First prod is patched(fail to dr, patch prod, restart, failback) Then dr (patch dr, restart)
11
Upvotes
•
u/AutoModerator Jun 09 '26
After your question has been solved /u/paultoc, please reply to the helpful user's comment with the phrase "Solution verified".
This will not only award a point to the contributor for their assistance but also update the post's flair to "Solved".
I am a bot, and this action was performed automatically. Please contact the moderators of this subreddit if you have any questions or concerns.
5
u/jdanton14 Microsoft MVP Jun 09 '26
What is quorum anyway? My guess is you're using node majority. https://learn.microsoft.com/en-us/sql/sql-server/failover-clusters/windows/wsfc-quorum-modes-and-voting-configuration-sql-server?view=sql-server-ver17
3
u/bobogator Jun 09 '26
When both nodes are online and the ag is working, check in failover cluster manager which node owns the core cluster resources and the ag role. If it’s the dr node, it’s possible that the cluster isn’t shifting that ownership automatically to the primary node when the dr node goes offline…this can happen sometimes. Try forcing/moving the ownership of the role and core cluster resources to the primary node and do a test restart of the dr node and see if the ag stays online.
2
u/bobogator Jun 09 '26
Check the sql error log on the primary for cluster lease timeout/expiration, which can cause the ag to go offline even when quorum is still present. If the lease is expiring it could be local Windows resource contention (cpu, memory) or it could be a network issue.
9
u/Itsnotvd Jun 09 '26
I'd start with checking if the witness is configured and working.
1
u/k00_x Jun 09 '26
The AG is set to be synchronous but are all the DBs actually in sync? No restores or rebuilds going on for one of the nodes?
1
u/FishBones83 Jun 09 '26
I have seen this happen when the SSIS DB is in the cluster, if thats the case you can google it there are steps on how to resolve.
1
u/StandardCompote6662 Jun 10 '26
Are you on Windows 2025 and do you see quorum failure errors? There is an issue with Windows 2025 where the AG fails if the owner of the cluster core resources(not the AG) is restarted. The AG completely dies until the server being restarted comes back online.
Event ID 1177 during patching in 2-node Windows Server 2025 cluster with FSW - Microsoft Q&A
The fix is described in one of the answers and involves adding a registry key.
1
u/DurianVivid93 Jun 11 '26
your SQL logs and your own verification already gave you the complete answer.
Root Cause: Cluster Core Resources Owned by the DR Node
You confirmed it yourself — the AG that failed had Core Resources on the DR node; the one that didn't had them on Primary. That's the whole explanation.
Failure Chain:
DR node reboot for patching
→ Windows enters "half-dead" state (ping works, SSMS connects, RDP fails, 10–20 min)
→ Core Resources owner is nominally online but unresponsive to cluster heartbeats
→ WSFC can't gracefully failover Core Resources to Primary (DR isn't fully down)
→ Lease timeout (the "lease has expired" message in your SQL log)
→ Primary loses cluster connection → AG enters Resolving
→ Auto-recovers when DR comes fully online
Why "a different AG each time": Where Core Resources land depends on the last failover. If they happen to stay on DR
after your previous patching cycle, next DR reboot triggers the issue. If they're on Primary, it doesn't. This is the randomness you observed.
Not quorum. Not sync mode. Not witness. The lease timeout is a symptom — it fires because the Core Resources owner is
stuck in the half-dead patching window.
Fix (priority order):
Move-ClusterGroup "Cluster Group" -Node PrimaryNode
Get-ClusterGroup | Select Name, OwnerNode
2. Graceful shutdown instead of raw Restart-Computer: Stop SQL → then reboot. Eliminates the half-dead window.
3. If Windows Server 2025 — known bug (Event ID 1177), registry fix available via Microsoft Q&A.
4. Long term: Set preferred owners on Core Resources to Primary only. DR should never hold them.
Good luck with the next patching cycle.
3
u/Hot_Skill Jun 09 '26
The windows cluster log will tell you the reason why the cluster went down.
Get-ClusterLog -UseLocalTime -Destination C:\ClusterLogs
2
u/JTBub Jun 09 '26
Change the ag to asynchronous before you patch. Synchronous means both sides have to commit a transaction. When Dr is patching, prod will stop because secondary can't commit. Async allows transactions to continue on primary while secondary is unavailable.
1
u/Necessary-Text4706 Jun 09 '26
What version of OS and SQL Server?
1
u/No_Resolution_9252 Jun 09 '26
quorum.
1
u/johnnyjoker Jun 09 '26
I had the same happening on a server 2025 with an Exchange SE DAG when not manually failing over the PAM (primary active manager). You could test if it also happens when you manually failover the cluster (the one hosting the cluster group) itself to the primary node, that is if you don't already do that.
0
u/CPDRAGMEISH Jun 09 '26
IT'SG OK
Event Viewer/SQLServer log ?
-2
u/ENMR-OG Jun 09 '26
Manual failover?? HA or upgrade your license, that’s your issue