<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Edwin M SarmientoThe S.P.A. That Prevents Your Synchronous SQL Server Always On Availability Groups From Failing Over Automatically &#8211; Edwin M Sarmiento</title>
	<atom:link href="https://www.edwinmsarmiento.com/the-s-p-a-that-prevents-your-synchronous-sql-server-availability-groups-from-failing-over-automatically/feed/" rel="self" type="application/rss+xml" />
	<link>https://www.edwinmsarmiento.com</link>
	<description>Intentional Excellence</description>
	<lastBuildDate>Mon, 13 Apr 2026 21:00:49 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	
<site xmlns="com-wordpress:feed-additions:1">84283043</site>		<item>
		<title>The S.P.A. That Prevents Your Synchronous SQL Server Always On Availability Groups From Failing Over Automatically</title>
		<link>https://www.edwinmsarmiento.com/the-s-p-a-that-prevents-your-synchronous-sql-server-availability-groups-from-failing-over-automatically/</link>
		<comments>https://www.edwinmsarmiento.com/the-s-p-a-that-prevents-your-synchronous-sql-server-availability-groups-from-failing-over-automatically/#respond</comments>
		<pubDate>Mon, 31 Aug 2015 01:17:33 +0000</pubDate>
		<dc:creator>Edwin M Sarmiento</dc:creator>
				<category><![CDATA[SQL Server]]></category>
		<category><![CDATA[AlwaysOn Availability Groups]]></category>
		<category><![CDATA[Automatic Failover]]></category>
		<category><![CDATA[Windows Server Failover Clustering]]></category>
		<category><![CDATA[WSFC]]></category>
		<category><![CDATA[WSFC maximum failures]]></category>
		<guid isPermaLink="false">http://www.edwinmsarmiento.com/?p=2035</guid>

				<description><![CDATA[This is a very common question that gets asked on the technical forums, newsgroups, social media, etc. when it comes to synchronous SQL Server Always On Availability Groups (AG): &#8220;Why did my AG not automatically failover?&#8221; Notice that I mentioned SYNCHRONOUS and not asynchronous. Only when Always On Availability Group replica databases are configured for synchronous commit [&#8230;]]]></description>
					<content:encoded><![CDATA[<img width="760" height="404" src="https://www.edwinmsarmiento.com/wp-content/uploads/2015/08/SQLAG1-760x404.jpg" class="featured-image wp-post-image" alt="" srcset="https://www.edwinmsarmiento.com/wp-content/uploads/2015/08/SQLAG1-760x404.jpg 760w, https://www.edwinmsarmiento.com/wp-content/uploads/2015/08/SQLAG1-300x159.jpg 300w, https://www.edwinmsarmiento.com/wp-content/uploads/2015/08/SQLAG1-1024x544.jpg 1024w, https://www.edwinmsarmiento.com/wp-content/uploads/2015/08/SQLAG1-518x275.jpg 518w, https://www.edwinmsarmiento.com/wp-content/uploads/2015/08/SQLAG1-82x44.jpg 82w, https://www.edwinmsarmiento.com/wp-content/uploads/2015/08/SQLAG1-600x319.jpg 600w, https://www.edwinmsarmiento.com/wp-content/uploads/2015/08/SQLAG1.jpg 1437w" sizes="(max-width: 760px) 100vw, 760px" /><p>This is a very common question that gets asked on the technical forums, newsgroups, social media, etc. when it comes to <span style="color: #0000ff;"><strong>synchronous</strong> </span>SQL Server Always On Availability Groups (AG): &#8220;<span style="color: #800000;"><strong><em>Why did my AG not automatically failover?</em></strong></span>&#8221; Notice that I mentioned SYNCHRONOUS and not asynchronous. Only when Always On Availability Group replica databases are configured for synchronous commit can automatic failover happen. Also, there can only be two (not three nor four, only two) synchronous replicas configured in order for automatic failover to occur. And both of them <strong>NEED</strong> to be configured with automatic failover. That is because of the fact that the Windows Server Failover Cluster (WSFC) has to decide which replica to move the load to should failure occurs. Imagine the role of a quarterback in American football. He only has one ball to pass (the Always On Availability Group) and he needs to decide who gets to catch the ball to continue the game. He can&#8217;t possibly throw the ball to two of his other team mates and expect both of them to catch it without causing them to fumble.</p>
<p>But even when everything on the Always On Availability Group is configured properly, there are cases when the AG does not automatically failover to the synchronous replica partner. Here are the three common reasons that prevent that from happening. To make it easier to remember, let&#8217;s use the acronym <strong>S.P.A.</strong> so you can include it in your checklist:</p>
<ol>
<li><strong>Synchronous Status</strong>. Note that synchronous Always On Availability Group replicas are required to ensure automatic failover. This means that, at any given point in time, the AG replica databases can be out-of-sync. There could be a number of reasons why your AG replicas fall out-of-sync: network glitch, AG is suspended or paused, replica becomes temporarily unavailable, massive amounts of transaction log records that couldn&#8217;t commit, etc.  <span style="color: #800000;"><strong>When the AG replicas are out-of-sync, automatic failover does not happen. </strong><span style="color: #000000;">One important thing that a lot of SQL Server DBAs miss out on is this: <span style="color: #0000ff;"><strong>it&#8217;s the database that dictates the status of the entire replica. </strong><span style="color: #000000;">It means that even if you have only 1 out of 10 databases that is out-of-sync, the entire replica is out-of-sync. So, you need to decide how to group your databases together in order to achieve synchronized state across all of the databases in the AG replica. Use the T-SQL query below to check if there is one or more databases in your AG that could prevent automatic failover. You need to have <strong>a value of 1</strong> for all of the databases in your AG replica. More importantly, you need to constantly monitor if the synchronous AG replicas are going out-of-sync.</span></span></span></span><div style="background-color:#eeeeee;border:1px solid #D6D6D6;font-family:arial,helvetica,sans-serif;font-size:15px;line-height:20px;margin:8px 0 20px;padding:15px 20px;"><code style="font-size: 14px;"><span style="color: blue;">SELECT </span><span style="color: black;">database_name</span><span style="color: gray;">, </span><span style="color: black;">is_failover_ready<br />
</span><span style="color: blue;">FROM </span><span style="color: black;">sys.dm_hadr_database_replica_cluster_states<br />
</span><span style="color: blue;">WHERE </span><span style="color: black;">replica_id </span><span style="color: blue;">IN<br />
</span><span style="color: gray;">(</span><span style="color: blue;">SELECT </span><span style="color: black;">replica_id<br />
</span><span style="color: blue;">FROM </span><span style="color: black;">sys.dm_hadr_availability_replica_states</span><span style="color: gray;">)<br />
</span></code><br />
</div></li>
<li><strong>Permissions</strong>. Because Always On Availability Groups run on top of a Windows Server Failover Cluster, the WSFC uses the SQL Server cluster resource DLL to connect to the SQL Server instance for health detection. The WSFC uses the account <strong>NT AUTHORITY\SYSTEM</strong> (or whatever you used for the Cluster service) to connect to the SQL Server instance. In order for the WSFC to perform health and failure detection, the account <strong>NT AUTHORITY\SYSTEM</strong> needs to be granted the appropriate permissions on all of the SQL Server instances that are configured for AG replica automatic failover. I&#8217;ve seen others simply grant the account <strong>sysadmin</strong> privileges but that&#8217;s just way too much privileges for what it simply needs. I&#8217;m a bit paranoid when it comes to security so I only grant it the necessary permissions it needs: Alter Any Always On Availability Group, Connect SQL and VIEW SERVER STATE. Use the T-SQL query below to grant the account <strong>NT AUTHORITY\SYSTEM</strong> the appropriate permissions.<div style="background-color:#eeeeee;border:1px solid #D6D6D6;font-family:arial,helvetica,sans-serif;font-size:15px;line-height:20px;margin:8px 0 20px;padding:15px 20px;"><code style="font-size: 14px;"><span style="color: blue;">USE </span><span style="color: black;">[master]<br />
GO<br />
</span><span style="color: blue;">CREATE </span><span style="color: black;">LOGIN [NT AUTHORITY\SYSTEM] </span><span style="color: blue;">FROM </span><span style="color: black;">WINDOWS </span><span style="color: blue;">WITH </span><span style="color: black;">DEFAULT_DATABASE</span><span style="color: blue;">=</span><span style="color: black;">[master]</span><span style="color: gray;">,<br />
</span><span style="color: black;">GO<br />
</span><span style="color: blue;">GRANT ALTER ANY </span><span style="color: black;">AVAILABILITY </span><span style="color: blue;">GROUP TO </span><span style="color: black;">[NT AUTHORITY\SYSTEM]<br />
GO<br />
</span><span style="color: blue;">GRANT </span><span style="color: black;">CONNECT SQL </span><span style="color: blue;">TO </span><span style="color: black;">[NT AUTHORITY\SYSTEM]<br />
GO<br />
</span><span style="color: blue;">GRANT VIEW </span><span style="color: black;">SERVER STATE </span><span style="color: blue;">TO </span><span style="color: black;">[NT AUTHORITY\SYSTEM]<br />
GO</span></code><br />
</div></li>
<li><strong>Allowable Failure</strong>. I would assume that you&#8217;ve tested automatic failover with your AG replicas immediately after configuration. I also bet that you actually enjoyed doing it and tried doing so a couple of times until you noticed that it only worked the first few times and then it didn&#8217;t. Well, let me break it up to you: that&#8217;s just how it works. Always On Availability Groups are created as a WSFC cluster resource group. A cluster resource group will have its own properties, one of which is called <strong>Maximum failures in the specified period</strong>. There&#8217;s a reason why it is named as such. This is the maximum allowable failures for the cluster resource group (or Always On Availability Group, in this case) to automatically failover to any of the synchronous AG replicas. If you&#8217;ve maxed out this threshold, then, automatic failover will no longer occur. The default value for this property is <strong>1 automatic failover for every 6 hours</strong>.  Refer to the screenshot below for this property value.<img fetchpriority="high" decoding="async" class="aligncenter wp-image-2039 size-full" src="https://www.edwinmsarmiento.com/wp-content/uploads/2015/08/WSFC_Properties-1.png" alt="WSFC_Properties-1" width="414" height="495" srcset="https://www.edwinmsarmiento.com/wp-content/uploads/2015/08/WSFC_Properties-1.png 414w, https://www.edwinmsarmiento.com/wp-content/uploads/2015/08/WSFC_Properties-1-251x300.png 251w, https://www.edwinmsarmiento.com/wp-content/uploads/2015/08/WSFC_Properties-1-335x400.png 335w, https://www.edwinmsarmiento.com/wp-content/uploads/2015/08/WSFC_Properties-1-82x98.png 82w" sizes="(max-width: 414px) 100vw, 414px" /><br />
For testing purposes, it is recommended to increase this value to make sure that you get the expected behavior, that is automatic failover. After the test, set it back to the default values. There are several arguments about the appropriate value for this property but my rule-of-thumb is to use the default value but monitor properly. If the AG (or any cluster resource group running on the WSFC) automatically fails over to the synchronous replica, you don&#8217;t just sit back and relax thinking that the solution worked as expected. You need to investigate immediately why the failover occurred to avoid potential downtime. The only way to immediately respond is to be notified when it happens thru monitoring.</li>
</ol>
<p>So, when your Always On Availability Group replica does not automatically failover, you might want to give it the S.P.A. treatment. Better yet, why not do it right now. Stop what you&#8217;re doing and check your synchronous AG replicas. You don&#8217;t want to be caught off-guard and experience downtime on your mission-critical databases when you&#8217;ve spent that much money and effort implementing it.</p>
<h3>Additional Resources:</h3>
<ul>
<li><a href="https://support.microsoft.com/en-us/kb/2833707" target="_blank" rel="noopener">Troubleshooting automatic failover problems in SQL Server 2012 AlwaysOn environments</a></li>
<li><a href="http://support.microsoft.com/kb/947712" target="_blank" rel="noopener">Failover cluster resource recovery behavior in Windows Server 2008</a> (also applies to Windows Server 2012 and higher)</li>
<li><a href="https://msdn.microsoft.com/en-CA/library/hh710061.aspx" target="_blank" rel="noopener">Flexible Failover Policy for Automatic Failover of an Always On Availability Group (SQL Server)</a></li>
</ul>
<hr />
<h2>Feeling helpless and confused when dealing with Windows Server Failover Clustering  (WSFC) for your SQL Server databases?</h2>
<p>You&#8217;re not alone. I&#8217;ve heard the same thing from thousands of SQL Server administrators throughout my entire career. These are just a few of them.</p>
<p><span style="color: #0000ff;"><em>&#8220;How do I properly size the server, storage, network and all the AD settings which we do not have any control over?&#8221;</em></span></p>
<p><span style="color: #0000ff;"><em>&#8220;I don&#8217;t quite understand how the Windows portion of the cluster operates and interacts with what SQL controls.&#8221;</em></span></p>
<p><span style="color: #0000ff;"><em>&#8220;I&#8217;m unfamiliar with multi-site clustering.&#8221;</em></span></p>
<p><span style="color: #0000ff;">&#8220;<em>Our servers are setup and configured by our parent company, so we don&#8217;t really get much experience with setting up Failover Clusters.</em>&#8220;</span></p>
<p>If you feel the same way, then, this course is for you. It&#8217;s a simple and easy-to-understand way for you to learn and master how Windows Server Failover Clusters can keep your SQL Server databases highly available. Be confident in designing, building and managing SQL Server databases running on Windows Server Failover Clusters.</p>
<p>But don&#8217;t take my word for it. Here&#8217;s what my students have to say about the course.</p>
<p><span style="color: #0000ff;"><em>&#8220;The techniques presented were very valuable, and used them the following week when I was paged on an issue.&#8221;</em></span></p>
<p><span style="color: #0000ff;"><em>&#8220;Thanks again for giving me confidence and teaching all this stuff about failover clusters.&#8221;</em></span></p>
<p><span style="color: #0000ff;"><em>&#8220;I’m so gladdddddd that I took this course!!&#8221;</em></span></p>
<p><span style="color: #0000ff;"><em>&#8220;Now I got better knowledge to setup the Windows FC ENVIRONMENT (DC) for SQL Server FCI and AlwaysON.&#8221;</em></span></p>
<div style="background-color:#eeeeee;border:1px solid #D6D6D6;font-family:arial,helvetica,sans-serif;font-size:15px;line-height:20px;margin:8px 0 20px;padding:15px 20px;"><span style="color: #800000;"><strong>NOTE:</strong></span> Registration for my online course <a href="https://learnsqlserverhadr.com/" target="_blank" rel="noopener"><span style="color: #800000;"><strong>Windows Server Failover Clustering (WSFC) for the Smart SQL Server DBA</strong></span></a> will re-open in <span style="color: #0000ff;"><strong>January 2018</strong></span>. But be sure you do not miss out. This will be the last time that the course will be offered. After this, you will no longer be able to register for the course.</div>
<hr />
<div style="background-color:#eeeeee;border:1px solid #D6D6D6;font-family:arial,helvetica,sans-serif;font-size:15px;line-height:20px;margin:8px 0 20px;padding:15px 20px;"></p>
<p><!-- Begin MailChimp Signup Form --></p>
<style type="text/css">
	#mc_embed_signup{background:#fff; clear:left; font:14px Helvetica,Arial,sans-serif; }<br />	/* Add your own MailChimp form style overrides in your site stylesheet or in this style block.<br />	   We recommend moving this block and the preceding CSS link to the HEAD of your HTML file. */<br /></style>
<p>&nbsp;</p>
<div id="mc_embed_signup">
<form id="mc-embedded-subscribe-form" class="validate" action="//EdwinMSarmiento.us4.list-manage.com/subscribe/post?u=08cdb91518ee67ce09d618509&amp;id=46cff8469f" method="post" name="mc-embedded-subscribe-form" novalidate="" target="_blank">
<div id="mc_embed_signup_scroll">
<h2>Get notified about the next batch of enrollment so you don&#8217;t miss out.</h2>
<div class="indicates-required"><span class="asterisk">*</span> indicates required</div>
<div class="mc-field-group"><label for="mce-EMAIL">Email Address <span class="asterisk">*</span><br />
</label><br />
<input id="mce-EMAIL" class="required email" name="EMAIL" type="email" value="" /></div>
<div class="mc-field-group"><label for="mce-FNAME">First Name </label><br />
<input id="mce-FNAME" class="" name="FNAME" type="text" value="" /></div>
<div id="mce-responses" class="clear"></div>
<p><!-- real people should not fill this in and expect good things - do not remove this or risk form bot signups--></p>
<div style="position: absolute; left: -5000px;" aria-hidden="true"><input tabindex="-1" name="b_08cdb91518ee67ce09d618509_46cff8469f" type="text" value="" /></div>
<div class="clear"><input id="mc-embedded-subscribe" class="button" name="subscribe" type="submit" value="Keep me updated!" /></div>
</div>
</form>
</div>
<p><script type='text/javascript' src='//s3.amazonaws.com/downloads.mailchimp.com/js/mc-validate.js'></script><script type='text/javascript'>(function($) {window.fnames = new Array(); window.ftypes = new Array();fnames[0]='EMAIL';ftypes[0]='email';fnames[1]='FNAME';ftypes[1]='text';fnames[2]='LNAME';ftypes[2]='text';}(jQuery));var $mcj = jQuery.noConflict(true);</script><br />
<!--End mc_embed_signup--><br />
</div>
]]></content:encoded>
			

		<wfw:commentRss>https://www.edwinmsarmiento.com/the-s-p-a-that-prevents-your-synchronous-sql-server-availability-groups-from-failing-over-automatically/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
				<post-id xmlns="com-wordpress:feed-additions:1">2035</post-id>	</item>
	</channel>
</rss>