<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="http://blogs.msdn.com/utility/FeedStylesheets/atom.xsl" media="screen"?><feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en-US"><title type="html">CSS SQL Server Engineers</title><subtitle type="html">This is the official team Web Log for Microsoft Customer Service and Support (CSS) SQL Support. Posts are provided by the CSS SQL Escalation Services team.</subtitle><id>http://blogs.msdn.com/b/psssql/atom.aspx</id><link rel="alternate" type="text/html" href="http://blogs.msdn.com/b/psssql/" /><link rel="self" type="application/atom+xml" href="http://blogs.msdn.com/b/psssql/atom.aspx" /><generator uri="http://telligent.com" version="5.6.50428.7875">Telligent Evolution Platform Developer Build (Build: 5.6.50428.7875)</generator><updated>2013-03-29T16:47:06Z</updated><entry><title>Why won't my PowerPivot for Excel 2010 workbook upgrade to Excel 2013?</title><link rel="alternate" type="text/html" href="http://blogs.msdn.com/b/psssql/archive/2013/05/23/why-won-t-my-powerpivot-for-excel-2010-workbook-upgrade-to-excel-2013.aspx" /><id>http://blogs.msdn.com/b/psssql/archive/2013/05/23/why-won-t-my-powerpivot-for-excel-2010-workbook-upgrade-to-excel-2013.aspx</id><published>2013-05-23T17:35:00Z</published><updated>2013-05-23T17:35:00Z</updated><content type="html">&lt;p&gt;&lt;span style="font-family: arial,helvetica,sans-serif; font-size: small;"&gt;Recently we've seen an issue where some Excel 2010 workbooks containing PowerPivot models encounter errors when attempting to upgrade to Excel 2013.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-family: arial,helvetica,sans-serif; font-size: small;"&gt;When opening a PowerPivot model that was created in Excel 2010 in Excel 2013 you will be prompted to upgrade with the following message:&lt;/span&gt;&lt;/p&gt;
&lt;p style="padding-left: 60px;"&gt;&lt;span style="color: #000000;"&gt;&lt;strong&gt;&lt;span style="font-family: terminal,monaco;"&gt;This workbook has a PowerPivot data model created using a previous version of &lt;/span&gt;&lt;/strong&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="color: #000000;"&gt;&lt;strong&gt;&lt;span style="font-family: terminal,monaco;"&gt;the PowerPivot add-in. You will need to upgrade this data model with PowerPivot &lt;/span&gt;&lt;/strong&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="color: #000000;"&gt;&lt;strong&gt;&lt;span style="font-family: terminal,monaco;"&gt;for Excel 2013.&lt;/span&gt;&lt;/strong&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p style="padding-left: 60px;"&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-family: arial,helvetica,sans-serif; font-size: small;"&gt;After clicking OK to upgrade to model&amp;nbsp;the following error message is&amp;nbsp;displayed:&lt;/span&gt;&lt;/p&gt;
&lt;p style="padding-left: 30px;"&gt;&lt;strong&gt;&lt;span style="color: #000000; font-family: terminal,monaco;"&gt;============================&lt;/span&gt;&lt;/strong&gt;&lt;br /&gt;&lt;strong&gt;&lt;span style="color: #000000; font-family: terminal,monaco;"&gt;Error Message:&lt;/span&gt;&lt;/strong&gt;&lt;br /&gt;&lt;strong&gt;&lt;span style="color: #000000; font-family: terminal,monaco;"&gt;============================&amp;nbsp;&lt;/span&gt;&lt;/strong&gt;&lt;/p&gt;
&lt;p style="padding-left: 30px;"&gt;&lt;strong&gt;&lt;span style="color: #000000; font-family: terminal,monaco;"&gt;The handle is invalid&lt;/span&gt;&lt;/strong&gt;&lt;br /&gt;&lt;strong&gt;&lt;span style="color: #000000; font-family: terminal,monaco;"&gt;----------------------------&lt;/span&gt;&lt;/strong&gt;&lt;br /&gt;&lt;strong&gt;&lt;span style="color: #000000; font-family: terminal,monaco;"&gt;The '' local cube file cannot be opened.&lt;/span&gt;&lt;/strong&gt;&lt;br /&gt;&lt;strong&gt;&lt;span style="color: #000000; font-family: terminal,monaco;"&gt;----------------------------&lt;/span&gt;&lt;/strong&gt;&lt;br /&gt;&lt;strong&gt;&lt;span style="color: #000000; font-family: terminal,monaco;"&gt;A connection cannot be made. Ensure that the server is running.&lt;/span&gt;&lt;/strong&gt;&lt;br /&gt;&lt;strong&gt;&lt;span style="color: #000000; font-family: terminal,monaco;"&gt;----------------------------&lt;/span&gt;&lt;/strong&gt;&lt;br /&gt;&lt;strong&gt;&lt;span style="color: #000000; font-family: terminal,monaco;"&gt;Sorry, PowerPivot couldn't connect to server A connection cannot be made. Ensure that the server is running..&lt;/span&gt;&lt;/strong&gt;&lt;/p&gt;
&lt;p style="padding-left: 30px;"&gt;&lt;strong&gt;&lt;span style="color: #000000; font-family: terminal,monaco;"&gt;============================&lt;/span&gt;&lt;/strong&gt;&lt;br /&gt;&lt;strong&gt;&lt;span style="color: #000000;"&gt;&lt;span style="font-family: terminal,monaco;"&gt;Call &lt;/span&gt;&lt;span style="font-family: terminal,monaco;"&gt;Stack:&lt;/span&gt;&lt;/span&gt;&lt;/strong&gt;&lt;br /&gt;&lt;strong&gt;&lt;span style="color: #000000; font-family: terminal,monaco;"&gt;============================&lt;/span&gt;&lt;/strong&gt;&lt;/p&gt;
&lt;p style="padding-left: 30px;"&gt;&lt;strong&gt;&lt;span style="color: #000000; font-family: terminal,monaco;"&gt;&amp;nbsp;&amp;nbsp; at Microsoft.AnalysisServices.LocalCubeStream..ctor(String cubeFile, OpenFlags settings, Int32 timeout, String password, String serverName)&lt;/span&gt;&lt;/strong&gt;&lt;br /&gt;&lt;strong&gt;&lt;span style="color: #000000; font-family: terminal,monaco;"&gt;----------------------------&lt;/span&gt;&lt;/strong&gt;&lt;br /&gt;&lt;strong&gt;&lt;span style="color: #000000; font-family: terminal,monaco;"&gt;&amp;nbsp;&amp;nbsp; at Microsoft.AnalysisServices.LocalCubeStream..ctor(String cubeFile, OpenFlags settings, Int32 timeout, String password, String serverName)&lt;/span&gt;&lt;/strong&gt;&lt;br /&gt;&lt;strong&gt;&lt;span style="color: #000000; font-family: terminal,monaco;"&gt;&amp;nbsp;&amp;nbsp; at Microsoft.AnalysisServices.XmlaClient.OpenLocalCubeConnection(ConnectionInfo connectionInfo)&lt;/span&gt;&lt;/strong&gt;&lt;br /&gt;&lt;strong&gt;&lt;span style="color: #000000; font-family: terminal,monaco;"&gt;&amp;nbsp;&amp;nbsp; at Microsoft.AnalysisServices.XmlaClient.OpenConnection(ConnectionInfo connectionInfo, Boolean&amp;amp; isSessionTokenNeeded)&lt;/span&gt;&lt;/strong&gt;&lt;br /&gt;&lt;strong&gt;&lt;span style="color: #000000; font-family: terminal,monaco;"&gt;&amp;nbsp;&amp;nbsp; at Microsoft.AnalysisServices.XmlaClient.Connect(ConnectionInfo connectionInfo, Boolean beginSession)&lt;/span&gt;&lt;/strong&gt;&lt;br /&gt;&lt;strong&gt;&lt;span style="color: #000000; font-family: terminal,monaco;"&gt;----------------------------&lt;/span&gt;&lt;/strong&gt;&lt;br /&gt;&lt;strong&gt;&lt;span style="color: #000000; font-family: terminal,monaco;"&gt;&amp;nbsp;&amp;nbsp; at Microsoft.AnalysisServices.XmlaClient.Connect(ConnectionInfo connectionInfo, Boolean beginSession)&lt;/span&gt;&lt;/strong&gt;&lt;br /&gt;&lt;strong&gt;&lt;span style="color: #000000; font-family: terminal,monaco;"&gt;&amp;nbsp;&amp;nbsp; at Microsoft.AnalysisServices.Server.Connect(String connectionString, String sessionId, ObjectExpansion expansionType)&lt;/span&gt;&lt;/strong&gt;&lt;br /&gt;&lt;strong&gt;&lt;span style="color: #000000; font-family: terminal,monaco;"&gt;&amp;nbsp;&amp;nbsp; at Microsoft.AnalysisServices.BackEnd.DataModelingSandboxConnection.OpenAMOConnection()&lt;/span&gt;&lt;/strong&gt;&lt;br /&gt;&lt;strong&gt;&lt;span style="color: #000000; font-family: terminal,monaco;"&gt;----------------------------&lt;/span&gt;&lt;/strong&gt;&lt;br /&gt;&lt;strong&gt;&lt;span style="color: #000000; font-family: terminal,monaco;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;at Microsoft.AnalysisServices.BackEnd.DataModelingSandboxConnection.OpenAMOConnection()&lt;/span&gt;&lt;/strong&gt;&lt;br /&gt;&lt;strong&gt;&lt;span style="color: #000000; font-family: terminal,monaco;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;at Microsoft.AnalysisServices.BackEnd.DataModelingSandboxConnection.Open()&lt;/span&gt;&lt;/strong&gt;&lt;br /&gt;&lt;strong&gt;&lt;span style="color: #000000; font-family: terminal,monaco;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;at Microsoft.Office.PowerPivot.ExcelAddIn.InProcServer.LoadSandboxAfterConnection(String errorCache)&lt;/span&gt;&lt;/strong&gt;&lt;br /&gt;&lt;strong&gt;&lt;span style="color: #000000; font-family: terminal,monaco;"&gt;&amp;nbsp;&amp;nbsp; at Microsoft.Office.PowerPivot.ExcelAddIn.InProcServer.LoadSafeSandboxAfterConnection(String errorCache)&lt;/span&gt;&lt;/strong&gt;&lt;br /&gt;&lt;strong&gt;&lt;span style="color: #000000; font-family: terminal,monaco;"&gt;&amp;nbsp;&amp;nbsp; at Microsoft.Office.PowerPivot.ExcelAddIn.InProcServer.LoadOLEDBConnection(Boolean raiseCompleteEvent, String errorCache)&lt;/span&gt;&lt;/strong&gt;&lt;/p&gt;
&lt;p style="padding-left: 30px;"&gt;&lt;strong&gt;&lt;span style="color: #000000; font-family: terminal,monaco;"&gt;============================&lt;/span&gt;&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-size: small;"&gt;This&amp;nbsp;issue occurs when a Pivot Table in the workbook has an invalid set or calculated field definition.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-size: small;"&gt;When the attempt to upgrade begins, Excel opens the PowerPivot model and executes the commands in the pivotcache for the pivot tables in the workbook,&amp;nbsp;including creating session sets or calculated items. If a definition contains an error then the embedded PowerPivot engine returns an error and Excel disconnects from the PowerPivot embedded engine, returning the message saying the server connection could not be opened.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-size: small;"&gt;We are working with the Excel team to address this issue, but for now one option to work around this problem is to use the following steps:&lt;/span&gt;&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;&lt;span style="font-size: small;"&gt;Open the workbook in Excel 2010&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style="font-size: small;"&gt;Click on a PivotTable&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style="font-size: small;"&gt;In the PivotTable Tools, Options, menu click on the "Fields, Items, and Sets" button and choose Manage Sets.&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style="font-size: small;"&gt;Delete any invalid set definitions.&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style="font-size: small;"&gt;Save the file then open it in Excel 2013.&amp;nbsp; It should upgrade successfully.&amp;nbsp;&lt;/span&gt;&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-family: arial,helvetica,sans-serif; font-size: x-small;"&gt;-Wayne Robertson&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;br /&gt;&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=10420965" width="1" height="1"&gt;</content><author><name>psssql</name><uri>http://blogs.msdn.com/psssql/ProfileUrlRedirect.ashx</uri></author><category term="PowerPivot" scheme="http://blogs.msdn.com/b/psssql/archive/tags/PowerPivot/" /></entry><entry><title>SharePoint Adventures : Claims, Named Pipes and Kerberos</title><link rel="alternate" type="text/html" href="http://blogs.msdn.com/b/psssql/archive/2013/05/17/sharepoint-adventures-claims-named-pipes-and-kerberos.aspx" /><id>http://blogs.msdn.com/b/psssql/archive/2013/05/17/sharepoint-adventures-claims-named-pipes-and-kerberos.aspx</id><published>2013-05-17T21:17:15Z</published><updated>2013-05-17T21:17:15Z</updated><content type="html">&lt;p&gt;I ran into a new Kerberos Scenario that I hadn’t hit before when I was working on the cases related to this &lt;a href="http://blogs.msdn.com/b/psssql/archive/2013/05/17/sharepoint-adventures-when-connectivity-is-not-connectivity.aspx" target="_blank"&gt;blog post&lt;/a&gt;. It’s rare that I actually see a case related to the Named Pipes protocol.&amp;#160; When I do, it is usually a customer trying to get it setup with a Cluster deployment.&amp;#160; I have never had a Named Pipes case related to Kerberos.&amp;#160; On top of that, I’ve never had a SQL related Kerberos issue that looked like an actual network related issue.&amp;#160; I usually see a traditional “Login failed for user” type error from the SQL Server itself.&lt;/p&gt;  &lt;p&gt;As part of my troubleshooting for the other blog post with the Claims configuration, I stumbled upon some information and theories about how Named Pipes responds when Kerberos is in the picture that I hadn’t ever seen or dealt with before.&amp;#160; I love when I see new things! It is very humbling and always reminds me there are a lot of things that I don’t know.&amp;#160; And, if you have read my other blog posts, or have seen me present at conferences like &lt;a href="http://www.sqlpass.org" target="_blank"&gt;PASS&lt;/a&gt;, you know I have a passion for Kerberos! &lt;/p&gt;  &lt;p&gt;Here is what I saw from an error perspective using SharePoint 2013 and Reporting Services 2012 SP1.&lt;/p&gt;  &lt;blockquote&gt;   &lt;p&gt;&lt;a href="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-00-73-84-metablogapi/2450.image_5F00_321159E3.png"&gt;&lt;img title="image" style="border-left-width: 0px; border-right-width: 0px; background-image: none; border-bottom-width: 0px; padding-top: 0px; padding-left: 0px; display: inline; padding-right: 0px; border-top-width: 0px" border="0" alt="image" src="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-00-73-84-metablogapi/8712.image_5F00_thumb_5F00_6D64BFA1.png" width="353" height="229" /&gt;&lt;/a&gt;&lt;/p&gt;    &lt;p&gt;&lt;font face="Courier New"&gt;&lt;font size="2"&gt;System.Data.SqlClient.&lt;font color="#ff0000"&gt;SqlException: A network-related or instance-specific error occurred while establishing a connection to SQL Server. The server was not found or was not accessible. Verify that the instance name is correct and that SQL Server is configured to allow remote connections. (provider: Named Pipes Provider, error: 40 - Could not open a connection to SQL Server)&lt;/font&gt; ---&amp;gt; System.ComponentModel.&lt;font color="#ff0000"&gt;Win32Exception: &lt;font style="background-color: #ffff00"&gt;Access is denied&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;/p&gt; &lt;/blockquote&gt;  &lt;p&gt;This is a typical error if we can’t connect to SQL.&amp;#160; Think of this like a “Server doesn’t exist” type error.&amp;#160; We didn’t get the normal “Login failed for user” error that would possibly point towards Kerberos.&amp;#160; In this error, we didn’t even make it to SQL.&amp;#160; The interesting piece here though is the “&lt;font style="background-color: #ffff00"&gt;Access is denied&lt;/font&gt;” inner exception.&amp;#160; That does possibly point to a permission issue.&amp;#160; &lt;/p&gt;  &lt;p&gt;I had talked in the last Blog Post about protocol order with connecting to SQL and that the default was TCP.&amp;#160; In this case, I was forcing Named Pipes, so the fact that the error is a Named Pipes error is expected.&lt;/p&gt;  &lt;p&gt;I dropped down to a network trace to see how far we actually got and to see if that revealed any other information.&amp;#160; One thing to keep in mind here is that we are in a Claims to Windows Token Service (C2WTS) scenario with the SharePoint/RS 2012 integration.&amp;#160; So, Kerberos/Constrained Delegation will be in the picture here.&amp;#160; A lot of people aren’t necessarily familiar with how Named Pipes actually works.&amp;#160; Named Pipes actually uses the SMB (simple message block) protocol from a network perspective.&amp;#160; This is the same protocol used for file shares and you’ll see the traffic on port 445.&amp;#160; It can be a little confusing because SMB sits on top of TCP, but we aren’t actually using the TCP 1433 port.&amp;#160; It is just a different way to connect to SQL Server. The IP 10.0.0.20 was the SharePoint Server hosting the Reporting Services Service.&lt;/p&gt;  &lt;blockquote&gt;   &lt;p&gt;&lt;font size="2" face="Courier New"&gt;300&amp;#160;&amp;#160;&amp;#160; 9:04:40 AM 5/17/2013&amp;#160;&amp;#160;&amp;#160; 10.0.0.20&amp;#160;&amp;#160;&amp;#160; captthrace.battlestar.local&amp;#160;&amp;#160;&amp;#160; SMB&amp;#160;&amp;#160;&amp;#160; SMB:C; Negotiate, Dialect = PC NETWORK PROGRAM 1.0, LANMAN1.0, Windows for Workgroups 3.1a, LM1.2X002, LANMAN2.1, NT LM 0.12, SMB 2.002, SMB 2.???&amp;#160;&amp;#160;&amp;#160; {SMBOverTCP:42, TCP:41, IPv4:1}&lt;/font&gt;&lt;/p&gt;    &lt;p&gt;&lt;font size="2" face="Courier New"&gt;302&amp;#160;&amp;#160;&amp;#160; 9:04:40 AM 5/17/2013&amp;#160;&amp;#160;&amp;#160; captthrace.battlestar.local&amp;#160;&amp;#160;&amp;#160; 10.0.0.20&amp;#160;&amp;#160;&amp;#160; SMB2&amp;#160;&amp;#160;&amp;#160; SMB2:R&amp;#160;&amp;#160; NEGOTIATE (0x0), Revision: (0x2ff) - SMB2 wildcard revision number., ServerGUID={97B805C2-296C-477B-82B4-DEB6170A2A01} Authentication Method: GSSAPI,&amp;#160;&amp;#160;&amp;#160;&amp;#160; {SMBOverTCP:42, TCP:41, IPv4:1}&lt;/font&gt;&lt;/p&gt;    &lt;p&gt;&lt;font size="2" face="Courier New"&gt;303&amp;#160;&amp;#160;&amp;#160; 9:04:40 AM 5/17/2013&amp;#160;&amp;#160;&amp;#160; 10.0.0.20&amp;#160;&amp;#160;&amp;#160; captthrace.battlestar.local&amp;#160;&amp;#160;&amp;#160; SMB2&amp;#160;&amp;#160;&amp;#160; SMB2:C&amp;#160;&amp;#160; NEGOTIATE (0x0), ClientGUID= {9CB563F9-BEF4-11E2-9403-00155D4CB97B},&amp;#160;&amp;#160;&amp;#160;&amp;#160; {SMBOverTCP:42, TCP:41, IPv4:1}&lt;/font&gt;&lt;/p&gt;    &lt;p&gt;&lt;font size="2" face="Courier New"&gt;304&amp;#160;&amp;#160;&amp;#160; 9:04:40 AM 5/17/2013&amp;#160;&amp;#160;&amp;#160; captthrace.battlestar.local&amp;#160;&amp;#160;&amp;#160; 10.0.0.20&amp;#160;&amp;#160;&amp;#160; SMB2&amp;#160;&amp;#160;&amp;#160; SMB2:R&amp;#160;&amp;#160; NEGOTIATE (0x0), Revision: (0x300) - SMB 3.0 dialect revision number., ServerGUID={97B805C2-296C-477B-82B4-DEB6170A2A01} Authentication Method: GSSAPI,&amp;#160;&amp;#160;&amp;#160;&amp;#160; {SMBOverTCP:42, TCP:41, IPv4:1}&lt;/font&gt;&lt;/p&gt;    &lt;p&gt;&lt;font size="2" face="Courier New"&gt;323&amp;#160;&amp;#160;&amp;#160; 9:04:40 AM 5/17/2013&amp;#160;&amp;#160;&amp;#160; 10.0.0.20&amp;#160;&amp;#160;&amp;#160; captthrace.battlestar.local&amp;#160;&amp;#160;&amp;#160; SMB2&amp;#160;&amp;#160;&amp;#160; SMB2:C&amp;#160;&amp;#160; SESSION SETUP (0x1) Authentication Method: GSSAPI,&amp;#160;&amp;#160;&amp;#160;&amp;#160; {SMBOverTCP:42, TCP:41, IPv4:1}&lt;/font&gt;&lt;/p&gt;    &lt;p&gt;&lt;font size="2" face="Courier New"&gt;326&amp;#160;&amp;#160;&amp;#160; 9:04:40 AM 5/17/2013&amp;#160;&amp;#160;&amp;#160; captthrace.battlestar.local&amp;#160;&amp;#160;&amp;#160; 10.0.0.20&amp;#160;&amp;#160;&amp;#160; SMB2&amp;#160;&amp;#160;&amp;#160; SMB2:R&amp;#160; - NT Status: System - Error, Code = (22) STATUS_MORE_PROCESSING_REQUIRED&amp;#160; SESSION SETUP (0x1), SessionFlags=0x0 Authentication Method: GSSAPI,&amp;#160;&amp;#160;&amp;#160;&amp;#160; {SMBOverTCP:42, TCP:41, IPv4:1}&lt;/font&gt;&lt;/p&gt;    &lt;p&gt;&lt;font size="2" face="Courier New"&gt;327&amp;#160;&amp;#160;&amp;#160; 9:04:40 AM 5/17/2013&amp;#160;&amp;#160;&amp;#160; 10.0.0.20&amp;#160;&amp;#160;&amp;#160; captthrace.battlestar.local&amp;#160;&amp;#160;&amp;#160; SMB2&amp;#160;&amp;#160;&amp;#160; SMB2:C&amp;#160;&amp;#160; SESSION SETUP (0x1) &lt;font style="background-color: #ffff00"&gt;Authentication Method: GSSAPI&lt;/font&gt;,&amp;#160;&amp;#160;&amp;#160;&amp;#160; {SMBOverTCP:42, TCP:41, IPv4:1}         &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160; - ResponseToken: NTLM AUTHENTICATE MESSAGE Version:&lt;font style="background-color: #ffff00"&gt;NTLM v2&lt;/font&gt;, Workstation: CAPTHELO         &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; Signature: &lt;font style="background-color: #ffff00"&gt;NTLMSSP&lt;/font&gt;&lt;/font&gt;&lt;/p&gt;    &lt;p&gt;&lt;font size="2" face="Courier New"&gt;328&amp;#160;&amp;#160;&amp;#160; 9:04:40 AM 5/17/2013&amp;#160;&amp;#160;&amp;#160; captthrace.battlestar.local&amp;#160;&amp;#160;&amp;#160; 10.0.0.20&amp;#160;&amp;#160;&amp;#160; SMB2&amp;#160;&amp;#160;&amp;#160; SMB2:R&amp;#160; - NT Status: System - &lt;font color="#ff0000"&gt;Error&lt;/font&gt;, &lt;font color="#ff0000"&gt;Code = (34) STATUS_ACCESS_DENIED&lt;/font&gt;&amp;#160; SESSION SETUP (0x1) ,&amp;#160;&amp;#160;&amp;#160;&amp;#160; {SMBOverTCP:42, TCP:41, IPv4:1}&lt;/font&gt;&lt;/p&gt;    &lt;p&gt;&lt;font size="2" face="Courier New"&gt;329&amp;#160;&amp;#160;&amp;#160; 9:04:40 AM 5/17/2013&amp;#160;&amp;#160;&amp;#160; 10.0.0.20&amp;#160;&amp;#160;&amp;#160; captthrace.battlestar.local&amp;#160;&amp;#160;&amp;#160; TCP&amp;#160;&amp;#160;&amp;#160; TCP:Flags=...A.R.., SrcPort=49665, DstPort=Microsoft-DS(445), PayloadLen=0, Seq=2945236632, Ack=2852397926, Win=0 (scale factor 0x8) = 0&amp;#160;&amp;#160;&amp;#160; {TCP:41, IPv4:1}&lt;/font&gt;&lt;/p&gt; &lt;/blockquote&gt;  &lt;p&gt;In the Network Trace we can see that we were trying to connect via NTLM.&amp;#160; I already know that that will be a problem as we have to go Kerberos.&amp;#160; We started supporting Kerberos with Named Pipes starting in SQL 2008, so it should work. At this point, I’m thinking we actually have a Kerberos issue even though it looked like a network issue from the original error message.&amp;#160; So, lets go see if we can validate that.&amp;#160; I already had &lt;a href="http://support.microsoft.com/kb/262177" target="_blank"&gt;Kerberos Event Logging&lt;/a&gt; enabled.&amp;#160; These entries will be located in the System Event Log.&amp;#160; You can ignore errors that show “KDC_ERR_PREAUTH_REQUIRED”.&amp;#160; That is just noise and expected.&amp;#160; Also realize that errors may be cached and if they are, you will not see them in the Event Log or a Network Trace. It may require an IISRESET, a reset of the C2WTS Windows Service, or even a reboot of the box to get the items to show in the Event log or Network Trace. See this &lt;a href="http://blogs.msdn.com/b/psssql/archive/2009/07/01/when-in-doubt-reboot.aspx" target="_blank"&gt;Blog Post&lt;/a&gt;.&lt;/p&gt;  &lt;blockquote&gt;   &lt;p&gt;&lt;font size="2" face="Courier New"&gt;Log Name:&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; System        &lt;br /&gt;Source:&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; Microsoft-Windows-Security-Kerberos         &lt;br /&gt;Date:&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; 5/17/2013 9:04:40 AM         &lt;br /&gt;Event ID:&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; 3         &lt;br /&gt;Task Category: None         &lt;br /&gt;Level:&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; Error         &lt;br /&gt;Keywords:&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; Classic         &lt;br /&gt;User:&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; N/A         &lt;br /&gt;Computer:&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; CaptHelo.battlestar.local         &lt;br /&gt;Description:         &lt;br /&gt;A Kerberos error message was received:         &lt;br /&gt;on logon session         &lt;br /&gt;Client Time:         &lt;br /&gt;Server Time: 14:4:40.0000 5/17/2013 Z         &lt;br /&gt;Error Code: 0xd &lt;font style="background-color: #ffff00"&gt;KDC_ERR_BADOPTION&lt;/font&gt;         &lt;br /&gt;Extended Error: 0xc0000225 KLIN(0)         &lt;br /&gt;Client Realm:         &lt;br /&gt;Client Name:         &lt;br /&gt;Server Realm: BATTLESTAR.LOCAL         &lt;br /&gt;Server Name: &lt;font style="background-color: #00ff00"&gt;cifs/captthrace.battlestar.local&lt;/font&gt;         &lt;br /&gt;Target Name: cifs/captthrace.battlestar.local@BATTLESTAR.LOCAL         &lt;br /&gt;Error Text:         &lt;br /&gt;File: 9         &lt;br /&gt;Line: 12be         &lt;br /&gt;Error Data is in record data.&lt;/font&gt;&lt;/p&gt; &lt;/blockquote&gt;  &lt;p&gt;This entry was the only non-PREAUTH_REQUIRED error.&amp;#160; Two things that were interesting about this.&amp;#160; First was &lt;font style="background-color: #ffff00"&gt;KDC_ERR_BADOPTION&lt;/font&gt;.&amp;#160; When I see this, especially in a Claims type configuration, it tells me we have a Constrained Delegation issue.&amp;#160; The other item that was interesting was the &lt;font style="background-color: #00ff00"&gt;CIFS&lt;/font&gt; SPN.&amp;#160; CIFS is used for File Sharing.&amp;#160; It stands for “Common Internet File System”.&amp;#160; This was our SMB traffic.&amp;#160; We can also see this in the Network Trace.&lt;/p&gt;  &lt;blockquote&gt;   &lt;p&gt;&lt;font size="2" face="Courier New"&gt;319&amp;#160;&amp;#160;&amp;#160; 9:04:40 AM 5/17/2013&amp;#160;&amp;#160;&amp;#160; 10.0.0.20&amp;#160;&amp;#160;&amp;#160; 10.0.0.1&amp;#160;&amp;#160;&amp;#160; KerberosV5&amp;#160;&amp;#160;&amp;#160; KerberosV5:TGS Request Realm: BATTLESTAR.LOCAL Sname: &lt;font style="background-color: #00ff00"&gt;cifs/captthrace.battlestar.local&lt;/font&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160; {TCP:44, IPv4:14}&lt;/font&gt;&lt;/p&gt;    &lt;p&gt;&lt;font size="2" face="Courier New"&gt;321&amp;#160;&amp;#160;&amp;#160; 9:04:40 AM 5/17/2013&amp;#160;&amp;#160;&amp;#160; 10.0.0.1&amp;#160;&amp;#160;&amp;#160; 10.0.0.20&amp;#160;&amp;#160;&amp;#160; KerberosV5&amp;#160;&amp;#160;&amp;#160; &lt;font color="#ff0000"&gt;KerberosV5:KRB_ERROR&amp;#160; - KDC_ERR_BADOPTION (13)&lt;/font&gt;&amp;#160;&amp;#160;&amp;#160; {TCP:44, IPv4:14}&lt;/font&gt;&lt;/p&gt; &lt;/blockquote&gt;  &lt;p&gt;This was interesting, because I never gave Constrained Delegation rights to CIFS for the C2WTS or the Computer Account.&amp;#160; When we talk about SPN’s and Delegation and placement, we talk about that the SPN should be on the account that is running the servers.&amp;#160; For CIFS, it will be the system itself and therefore on the machine account of the SQL Server that we are trying to connect to.&amp;#160; &lt;/p&gt;  &lt;p&gt;CIFS is one of those special Service Classes, similar to HTTP.&amp;#160; It is covered by the HOST SPN on the Machine Account and we won’t see an actual CIFS SPN defined, but when we go to the delegation side of things you will see it.&lt;/p&gt;  &lt;blockquote&gt;   &lt;p&gt;&lt;a href="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-00-73-84-metablogapi/8662.image4_5F00_4CDD7FEF.png"&gt;&lt;img title="image" style="border-top: 0px; border-right: 0px; background-image: none; border-bottom: 0px; padding-top: 0px; padding-left: 0px; border-left: 0px; display: inline; padding-right: 0px" border="0" alt="image" src="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-00-73-84-metablogapi/5852.image4_5F00_thumb_5F00_7DFCBA8F.png" width="368" height="239" /&gt;&lt;/a&gt;&lt;/p&gt;    &lt;p&gt;&lt;a href="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-00-73-84-metablogapi/3324.image7_5F00_0F6D1B68.png"&gt;&lt;img title="image" style="border-top: 0px; border-right: 0px; background-image: none; border-bottom: 0px; padding-top: 0px; padding-left: 0px; border-left: 0px; display: inline; padding-right: 0px" border="0" alt="image" src="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-00-73-84-metablogapi/1185.image7_5F00_thumb_5F00_6EE5DBB5.png" width="364" height="354" /&gt;&lt;/a&gt;&lt;/p&gt; &lt;/blockquote&gt;  &lt;p&gt;I added this to both the Claims Service account and the Computer Account.&amp;#160; I say computer account, because the actual SMB request will come from the machine and not directly from the RS Process.&amp;#160; Under the hoods, it is affectively making a call to the CreateFile Windows API.&amp;#160; &lt;/p&gt;  &lt;p&gt;After resetting IIS and cycling the C2WTS Service, I still saw the same exact error.&amp;#160; This was one of those reboot moments.&amp;#160; After rebooting the server, I then got the following:&lt;/p&gt;  &lt;blockquote&gt;   &lt;p&gt;&lt;a href="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-00-73-84-metablogapi/3326.image_5F00_3C15D541.png"&gt;&lt;img title="image" style="border-left-width: 0px; border-right-width: 0px; background-image: none; border-bottom-width: 0px; padding-top: 0px; padding-left: 0px; margin: 0px; display: inline; padding-right: 0px; border-top-width: 0px" border="0" alt="image" src="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-00-73-84-metablogapi/6076.image_5F00_thumb_5F00_29CD0E7F.png" width="234" height="63" /&gt;&lt;/a&gt;&lt;/p&gt; &lt;/blockquote&gt;  &lt;p&gt;I didn’t necessarily expect this as I expected to fail on the Kerb side to SQL.&amp;#160; So, I ran a report and stuck a WAITFOR DELAY in there so I could see the connection.&amp;#160; had a look at dm_exec_connections on the SQL Server and saw that we had connected with NTLM:&lt;/p&gt;  &lt;blockquote&gt;   &lt;p&gt;&lt;a href="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-00-73-84-metablogapi/5482.image_5F00_497BE847.png"&gt;&lt;img title="image" style="border-left-width: 0px; border-right-width: 0px; background-image: none; border-bottom-width: 0px; padding-top: 0px; padding-left: 0px; display: inline; padding-right: 0px; border-top-width: 0px" border="0" alt="image" src="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-00-73-84-metablogapi/7485.image_5F00_thumb_5F00_490FB552.png" width="428" height="244" /&gt;&lt;/a&gt;&lt;/p&gt; &lt;/blockquote&gt;  &lt;p&gt;For our purposes this will work as I’m not going further than SQL.&amp;#160; This is technically a single hop between the SharePoint Server System context and the SQL Server.&amp;#160; You can configure it for Kerberos if you really want that auth_scheme by creating the appropriate Named Pipes SPN and configuring the appropriate Delegation for the C2WTS Service Account and the Machine Account for where the SMB request is originating from.&amp;#160; Also realize that if you have a misplaced Named Pipes SQL SPN, you will encounter a “Cannot Generate SSPI Context” similar to the following:&lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;blockquote&gt;   &lt;p&gt;&lt;a href="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-00-73-84-metablogapi/4760.image_5F00_48374F68.png"&gt;&lt;img title="image" style="border-top: 0px; border-right: 0px; background-image: none; border-bottom: 0px; padding-top: 0px; padding-left: 0px; border-left: 0px; display: inline; padding-right: 0px" border="0" alt="image" src="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-00-73-84-metablogapi/4375.image_5F00_thumb_5F00_67E62930.png" width="566" height="119" /&gt;&lt;/a&gt;&lt;/p&gt; &lt;/blockquote&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;&lt;font color="#333333"&gt;Adam W. Saxton | Microsoft Escalation Services&lt;/font&gt;     &lt;br /&gt;&lt;a href="http://twitter.com/awsaxton"&gt;http://twitter.com/awsaxton&lt;/a&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=10419751" width="1" height="1"&gt;</content><author><name>Adam W. Saxton</name><uri>http://blogs.msdn.com/awsaxton/ProfileUrlRedirect.ashx</uri></author><category term="Connectivity" scheme="http://blogs.msdn.com/b/psssql/archive/tags/Connectivity/" /><category term="Reporting Services" scheme="http://blogs.msdn.com/b/psssql/archive/tags/Reporting+Services/" /><category term="SharePoint Integration" scheme="http://blogs.msdn.com/b/psssql/archive/tags/SharePoint+Integration/" /><category term="Adam" scheme="http://blogs.msdn.com/b/psssql/archive/tags/Adam/" /><category term="Kerberos" scheme="http://blogs.msdn.com/b/psssql/archive/tags/Kerberos/" /><category term="SharePoint" scheme="http://blogs.msdn.com/b/psssql/archive/tags/SharePoint/" /><category term="SharePoint Adventures" scheme="http://blogs.msdn.com/b/psssql/archive/tags/SharePoint+Adventures/" /><category term="SQL Server 2012" scheme="http://blogs.msdn.com/b/psssql/archive/tags/SQL+Server+2012/" /></entry><entry><title>SharePoint Adventures : When connectivity is not connectivity</title><link rel="alternate" type="text/html" href="http://blogs.msdn.com/b/psssql/archive/2013/05/17/sharepoint-adventures-when-connectivity-is-not-connectivity.aspx" /><id>http://blogs.msdn.com/b/psssql/archive/2013/05/17/sharepoint-adventures-when-connectivity-is-not-connectivity.aspx</id><published>2013-05-17T13:07:29Z</published><updated>2013-05-17T13:07:29Z</updated><content type="html">&lt;p&gt;I’m always amazed that issues usually come in batches.&amp;#160; I was looped into a few cases that had the following symptoms.&amp;#160;&amp;#160; They were running SharePoint 2010 and Reporting Services 2012 SP1.&amp;#160; When they went to use a data source with Windows Authentication, they were seeing the following error:&lt;/p&gt;  &lt;blockquote&gt;   &lt;p&gt;&lt;a href="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-00-73-84-metablogapi/6866.image_5F00_53EDE748.png"&gt;&lt;img title="image" style="border-left-width: 0px; border-right-width: 0px; background-image: none; border-bottom-width: 0px; padding-top: 0px; padding-left: 0px; margin: 0px; display: inline; padding-right: 0px; border-top-width: 0px" border="0" alt="image" src="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-00-73-84-metablogapi/1106.image_5F00_thumb_5F00_5E3F0BA8.png" width="244" height="126" /&gt;&lt;/a&gt;&lt;/p&gt;    &lt;p&gt;&lt;font size="2" face="Courier New"&gt;System.Data.SqlClient.&lt;font color="#ff0000"&gt;SqlException&lt;/font&gt;: A network-related or instance-specific error occurred while establishing a connection to SQL Server. The server was not found or was not accessible. Verify that the instance name is correct and that SQL Server is configured to allow remote connections. (provider: &lt;font color="#ff0000"&gt;&lt;font style="background-color: #ffff00"&gt;Named Pipes Provider&lt;/font&gt;, error: 40 - Could not open a connection to SQL Server&lt;/font&gt;)&lt;/font&gt;&amp;#160;&amp;#160;&amp;#160; &lt;/p&gt; &lt;/blockquote&gt;  &lt;p&gt;This caused me to raise an eyebrow (visions of Spock as the new Star Trek movie is opening today &amp;lt;g&amp;gt;).&amp;#160; A lot of thoughts were floating in my head that all told me that this error didn’t make sense, for a bunch of reasons.&lt;/p&gt;  &lt;ol&gt;   &lt;li&gt;The default protocol order for connecting to SQL from a client is TCP and then Named Pipes.&amp;#160; So, because we failed with a &lt;font style="background-color: #ffff00"&gt;Named Pipes&lt;/font&gt; error, that meant something was either wrong with TCP or someone changed the Protocol order (which I have never seen in a customer case – so very unlikely) &lt;/li&gt;    &lt;li&gt;This is RS 2012, which means we are a Shared Service and rely on the Claims to Windows Token Service (C2WTS).&amp;#160; This forces Constrained Delegation.&amp;#160; Pretty sure most people would not have created the delegation requirements for the Named Pipes SQL SPN as most people go down the TCP route.&amp;#160; You can read more about SQL’s SPNs being Protocol based &lt;a href="http://blogs.msdn.com/b/psssql/archive/2010/03/09/what-spn-do-i-use-and-how-does-it-get-there.aspx" target="_blank"&gt;here&lt;/a&gt;.&amp;#160; Also more on this related aspect in a later post as I found some interesting things about this as well. &lt;/li&gt;    &lt;li&gt;This error tells me that we couldn’t establish a connection to SQL via Named Pipes.&amp;#160; Think of this as a “Server Not Found” type error.&amp;#160; I immediately tossed out any Kerberos/Claims related issue due to that thinking – again more on the kerb piece of this in a later post. &lt;/li&gt;    &lt;li&gt;This is really the first time I’ve had someone hit me up with a Named Pipes connection failure from an RS/SharePoint Integration perspective ever.&amp;#160; And I just got hit with 3 of them within the same week.&amp;#160; Something is up. &lt;/li&gt; &lt;/ol&gt;  &lt;p&gt;Being this told me we had an actual connection issue via Named Pipes, I started down the normal connectivity troubleshooting path.&amp;#160; With any connectivity issue, I started with a UDL (Universal Data Link) file.&amp;#160; Basically just a text file renamed with an extension of UDL.&amp;#160; It’s important to run this from the same machine that is hitting the SqlException.&amp;#160; In my case it was my SharePoint App server, not the WFE server.&lt;/p&gt;  &lt;blockquote&gt;   &lt;p&gt;&lt;a href="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-00-73-84-metablogapi/1602.image_5F00_5DD2D8B3.png"&gt;&lt;img title="image" style="border-left-width: 0px; border-right-width: 0px; background-image: none; border-bottom-width: 0px; padding-top: 0px; padding-left: 0px; display: inline; padding-right: 0px; border-top-width: 0px" border="0" alt="image" src="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-00-73-84-metablogapi/3660.image_5F00_thumb_5F00_5D66A5BE.png" width="341" height="357" /&gt;&lt;/a&gt;&lt;/p&gt; &lt;/blockquote&gt;  &lt;p&gt;You’ll notice the “np:” in front of the server name.&amp;#160; This forces the Named Pipes Protocol and ignores the default protocol order.&amp;#160; And this worked.&amp;#160; I also tried “tcp:” to force TCP in the UDL and this worked to.&amp;#160; I went back to my data source and tried forcing TCP there.&lt;/p&gt;  &lt;blockquote&gt;   &lt;p&gt;&lt;a href="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-00-73-84-metablogapi/3276.image_5F00_3CDF660C.png"&gt;&lt;img title="image" style="border-left-width: 0px; border-right-width: 0px; background-image: none; border-bottom-width: 0px; padding-top: 0px; padding-left: 0px; display: inline; padding-right: 0px; border-top-width: 0px" border="0" alt="image" src="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-00-73-84-metablogapi/5861.image_5F00_thumb_5F00_3C733317.png" width="340" height="413" /&gt;&lt;/a&gt;&lt;/p&gt;    &lt;p&gt;&lt;font size="2" face="Courier New"&gt;System.Data.SqlClient.&lt;font color="#ff0000"&gt;SqlException&lt;/font&gt;: A network-related or instance-specific error occurred while establishing a connection to SQL Server. The server was not found or was not accessible. Verify that the instance name is correct and that SQL Server is configured to allow remote connections. (provider: &lt;font color="#ff0000"&gt;&lt;font style="background-color: #ffff00"&gt;TCP Provider&lt;/font&gt;, error: 0 - The requested name is valid, but no data of the requested type was found.)&lt;/font&gt;&lt;/font&gt; &lt;/p&gt; &lt;/blockquote&gt;  &lt;p&gt;This made no sense.&amp;#160; I even made sure I was logged in as the RS Service Account as that is the context in which we would have been connecting to SQL.&amp;#160; Same result.&amp;#160; Also, within a network trace, I saw nothing on either the TCP or Named Pipes side of the house in the trace that related to this connection attempt.&amp;#160; Which meant we never hit the wire.&amp;#160; &lt;/p&gt;  &lt;p&gt;As I was going to collect some additional diagnostic logging (Kerberos ETW tracing and LSASS Logging) I ended up doing an IISRESET and a recycle of the C2WTS service.&amp;#160; We went to reproduce the issue, but got a different error this time.&lt;/p&gt;  &lt;blockquote&gt;   &lt;p&gt;&lt;a href="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-00-73-84-metablogapi/6740.image_5F00_10C2691B.png"&gt;&lt;img title="image" style="border-left-width: 0px; border-right-width: 0px; background-image: none; border-bottom-width: 0px; padding-top: 0px; padding-left: 0px; display: inline; padding-right: 0px; border-top-width: 0px" border="0" alt="image" src="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-00-73-84-metablogapi/4721.image_5F00_thumb_5F00_307142E3.png" width="395" height="129" /&gt;&lt;/a&gt;&lt;/p&gt;    &lt;p&gt;&lt;font size="2" face="Courier New"&gt;System.IO.&lt;font color="#ff0000"&gt;FileLoadException&lt;/font&gt;: &lt;font color="#ff0000"&gt;Could not load file or assembly 'System.EnterpriseServices&lt;/font&gt;, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. Either a required impersonation level was not provided, or the provided impersonation level is invalid. (Exception from HRESULT: 0x80070542)&amp;#160; File name: 'System.EnterpriseServices, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' ---&amp;gt; System.Runtime.InteropServices.COMException (0x80070542): Either a required impersonation level was not provided, or the provided impersonation level is invalid. (Exception from HRESULT: 0x80070542)&lt;/font&gt;&amp;#160;&amp;#160;&amp;#160; &lt;/p&gt; &lt;/blockquote&gt;  &lt;p&gt;This error I did know and can work with.&amp;#160; I had blogged about this error last July &lt;a href="http://blogs.msdn.com/b/psssql/archive/2012/07/11/could-not-load-file-or-assembly-system-enterpriseservices.aspx" target="_blank"&gt;here&lt;/a&gt;.&amp;#160; Checking the “Act as part of the operating system” showed that the C2WTS service account in fact was not given that right.&amp;#160; Adding that account to that policy right and restarting the C2WTS Windows Service and performing an IISRESET then yielded the following:&lt;/p&gt;  &lt;blockquote&gt;   &lt;p&gt;&lt;a href="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-00-73-84-metablogapi/6862.image_5F00_6FCEF673.png"&gt;&lt;img title="image" style="border-left-width: 0px; border-right-width: 0px; background-image: none; border-bottom-width: 0px; padding-top: 0px; padding-left: 0px; display: inline; padding-right: 0px; border-top-width: 0px" border="0" alt="image" src="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-00-73-84-metablogapi/2063.image_5F00_thumb_5F00_1AA75A86.png" width="279" height="75" /&gt;&lt;/a&gt;&lt;/p&gt; &lt;/blockquote&gt;  &lt;p&gt;The connectivity errors were clearly related to the lack of the Policy Setting.&amp;#160; It was unexpected and didn’t line up with normal connectivity related issues and also wasn’t very helpful with regards of where to go look for more information as all of the normal paths didn’t show anything useful.&lt;/p&gt;  &lt;p&gt;Of note, I tried reproducing this on SharePoint 2013, but only got the FileLoadException.&amp;#160; I think this is partly a timing issue with how IIS AppPools are started and the C2WTS service is started.&amp;#160; Doesn’t mean you won’t see this on SharePoint 2013 necessarily.&amp;#160; Even on SharePoint 2010, the first time I hit the FileLoadException.&lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;&lt;font color="#333333"&gt;Adam W. Saxton | Microsoft Escalation Services      &lt;br /&gt;&lt;/font&gt;&lt;a href="http://twitter.com/awsaxton"&gt;http://twitter.com/awsaxton&lt;/a&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=10419658" width="1" height="1"&gt;</content><author><name>Adam W. Saxton</name><uri>http://blogs.msdn.com/awsaxton/ProfileUrlRedirect.ashx</uri></author><category term="Connectivity" scheme="http://blogs.msdn.com/b/psssql/archive/tags/Connectivity/" /><category term="Reporting Services" scheme="http://blogs.msdn.com/b/psssql/archive/tags/Reporting+Services/" /><category term="SharePoint Integration" scheme="http://blogs.msdn.com/b/psssql/archive/tags/SharePoint+Integration/" /><category term="Adam" scheme="http://blogs.msdn.com/b/psssql/archive/tags/Adam/" /><category term="SharePoint Adventures" scheme="http://blogs.msdn.com/b/psssql/archive/tags/SharePoint+Adventures/" /><category term="Claims" scheme="http://blogs.msdn.com/b/psssql/archive/tags/Claims/" /><category term="SQL Server 2012" scheme="http://blogs.msdn.com/b/psssql/archive/tags/SQL+Server+2012/" /></entry><entry><title>SQL Server–Storage Spaces/VHDx and 4K Sector Size</title><link rel="alternate" type="text/html" href="http://blogs.msdn.com/b/psssql/archive/2013/05/15/sql-server-storage-spaces-vhdx-and-4k-sector-size.aspx" /><id>http://blogs.msdn.com/b/psssql/archive/2013/05/15/sql-server-storage-spaces-vhdx-and-4k-sector-size.aspx</id><published>2013-05-15T14:40:25Z</published><updated>2013-05-15T14:40:25Z</updated><content type="html">&lt;p&gt;This blog outlines a new twist to my previous blog outlining issues with 4K sector sizes.&lt;/p&gt;  &lt;p&gt;&lt;strong&gt;SQL Server - New Drives Use 4K Sector Size: &lt;/strong&gt;&lt;a href="http://blogs.msdn.com/b/psssql/archive/2011/01/13/sql-server-new-drives-use-4k-sector-size.aspx"&gt;http://blogs.msdn.com/b/psssql/archive/2011/01/13/sql-server-new-drives-use-4k-sector-size.aspx&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;In the previous post I discussed that it was &lt;font color="#c0504d"&gt;unsafe for the I/O subsystem to present a sector size that was smaller than the actual, physical sector size&lt;/font&gt;.&amp;#160;&amp;#160; This leads to unsupported, Read-Modify-Write (RMW) behavior.&lt;/p&gt;  &lt;p&gt;I was doing testing on a Windows 2012 Server - Storage Space setup and found that both Storage Spaces and the VHDx format can report a 4K sector size to the SQL Server.&amp;#160;&amp;#160; This allows the various drives setup in the pool for Storage Spaces to be of disparate sector sizes (Drive 1 = 512 bytes, 1K, 2K, and Drive 4 = 4K.)&amp;#160; &lt;/p&gt;  &lt;p&gt;&lt;em&gt;&lt;strong&gt;Is this safe for SQL Server?&lt;/strong&gt;&lt;/em&gt;&lt;/p&gt;  &lt;p&gt;&lt;strong&gt;The answer is yes&lt;/strong&gt;.&amp;#160; An I/O subsystem can return a larger sector size than actual, physical sector size as long as all reported values can be evenly divided by 512 bytes.&lt;/p&gt;  &lt;p&gt;As the diagram below shows, SQL Server maintains parity on 512 byte boundaries, for the log, regardless of the reported sector size.&amp;#160;&amp;#160; This allows SQL Server to detect a partial write (torn behavior.)&amp;#160;&amp;#160; For example, if the system reported a sector size of 4K but the physical sector size was 512 bytes, &lt;em&gt;the I/O subsystem is only guaranteed to flush to a 512 byte mark&lt;/em&gt;.&amp;#160;&amp;#160; If the first 4, physical sectors are flushed (2K of the 4K aligned block) and a power outage occurs, SQL Server will be able to detect the entire 4K was not properly flushed.&lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;&lt;a href="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-00-73-84-metablogapi/3644.image_5F00_4C8F684E.png"&gt;&lt;img title="image" style="border: 0px currentcolor; margin-right: auto; margin-left: auto; float: none; display: block; background-image: none;" border="0" alt="image" src="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-00-73-84-metablogapi/7382.image_5F00_thumb_5F00_39DA6E97.png" width="457" height="160" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;Without the logical parity every 512 bytes SQL Server would be unable to detect the torn situation, leading to unexpected recovery and logging behavior(s).&lt;/p&gt;  &lt;p&gt;&lt;strong&gt;&lt;font color="#c0504d"&gt;WARNING:&lt;/font&gt;&lt;/strong&gt;&amp;#160; While SQL Server protects your data against such a failure the reporting of sector size, larger than physical sector size, can lead to unwanted/unexpected space usage.&amp;#160;&amp;#160; SQL Server will align the log writes to the reported sector size (4K in this example.)&amp;#160; &lt;/p&gt;  &lt;p&gt;SQL Server packs records within the log blocks and then aligns/pads the writes on the reported sector boundary.&amp;#160; Lots of small transactions, leading to many log flushes, can result in wasted log space for a system reporting larger sector sizes.&amp;#160;&amp;#160; Moving the scenario to an I/O subsystem reporting smaller sector sizes can reduce space usage.&lt;/p&gt;  &lt;p&gt;The easiest way to see this in action is a single worker doing tiny transactions.&lt;/p&gt;  &lt;blockquote&gt;   &lt;p&gt;while(1=1)&lt;/p&gt;    &lt;p&gt;begin&lt;/p&gt;    &lt;p&gt;&amp;#160;&amp;#160; insert into tblTest values (1)&amp;#160;&amp;#160; // Each insert is a transaction and a log flush&lt;/p&gt;    &lt;p&gt;end&lt;/p&gt; &lt;/blockquote&gt;  &lt;p&gt;Each insert is a separate commit transaction, causing the log to be flushed for each iteration.&amp;#160;&amp;#160; In this example each insert will require at least 4K of log space to properly align during the flush.&amp;#160;&amp;#160;&amp;#160; Wrapping a transaction around the while loop or only committing at reasonable boundaries (say 10,000 inserts) reduces the log flushing behavior and uses the log space more effectively.&lt;/p&gt;  &lt;p&gt;&lt;span style="color: rgb(166, 166, 166); font-family: &amp;quot;Calibri&amp;quot;,&amp;quot;sans-serif&amp;quot;; font-size: 8pt; mso-fareast-font-family: &amp;quot;Times New Roman&amp;quot;; mso-ansi-language: en-us; mso-fareast-language: en-us; mso-bidi-language: ar-sa; mso-bidi-font-family: &amp;quot;Times New Roman&amp;quot;; mso-ascii-theme-font: minor-latin; mso-fareast-theme-font: minor-fareast; mso-hansi-theme-font: minor-latin; mso-no-proof: yes;"&gt;Bob Dorr - Principal SQL Server Escalation Engineer&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=10418924" width="1" height="1"&gt;</content><author><name>psssql</name><uri>http://blogs.msdn.com/psssql/ProfileUrlRedirect.ashx</uri></author><category term="Engine" scheme="http://blogs.msdn.com/b/psssql/archive/tags/Engine/" /><category term="2005 SP2" scheme="http://blogs.msdn.com/b/psssql/archive/tags/2005+SP2/" /><category term="2008" scheme="http://blogs.msdn.com/b/psssql/archive/tags/2008/" /><category term="2005" scheme="http://blogs.msdn.com/b/psssql/archive/tags/2005/" /><category term="SQL 2005" scheme="http://blogs.msdn.com/b/psssql/archive/tags/SQL+2005/" /><category term="SQL 2008" scheme="http://blogs.msdn.com/b/psssql/archive/tags/SQL+2008/" /><category term="SQL 2012" scheme="http://blogs.msdn.com/b/psssql/archive/tags/SQL+2012/" /><category term="SQL Server 2012" scheme="http://blogs.msdn.com/b/psssql/archive/tags/SQL+Server+2012/" /></entry><entry><title>Using PowerShell to discover Reporting Services 2012 in SharePoint</title><link rel="alternate" type="text/html" href="http://blogs.msdn.com/b/psssql/archive/2013/04/30/using-powershell-to-discover-reporting-services-2012-in-sharepoint.aspx" /><id>http://blogs.msdn.com/b/psssql/archive/2013/04/30/using-powershell-to-discover-reporting-services-2012-in-sharepoint.aspx</id><published>2013-04-30T18:58:46Z</published><updated>2013-04-30T18:58:46Z</updated><content type="html">&lt;p&gt;I was recently going through an exercise of documenting how to discover certain aspects of Reporting Services for some Kerberos work.&amp;#160; RS 2012 in SharePoint is a totally different game though.&amp;#160; The easiest way I could discover certain items about Reporting Services within SharePoint was with PowerShell.&amp;#160; For previous versions, and RS 2012 in Native Mode, we can use other avenues such as WMI to discover configuration of Reporting Services.&lt;/p&gt;  &lt;h2&gt;Service Enumeration&lt;/h2&gt;  &lt;p&gt;One of the big things we want to do when we are discovering what is out there is to be able to tell if we even have the service installed.&amp;#160; This may also lead to multiple services within SharePoint.&amp;#160; Within SQL 2012, Reporting Services is a Shared Service within SharePoint and is deployed as such. We could run the following to see the Service Applications that are configured.&lt;/p&gt;  &lt;blockquote&gt;   &lt;p&gt;&lt;font size="2" face="Courier New"&gt;Get-SPServiceApplication |where {$_.TypeName -like &amp;quot;SQL Server Reporting*&amp;quot;}&lt;/font&gt;&lt;/p&gt; &lt;/blockquote&gt;  &lt;blockquote&gt;   &lt;p&gt;&lt;a href="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-00-73-84-metablogapi/7711.image_5F00_600E754E.png"&gt;&lt;img title="image" style="border-top: 0px; border-right: 0px; background-image: none; border-bottom: 0px; padding-top: 0px; padding-left: 0px; border-left: 0px; display: inline; padding-right: 0px" border="0" alt="image" src="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-00-73-84-metablogapi/5483.image_5F00_thumb_5F00_3867F924.png" width="600" height="106" /&gt;&lt;/a&gt;&lt;/p&gt; &lt;/blockquote&gt;  &lt;p&gt;This aligns with what we see in Central Admin as well.&lt;/p&gt;  &lt;blockquote&gt;   &lt;p&gt;&lt;a href="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-00-73-84-metablogapi/5008.image_5F00_02EF36FF.png"&gt;&lt;img title="image" style="border-top: 0px; border-right: 0px; background-image: none; border-bottom: 0px; padding-top: 0px; padding-left: 0px; border-left: 0px; display: inline; padding-right: 0px" border="0" alt="image" src="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-00-73-84-metablogapi/3513.image_5F00_thumb_5F00_1774867D.png" width="469" height="302" /&gt;&lt;/a&gt;&lt;/p&gt; &lt;/blockquote&gt;  &lt;p&gt;From the Kerberos/Claims configuration perspective, we are also interested in the Service Account for the Reporting Services Application. Also keeping in mind that there may be more than one.&lt;/p&gt;  &lt;blockquote&gt;   &lt;p&gt;&lt;font size="2" face="Courier New"&gt;$apps = Get-SPServiceApplication |where {$_.TypeName -like &amp;quot;SQL Server Reporting*&amp;quot;}       &lt;br /&gt;foreach ($app in $apps){&amp;quot;{0,-20} {1,-20}&amp;quot; -f $app.name, $app.ApplicationPool.ProcessAccountName}&lt;/font&gt;&lt;/p&gt; &lt;/blockquote&gt;  &lt;blockquote&gt;   &lt;p&gt;&lt;a href="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-00-73-84-metablogapi/6558.image_5F00_56D23A0D.png"&gt;&lt;img title="image" style="border-top: 0px; border-right: 0px; background-image: none; border-bottom: 0px; padding-top: 0px; padding-left: 0px; border-left: 0px; display: inline; padding-right: 0px" border="0" alt="image" src="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-00-73-84-metablogapi/6560.image_5F00_thumb_5F00_0F7CE41B.png" width="712" height="75" /&gt;&lt;/a&gt;&lt;/p&gt; &lt;/blockquote&gt;  &lt;p&gt;We can see that the name is “Reporting Services” and the AppPool Process Account is “BATTLESTAR\rsservice”. The next piece of information we want to know is which SharePoint boxes is this service running on?&amp;#160; We could have any number of App Servers that we need to go check.&lt;/p&gt;  &lt;blockquote&gt;   &lt;p&gt;&lt;font size="2" face="Courier New"&gt;$services = Get-SPServiceInstance |where {$_.TypeName –like &amp;quot;*Reporting*&amp;quot;}       &lt;br /&gt;foreach ($service in $services){&amp;quot;{0,-20} {1,-20}&amp;quot; -f $service.parent.address, $service.status}&lt;/font&gt;&lt;/p&gt; &lt;/blockquote&gt;  &lt;blockquote&gt;   &lt;p&gt;&lt;a href="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-00-73-84-metablogapi/2043.image_5F00_410851B0.png"&gt;&lt;img title="image" style="border-top: 0px; border-right: 0px; background-image: none; border-bottom: 0px; padding-top: 0px; padding-left: 0px; border-left: 0px; display: inline; padding-right: 0px" border="0" alt="image" src="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-00-73-84-metablogapi/0602.image_5F00_thumb_5F00_60B72B78.png" width="709" height="75" /&gt;&lt;/a&gt;&lt;/p&gt; &lt;/blockquote&gt;  &lt;p&gt;In this example, I only have one server that has the Reporting Services Service started within SharePoint and that is on the CAPTHELO server. We can then compare with the Claims to Windows Token Service (C2WTS).&lt;/p&gt;  &lt;h3&gt;Claims to Windows Token Service (C2WTS)&lt;/h3&gt;  &lt;p&gt;As part of SQL 2012 with SharePoint Integration, the Claims to Windows Token Service plays a big part in our functionality when it comes to Kerberos. As such, if we are going to validate RS 2012 in SharePoint configuration, we need to look at C2WTS as well. We can use the following PowerShell command to get the C2WTS instances:&lt;/p&gt;  &lt;blockquote&gt;   &lt;p&gt;&lt;font size="2" face="Courier New"&gt;Get-SPServiceInstance |where {$_.TypeName -like &amp;quot;*Claims*&amp;quot;}&lt;/font&gt;&lt;/p&gt; &lt;/blockquote&gt;  &lt;p&gt;One thing to remember is that C2WTS is not a service app.&amp;#160; You may see multiple items here if they have more than one SharePoint Server.&amp;#160; For example, in my environment I have two SharePoint Servers:&lt;/p&gt;  &lt;blockquote&gt;   &lt;p&gt;&lt;a href="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-00-73-84-metablogapi/5076.image_5F00_604AF883.png"&gt;&lt;img title="image" style="border-top: 0px; border-right: 0px; background-image: none; border-bottom: 0px; padding-top: 0px; padding-left: 0px; border-left: 0px; display: inline; padding-right: 0px" border="0" alt="image" src="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-00-73-84-metablogapi/1362.image_5F00_thumb_5F00_2DE72504.png" width="714" height="110" /&gt;&lt;/a&gt;&lt;/p&gt; &lt;/blockquote&gt;  &lt;p&gt;The service only needs to be started on the SharePoint Box where the Reporting Services Shared Service is started as well. In the Reporting Services example above, we know that Reporting Services is only active on CAPTHELO, so that is where C2WTS needs to be started.&lt;/p&gt;  &lt;blockquote&gt;   &lt;p&gt;&lt;font size="2" face="Courier New"&gt;$services = Get-SPServiceInstance |where {$_.TypeName –like &amp;quot;*Claims*&amp;quot;}       &lt;br /&gt;foreach ($service in $services){&amp;quot;{0,-20} {1,-20} {2}&amp;quot; -f $service.parent.address, $service.status, $service.Service.ProcessIdentity.username}&lt;/font&gt;      &lt;br /&gt;&lt;/p&gt; &lt;/blockquote&gt;  &lt;blockquote&gt;   &lt;p&gt;&lt;a href="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-00-73-84-metablogapi/5670.image_5F00_4676C254.png"&gt;&lt;img title="image" style="border-top: 0px; border-right: 0px; background-image: none; border-bottom: 0px; padding-top: 0px; padding-left: 0px; border-left: 0px; display: inline; padding-right: 0px" border="0" alt="image" src="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-00-73-84-metablogapi/0285.image_5F00_thumb_5F00_7B171E8F.png" width="729" height="104" /&gt;&lt;/a&gt;&lt;/p&gt; &lt;/blockquote&gt;  &lt;p&gt;We can see that we have two SharePoint servers here.&amp;#160; C2WTS is started on LTBOOMER but it is not running on CAPTHELO.&amp;#160; This will result in an error such as the following:&lt;/p&gt;  &lt;blockquote&gt;   &lt;p&gt;&lt;a href="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-00-73-84-metablogapi/8231.image_5F00_2CA28C25.png"&gt;&lt;img title="image" style="border-top: 0px; border-right: 0px; background-image: none; border-bottom: 0px; padding-top: 0px; padding-left: 0px; border-left: 0px; display: inline; padding-right: 0px" border="0" alt="image" src="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-00-73-84-metablogapi/6175.image_5F00_thumb_5F00_4C5165ED.png" width="450" height="97" /&gt;&lt;/a&gt;&lt;/p&gt; &lt;/blockquote&gt;  &lt;blockquote&gt;   &lt;p&gt;&lt;font size="2" face="Courier New"&gt;Throwing Microsoft.ReportingServices.Diagnostics.Utilities.ClaimsToWindowsTokenLoginTypeException: , Microsoft.ReportingServices.Diagnostics.Utilities.ClaimsToWindowsTokenLoginTypeException: &lt;font color="#ff0000"&gt;Can not convert claims identity to windows token&lt;/font&gt;. This may be due to user not logging in using windows credentials.;&lt;/font&gt;&amp;#160; &lt;/p&gt; &lt;/blockquote&gt;  &lt;p&gt;From the last command above, we can also see the Process Identity for the C2WTS.&amp;#160; So, this will provide the service accounts for both Reporting Services and C2WTS as well as let us know which servers Reporting Services is enabled on and which servers C2WTS needs to be enabled on.&amp;#160; This could be very helpful when it comes to automation.&lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;Adam W. Saxton | Microsoft Escalation Services    &lt;br /&gt;&lt;a href="http://twitter.com/awsaxton"&gt;http://twitter.com/awsaxton&lt;/a&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=10415178" width="1" height="1"&gt;</content><author><name>Adam W. Saxton</name><uri>http://blogs.msdn.com/awsaxton/ProfileUrlRedirect.ashx</uri></author><category term="Reporting Services" scheme="http://blogs.msdn.com/b/psssql/archive/tags/Reporting+Services/" /><category term="SharePoint Integration" scheme="http://blogs.msdn.com/b/psssql/archive/tags/SharePoint+Integration/" /><category term="PowerShell" scheme="http://blogs.msdn.com/b/psssql/archive/tags/PowerShell/" /><category term="Adam" scheme="http://blogs.msdn.com/b/psssql/archive/tags/Adam/" /><category term="SharePoint Adventures" scheme="http://blogs.msdn.com/b/psssql/archive/tags/SharePoint+Adventures/" /><category term="SQL Server 2012" scheme="http://blogs.msdn.com/b/psssql/archive/tags/SQL+Server+2012/" /></entry><entry><title>AlwaysON - HADRON Learning Series: lock_redo_blocked/redo worker Blocked on Secondary Replica</title><link rel="alternate" type="text/html" href="http://blogs.msdn.com/b/psssql/archive/2013/04/26/alwayson-hadron-learning-series-lock-redo-blocked-redo-worker-blocked-on-secondary-replica.aspx" /><id>http://blogs.msdn.com/b/psssql/archive/2013/04/26/alwayson-hadron-learning-series-lock-redo-blocked-redo-worker-blocked-on-secondary-replica.aspx</id><published>2013-04-26T18:34:06Z</published><updated>2013-04-26T18:34:06Z</updated><content type="html">&lt;p&gt;The topic I received most in my inbox this week was &lt;em&gt;&lt;strong&gt;redo blocked on a secondary&lt;/strong&gt;&lt;/em&gt; while attempting to acquire SCH-M (schema modify) lock.&lt;/p&gt;  &lt;p&gt;First of all, this is expected behavior and you can monitor for this with your standard blocking activities (sys.dm_exec_requests, blocked process TRC event, blocked process threshold configuration setting(s) and the log_redo_blocked XEvent.)&lt;/p&gt;  &lt;p&gt;The SQL Server 2012 implementation of Always On extended the database mirroring (DBM) capabilities by allowing read only queries and backups against a secondary replica.&amp;#160;&amp;#160; With this new activity comes additional overhead.&lt;/p&gt;  &lt;blockquote&gt;   &lt;p&gt;1. When a replica is marked for read only capabilities the updated/inserted rows on primary add additional overhead for the row versioning to help support snapshot isolation activities of the read only connections.&lt;/p&gt;    &lt;p&gt;2. When queries are run against the secondary the SCH-S (schema stability) lock is held during the query to make sure the schema of the object can’t be changed during the processing of results.&lt;/p&gt; &lt;/blockquote&gt;  &lt;p&gt;In the case of the blocked, redo the read only clients typically have long running queries and the object is changed (ALTER, create index, …) on the primary.&amp;#160;&amp;#160; When the DDL activity arrives on the secondary the SCH-M is required to complete the requested, redo change.&amp;#160;&amp;#160;&amp;#160; This causes the redo worker to become blocked on the long running, read only query(s).&lt;/p&gt;  &lt;p&gt;You can monitor the redo queue size and other performance counters to determine the relative impact of redo being blocked and make any necessary business decisions to KILL the head blocker(s).&amp;#160; It will look no different than a production server with a head blocker that you resolve today.&lt;/p&gt;  &lt;p&gt;Microsoft is evaluating, for future builds, the ability to configure a replica to automatically kill a redo blocker, allowing redo to progress.&lt;/p&gt;  &lt;p&gt;&lt;font color="#cccccc" face="Calibri"&gt;Bob Dorr - Principal SQL Server Escalation Engineer&lt;/font&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=10414339" width="1" height="1"&gt;</content><author><name>psssql</name><uri>http://blogs.msdn.com/psssql/ProfileUrlRedirect.ashx</uri></author><category term="AlwaysON" scheme="http://blogs.msdn.com/b/psssql/archive/tags/AlwaysON/" /><category term="SQL Server 2012" scheme="http://blogs.msdn.com/b/psssql/archive/tags/SQL+Server+2012/" /></entry><entry><title>AlwaysON - HADRON Learning Series: HADR_SYNC_COMMIT vs WRITELOG wait</title><link rel="alternate" type="text/html" href="http://blogs.msdn.com/b/psssql/archive/2013/04/26/alwayson-hadron-learning-series-hadr-sync-commit-vs-writelog-wait.aspx" /><id>http://blogs.msdn.com/b/psssql/archive/2013/04/26/alwayson-hadron-learning-series-hadr-sync-commit-vs-writelog-wait.aspx</id><published>2013-04-26T16:54:25Z</published><updated>2013-04-26T16:54:25Z</updated><content type="html">&lt;p&gt;The distinction between these two wait types is subtle but very helpful in tuning your Always On environment.&lt;/p&gt;  &lt;p&gt;The committing of a transaction means the log block must be written locally as well as remotely for synchronous replicas.&amp;#160;&amp;#160; When in synchronized state this involves specific waits for both the local and remote, log block, harden operations.&lt;/p&gt;  &lt;p&gt;&lt;strong&gt;HADR_SYNC_COMMIT&lt;/strong&gt; = Waiting on response from remote replica that the log block has been hardened.&amp;#160; &lt;em&gt;This does not mean the remote, redo has occurred&lt;/em&gt; but instead that the log block as been successfully stored on stable media at the remote, replica.&amp;#160; You can watch the remote, response behavior using the XEvent: &lt;em&gt;hadr_db_commit_mgr_update_harden&lt;/em&gt;.&lt;/p&gt;  &lt;p&gt;&lt;strong&gt;WRITELOG&lt;/strong&gt; = Waiting on local I/O to complete for the specified log block.&lt;/p&gt;  &lt;p&gt;The design puts the local and remote log block writes in motion at the same time (async) and then waits for their completion.&amp;#160;&amp;#160; The wait order is 1) remote replica(s) and 2) the local log.&lt;/p&gt;  &lt;p&gt;The &lt;strong&gt;HADR_SYNC_COMMIT&lt;/strong&gt; is usually the longer of the waits because it involves shipping the log block to the replica, writing to stable media on the replica and getting a response back.&amp;#160;&amp;#160; By waiting on the longer operation first the wait for the local write is often avoided.&amp;#160; &lt;/p&gt;  &lt;p&gt;Once the response is received any wait on the local (primary), log (&lt;strong&gt;WRITELOG&lt;/strong&gt;) occurs as necessary.&lt;/p&gt;  &lt;p&gt;Accumulation of HADR_SYNC_COMMIT wait time is the remote activity and you should look at the network and log flushing activities on the remote replica.&lt;/p&gt;  &lt;p&gt;Accumulation of WRITELOG wait time is the local log flushing and you should look at the local I/O path constraints.&lt;/p&gt;  &lt;p&gt;&lt;strong&gt;Reference&lt;/strong&gt;: &lt;a href="http://blogs.msdn.com/b/psssql/archive/2011/04/01/alwayson-hadron-learning-series-how-does-alwayson-process-a-synchronous-commit-request.aspx"&gt;http://blogs.msdn.com/b/psssql/archive/2011/04/01/alwayson-hadron-learning-series-how-does-alwayson-process-a-synchronous-commit-request.aspx&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;&lt;strong&gt;Reference&lt;/strong&gt;: &lt;a href="http://blogs.msdn.com/b/psssql/archive/2013/04/22/how-it-works-always-on-when-is-my-secondary-failover-ready.aspx"&gt;http://blogs.msdn.com/b/psssql/archive/2013/04/22/how-it-works-always-on-when-is-my-secondary-failover-ready.aspx&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;&lt;font color="#cccccc" face="Calibri"&gt;Bob Dorr - Principal SQL Server Escalation Engineer&lt;/font&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=10414296" width="1" height="1"&gt;</content><author><name>psssql</name><uri>http://blogs.msdn.com/psssql/ProfileUrlRedirect.ashx</uri></author><category term="AlwaysON" scheme="http://blogs.msdn.com/b/psssql/archive/tags/AlwaysON/" /><category term="SQL Server 2012" scheme="http://blogs.msdn.com/b/psssql/archive/tags/SQL+Server+2012/" /></entry><entry><title>How It Works: Always On–When Is My Secondary Failover Ready?</title><link rel="alternate" type="text/html" href="http://blogs.msdn.com/b/psssql/archive/2013/04/22/how-it-works-always-on-when-is-my-secondary-failover-ready.aspx" /><id>http://blogs.msdn.com/b/psssql/archive/2013/04/22/how-it-works-always-on-when-is-my-secondary-failover-ready.aspx</id><published>2013-04-22T14:35:21Z</published><updated>2013-04-22T14:35:21Z</updated><content type="html">&lt;p&gt;I keep running into the question: “When will my secondary allow automatic failover?”&amp;#160;&amp;#160; Based on the question I did some extended research and I will try to summarize in is blog post.&amp;#160; I don’t want to turn this post into a novel so I am going to take some liberties and assume you have read SQL Server Books Online topics related to Always On failover.&lt;/p&gt;  &lt;p&gt;&lt;strong&gt;The easy answer:&lt;/strong&gt;&amp;#160; Only when the secondary is marked SYNCHRONIZED.&amp;#160; - End of blog right? – not quite!&lt;/p&gt;  &lt;p&gt;At a 10,000 foot level that statement is easy enough to understand but the issue is really understanding what constitutes SYNCHRONIZED.&amp;#160;&amp;#160; There are several state machines that determine the NOT vs SYNCHRONIZED state.&amp;#160; These states are maintained using multiple worker threads and at different locations to keep the system functional and fast.&lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;Secondary Connection State&lt;/li&gt;    &lt;li&gt;End Of Log Reached State&lt;/li&gt; &lt;/ul&gt;  &lt;p&gt;To understand these states I need to discuss a few concepts to make sure we are all on the same page.&lt;/p&gt;  &lt;p&gt;&lt;strong&gt;Not Replicating Commits – Log Blocks Are The Replication Unit&lt;/strong&gt;&lt;/p&gt;  &lt;p&gt;The first concept is to remember SQL Server does not ship transactions. &lt;strong&gt; It ships log blocks.&lt;/strong&gt;&amp;#160; &lt;/p&gt;  &lt;p&gt;The design is not really different than a stand alone server.&amp;#160; On a stand alone server a commit transaction issues (&lt;em&gt;FlushToLSN/StartLogFlush&lt;/em&gt;) to make sure all LSN’s up to and including the commit LSN flushed.&amp;#160;&amp;#160;&amp;#160; This causes the commit to block the session, waiting for the log manager to indicate that all blocks of the log have been properly flushed to stable media.&amp;#160; Once the LSN has been reached any pending transaction(s) can be signaled to continue.&lt;/p&gt;  &lt;table cellspacing="0" cellpadding="2" width="676" border="0"&gt;&lt;tbody&gt;     &lt;tr&gt;       &lt;td valign="top" width="201"&gt;&lt;a href="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-00-73-84-metablogapi/3021.image_5F00_74435868.png"&gt;&lt;img title="image" style="display: inline; background-image: none;" border="0" alt="image" src="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-00-73-84-metablogapi/5483.image_5F00_thumb_5F00_3AC04871.png" width="244" height="201" /&gt;&lt;/a&gt;&lt;/td&gt;        &lt;td valign="top" width="473"&gt;Let’s use the diagram on the left for discussion.&amp;#160;&amp;#160; The ODD LSNs are from Session 1 and the EVEN LSNs are from Session 2.&amp;#160;&amp;#160; &lt;br /&gt;          &lt;br /&gt;The Log Block is a contiguous, chunk of memory (often 64K and disk sector size aligned), maintained by the Log Manager.&amp;#160; Each database has multiple log blocks maintained in LSN order.&amp;#160; As multiple workers are processing they can use various portions of the log block, as shown here.           &lt;br /&gt;          &lt;br /&gt;To make this efficient a worker requests space in the block to store its record.&amp;#160; This request returns the current location in the log block, increments the next write position in the log block (to be used by the next caller) and acquires a reference count.&amp;#160;&amp;#160; This makes the allocation of space for a log record only a few CPU instructions.&amp;#160; The storage position movement is thread safe and the reference count is used to determine when the log block can be closed out.           &lt;br /&gt;          &lt;br /&gt;In general, closing out a log block means all the space has been reserved and new space is being handed out for another log block.&amp;#160; When all references are released the block can be compressed, encrypted, … and flushed to disk.&amp;#160;&amp;#160;&amp;#160; &lt;br /&gt;          &lt;br /&gt;&lt;strong&gt;Note:&lt;/strong&gt;&amp;#160; A commit transaction (FlushToLSN/StartLogFlush) can trigger similar behavior, even when the block is not full, so a commit transaction does not have to wait for the block to become full.&amp;#160;&amp;#160; Reference: &lt;a href="http://support.microsoft.com/kb/230785"&gt;http://support.microsoft.com/kb/230785&lt;/a&gt;&amp;#160; &lt;br /&gt;          &lt;br /&gt;In this example both commits would be waiting on the log block to be written to stable media.           &lt;br /&gt;          &lt;br /&gt;Session 1 – FlushToLSN (05)           &lt;br /&gt;Session 2 – FlushToLSN (06)           &lt;br /&gt;          &lt;br /&gt;The log writer’s completion routine is invoked when the I/O completes for the block.&amp;#160;&amp;#160; The completion routine checks for errors and when successful, signals any sessions waiting on a LSN &amp;lt;= 6.&amp;#160;&amp;#160; In this case both session 1 and 2 are signaled to continue processing.           &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;br /&gt;&lt;em&gt;Write Log Waits&lt;/em&gt; accumulate during this wait for the flush activities.&amp;#160;&amp;#160; You can read more about write log waits at: &lt;a href="http://blogs.msdn.com/b/psssql/archive/2009/11/03/the-sql-server-wait-type-repository.aspx"&gt;http://blogs.msdn.com/b/psssql/archive/2009/11/03/the-sql-server-wait-type-repository.aspx&lt;/a&gt;           &lt;br /&gt;          &lt;br /&gt;&lt;u&gt;Misconception            &lt;br /&gt;&lt;/u&gt;          &lt;br /&gt;I had a discussion on an e-mail where the individual was thinking we only shipped committed transactions.&amp;#160; Not true (for Always On or Database Mirroring).&amp;#160; If I only shipped committed transactions it would require a different set of log blocks for EACH transaction.&amp;#160; This would be terrible performance impacting overhead.&amp;#160;&amp;#160; It would also be extremely difficult to handle changes on the same page.&amp;#160;&amp;#160; If SQL Server doesn’t have the ACID series of log records how would SQL Server ever be able to run recovery, both redo and undo.&amp;#160;&amp;#160; Throw in row versioning and shipping just the committed log records becomes very cumbersome.           &lt;br /&gt;          &lt;br /&gt;We don’t ship log records, we ship log blocks and optimize the recovery needs.&lt;/td&gt;     &lt;/tr&gt;   &lt;/tbody&gt;&lt;/table&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;&lt;strong&gt;Parallel Flushing / Hardening&lt;/strong&gt;&lt;/p&gt;  &lt;p&gt;Always On is a bit different than database mirroring (DBM) with respect to sending the log blocks to the secondary replica(s).&amp;#160;&amp;#160; DBM flushes the log block to disk and once completed locally, sends the block to the secondary.&lt;/p&gt;  &lt;p&gt;Always On changed this to flush the block(s) in parallel.&amp;#160; In fact, a secondary could have hardened log block(s) before the primary I/O completes.&amp;#160;&amp;#160;&amp;#160; This design increases performance and narrows the NOT IN SYNC window(s).&lt;/p&gt;  &lt;p&gt;SQL Server uses an internal, callback mechanism with the log manager.&amp;#160;&amp;#160; When a log block is ready to be flushed (fully formatted and ready to write to disk) the notification callbacks are fired.&amp;#160;&amp;#160; A callback you might expect is Always On.&amp;#160;&amp;#160; These notifications start processing in parallel with the actual flushing of the log to the local (LDF) stable media.&lt;/p&gt;  &lt;p&gt;&lt;a href="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-00-73-84-metablogapi/6237.image6_5F00_7A1DFC01.png"&gt;&lt;img title="image" style="display: inline; background-image: none;" border="0" alt="image" src="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-00-73-84-metablogapi/0361.image6_5F00_thumb_5F00_2013AC58.png" width="625" height="346" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;As the diagram shows, the race is on.&amp;#160; One worker (log writer) is flushing to the local media and the secondary consumer is reading new blocks and flushing on the secondary.&amp;#160;&amp;#160; A stall in the I/O on the primary can allow the secondary to flush before the primary just as a delay on the secondary could cause the primary to flush the I/O before the secondary.&lt;/p&gt;  &lt;p&gt;My first reaction to this was, oh no, not in sync this is bad.&amp;#160;&amp;#160; However, the SQL Server developers didn’t stop at this juncture, Always On is built to handle this situation from the ground up.&lt;/p&gt;  &lt;p&gt;Not shown in the diagram are the progress messages.&amp;#160;&amp;#160; The secondary sends messages to the primary indicating the hardened LSN level.&amp;#160;&amp;#160; The primary uses that information to help determine synchronization state.&amp;#160;&amp;#160; Again, these messages execute in parallel to the actual log block shipping activities.&amp;#160; &lt;/p&gt;  &lt;p&gt;&lt;strong&gt;Cluster Registry Key for the Availability Group&lt;/strong&gt;&lt;/p&gt;  &lt;p&gt;The cluster, AG resource is the central location used to maintain the synchronization states.&amp;#160;&amp;#160; Each secondary has information stored in the AG resource key (binary blob) indicating information about the current LSN levels, synchronization state and other details.&amp;#160;&amp;#160; This registry key is already replicated, atomically across the cluster so as long as we use the registry at the front of our WAL protocol design the AG state is maintained.&lt;/p&gt;  &lt;p&gt;&lt;strong&gt;Note:&lt;/strong&gt;&amp;#160; We don’t update the registry for every transaction.&amp;#160; In fact, it is seldom updated, only at required state changes.&amp;#160; What I mean by WAL protocol here is that the registry is atomically updated before further action is taken on the database so the actions taken in the database are in sync with the registry across the cluster.&lt;/p&gt;  &lt;p&gt;&lt;strong&gt;Secondary Connection State (Key to Synchronized State)&lt;/strong&gt;&lt;/p&gt;  &lt;p&gt;The design of Always On is a &lt;em&gt;pull, not a push model&lt;/em&gt;.&amp;#160; The primary does NOT connect to the secondary, the secondary must connect to the primary and ask for log blocks.&lt;/p&gt;  &lt;p&gt;&lt;font color="#c0504d"&gt;Whenever the secondary is NOT connected the cluster registry is immediately updated to NOT SYNCHRONIZED.&lt;/font&gt;&amp;#160; Think if it this way.&amp;#160; If we can’t communicate with the secondary we are unable to guarantee the state remains synchronized and we protect the system by marking it NOT SYNCHRONIZED.&lt;/p&gt;  &lt;p&gt;&lt;strong&gt;Primary Database Startup&lt;/strong&gt;&lt;/p&gt;  &lt;p&gt;Whenever a database is taken offline/shutdown the secondary connections are closed.&amp;#160;&amp;#160; When the database is started we immediately set the state of the secondary to NOT SYNCHRONIZED and then recover the database on the primary.&amp;#160; Once recovery has completed the secondary(s) are allowed to connect and start the log scanning activity.&lt;/p&gt;  &lt;p&gt;&lt;strong&gt;Note:&lt;/strong&gt; There is an XEvent session, definition included at the end of this blog, that you can be use to track several of the state changes.&lt;/p&gt;  &lt;p&gt;&lt;strong&gt;Connected&lt;/strong&gt;&lt;/p&gt;  &lt;p&gt;Once the secondary is connected it asks (pull) for a log scan to begin.&amp;#160;&amp;#160; As the XEvents show, you can see the states change for the secondary scanner on the primary.&lt;/p&gt;  &lt;table cellspacing="0" cellpadding="2" width="693" border="1"&gt;&lt;tbody&gt;     &lt;tr&gt;       &lt;td valign="top" width="204"&gt;&lt;strong&gt;Uninitialized&lt;/strong&gt;&lt;/td&gt;        &lt;td valign="top" width="487"&gt;The secondary has connected SQL Server but it has not sent LSN information yet.&lt;/td&gt;     &lt;/tr&gt;      &lt;tr&gt;       &lt;td valign="top" width="208"&gt;&lt;strong&gt;WaitForWatermark&lt;/strong&gt;&lt;/td&gt;        &lt;td valign="top" width="487"&gt;Waiting for the secondary to reconcile the hardened log LSN position on the secondary with the cluster key and recovery information.&amp;#160;&amp;#160; The secondary will send its end-of-log (EOL) LSN to the primary.&lt;/td&gt;     &lt;/tr&gt;      &lt;tr&gt;       &lt;td valign="top" width="211"&gt;&lt;strong&gt;SendingLog&lt;/strong&gt;&lt;/td&gt;        &lt;td valign="top" width="487"&gt;The primary has received the end-of-log position from the secondary so it can send log from the specified LSN on the primary to the secondary.&lt;/td&gt;     &lt;/tr&gt;   &lt;/tbody&gt;&lt;/table&gt;  &lt;p&gt;&lt;strong&gt;Note&lt;/strong&gt;:&amp;#160; None of these states alone dictate that the secondary is IN SYNC.&amp;#160;&amp;#160; The secondary is still marked as NOT SYNCHRONIZED in the cluster registry.&lt;/p&gt;  &lt;p&gt;&lt;a href="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-00-73-84-metablogapi/3581.image17_5F00_3F56532B.png"&gt;&lt;img title="image" style="display: inline; background-image: none;" border="0" alt="image" src="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-00-73-84-metablogapi/1263.image17_5F00_thumb_5F00_3EEA2036.png" width="710" height="122" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;&lt;strong&gt;Hardened Log On Secondary &lt;/strong&gt;&lt;/p&gt;  &lt;p&gt;You will notice the 3rd column is indicating the commit, harden policy.&amp;#160; The harden policy indicates how a commit transaction should act on the primary database.&lt;/p&gt;  &lt;table cellspacing="0" cellpadding="2" width="697" border="1"&gt;&lt;tbody&gt;     &lt;tr&gt;       &lt;td valign="top" width="204"&gt;&lt;strong&gt;DoNothing&lt;/strong&gt;&lt;/td&gt;        &lt;td valign="top" width="491"&gt;There is no active ‘SendingLog’ so the commits on the primary don’t wait for acknowledgement from the secondary.&amp;#160; There is no secondary connected so it can’t wait for an acknowledgement even if it wanted to.          &lt;br /&gt;          &lt;br /&gt;The state of the secondary must remain NOT SYNCHRONIZED as the primary is allowed to continue.           &lt;br /&gt;          &lt;br /&gt;I tell people this is why it is called HADR and not DRHA.&amp;#160; High Availability (HA) is the primary goal so if a secondary is not connected the primary is allowed to continue processing.&amp;#160;&amp;#160; While this does put the installation in danger of data loss it allows production uptime and alternate backup strategies to compensate.&lt;/td&gt;     &lt;/tr&gt;      &lt;tr&gt;       &lt;td valign="top" width="207"&gt;&lt;strong&gt;Delay&lt;/strong&gt;&lt;/td&gt;        &lt;td valign="top" width="491"&gt;When a secondary is not caught up to the primary end–of-log (EOL) the transaction commits are held for a short delay period (sleep) helping the secondary catch up.&amp;#160; This is directly seen while the secondary is connected and catching up (SYNCHRONIZING.) &lt;/td&gt;     &lt;/tr&gt;      &lt;tr&gt;       &lt;td valign="top" width="209"&gt;&lt;strong&gt;WaitForHarden&lt;/strong&gt;&lt;/td&gt;        &lt;td valign="top" width="491"&gt;As mentioned earlier the secondary sends progress messages to the primary.&amp;#160;&amp;#160; When the primary detects that the secondary has caught up to the end of the log the harden policy is changed to WaitForHarden.          &lt;br /&gt;          &lt;br /&gt;&lt;strong&gt;SYNCHRONIZ&lt;u&gt;ING&lt;/u&gt;&amp;#160;&lt;/strong&gt;– DMVs will show synchronizing state until the end-of-log (EOL) is reached.&amp;#160; Think of as a catch up phase.&amp;#160;&amp;#160; You can’t be synchronizing unless you are connected.           &lt;br /&gt;          &lt;br /&gt;&lt;strong&gt;&lt;font color="#4bacc6" size="5"&gt;SYNCHRONIZED &lt;/font&gt;– This is the point at which the secondary is marked as SYNCHRONIZED.&amp;#160; (Secondary is connected and known to have achieved log block hardening with the primary EOL point.)             &lt;br /&gt;            &lt;br /&gt;!!! SYNCHRONIZED IS THE ONLY STATE ALLOWING AUTOMATIC FAILOVER !!!             &lt;br /&gt;            &lt;br /&gt;&lt;/strong&gt;From this point forward all transactions have to wait for the primary (log writer) and secondary to advance the LSN flushes to the desired harden location.           &lt;br /&gt;          &lt;br /&gt;Going back to the first example, Session 2 waits for all LSNs up to and including 06 to be hardened.&amp;#160;&amp;#160; When involving the synchronous replica this is a wait for LSNs up to 06 to be hardened on the primary and the secondary.&amp;#160;&amp;#160; Until the progress of both the primary and secondary achieve LSN 06 the committing session is held (Wait For Log Flush.)&lt;/td&gt;     &lt;/tr&gt;   &lt;/tbody&gt;&lt;/table&gt;  &lt;p&gt;&lt;strong&gt;Clean vs Hard Unexpected Database Shutdowns&lt;/strong&gt;&lt;/p&gt;  &lt;p&gt;When you think about database shutdown there are 2 main scenarios, clean and unexpected (hard).&amp;#160;&amp;#160; When a &lt;strong&gt;clean&lt;/strong&gt; shutdown occurs the primary does not change the synchronized state in the cluster registry.&amp;#160; Whatever the current synchronization state is at the time the shutdown was issued remains sticky.&amp;#160;&amp;#160; This allows clean failovers, AG moves and other maintenance operations to occur cleanly.&lt;/p&gt;  &lt;p&gt;&lt;strong&gt;Unexpected&lt;/strong&gt;, can’t change the state if the unexpected action occurs at the &lt;em&gt;service level&lt;/em&gt; (SQL Server process terminated, power outage, etc..).&amp;#160;&amp;#160; However, if the database is taken offline for some reason (log writes start failing) the connection to the secondary(s) are terminated and terminating the connection immediately updates the cluster registry to NOT SYNCHRONIZED.&amp;#160; Something like failure to write to the log (LDF) could be as simple as an administrator incorrectly removing a mount point.&amp;#160; Adding the mount point back to the system and restarting the database restores the system quickly.&lt;/p&gt;  &lt;p&gt;&lt;strong&gt;Scenarios&lt;/strong&gt;&lt;/p&gt;  &lt;p&gt;Now I started running scenarios on my white board.&amp;#160;&amp;#160; I think a few of these are applicable to this post to help solidify understanding.&lt;/p&gt;  &lt;table cellspacing="0" cellpadding="2" width="707" border="1"&gt;&lt;tbody&gt;     &lt;tr&gt;       &lt;td valign="top" width="227"&gt;&lt;strong&gt;In Synchronized State            &lt;br /&gt;Primary flushed LSN but not flushed on Secondary&lt;/strong&gt;&lt;/td&gt;        &lt;td valign="top" width="478"&gt;         &lt;ul&gt;           &lt;li&gt;Primary experiences power outage.&lt;/li&gt;            &lt;li&gt;Automatic failover is allowed.&amp;#160;&amp;#160; &lt;/li&gt;            &lt;li&gt;The primary has flushed log records that the secondary doesn’t have and the commits are being held.&lt;/li&gt;            &lt;li&gt;Secondary will become the new primary and recovers.&lt;/li&gt;            &lt;li&gt;When old primary is restarted the &lt;em&gt;StartScan/WaitForHarden&lt;/em&gt; logic will rollback to the same location that the new primary, effectively ignoring the commits flushed but never acknowledged.&amp;#160; &lt;/li&gt;         &lt;/ul&gt;       &lt;/td&gt;     &lt;/tr&gt;      &lt;tr&gt;       &lt;td valign="top" width="227"&gt;&lt;strong&gt;In Synchronized State            &lt;br /&gt;Secondary flushed LSN but not flushed on Primary&lt;/strong&gt;&lt;/td&gt;        &lt;td valign="top" width="478"&gt;         &lt;ul&gt;           &lt;li&gt;Primary experiences power outage.&lt;/li&gt;            &lt;li&gt;Automatic failover is allowed.&lt;/li&gt;            &lt;li&gt;Secondary has committed log records that primary doesn’t have.&amp;#160; &lt;/li&gt;            &lt;li&gt;Secondary becomes new primary and recovers.&lt;/li&gt;            &lt;li&gt;When old primary is restarted the &lt;em&gt;StartScan/WaitForHarden&lt;/em&gt; logic will detect a catch up is required.               &lt;br /&gt;              &lt;br /&gt;&lt;strong&gt;Note:&lt;/strong&gt;&amp;#160; This scenario is no different than a synchronized secondary that has not hardened as much as the primary.&amp;#160; If the primary is restarted on the same node, upon connect, the secondary will start the catch up activity (SYNCHRONIZING), get back to end of log parity and return to SYNCHRNONED state.&lt;/li&gt;         &lt;/ul&gt;       &lt;/td&gt;     &lt;/tr&gt;   &lt;/tbody&gt;&lt;/table&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;p&gt;&lt;font color="#c0504d"&gt;The first reaction when I draw this out for my peers is, we are loosing transactions.&amp;#160; &lt;/font&gt;&lt;font color="#9bbb59"&gt;&lt;strong&gt;Really we are not.&lt;/strong&gt;&lt;/font&gt;&amp;#160; We never acknowledge the transaction until the primary and secondary indicate the log has been hardened to LSN at both locations.&amp;#160;&amp;#160; &lt;/p&gt;  &lt;p&gt;If you take the very same scenarios to a stand alone environment you have the same timing situations.&amp;#160;&amp;#160; The power outage could happen right after the log is hardened but before the client is sent the acknowledgement.&amp;#160;&amp;#160; It looks like a connection drop to the client and upon restart of the database the committed transaction is redone/present.&amp;#160;&amp;#160; In contrast, the flush may not have completed when the power outage occurred so the transaction would be rolled back.&amp;#160;&amp;#160; In neither case did the client receive an acknowledgement of success or failure for the commit.&lt;/p&gt;  &lt;p&gt;&lt;strong&gt;SYNCHRONIZED – AUTOMATIC FAILOVER ALLOWED&lt;/strong&gt;&lt;/p&gt;  &lt;p&gt;&lt;em&gt;Going back to the intent of this blog, only when the cluster registry has the automatic, targeted secondary, marked SYNCHRONIZED is automatic failover allowed.&lt;/em&gt;&amp;#160;&amp;#160; You can throw all kinds of other scenarios at this but as soon as you drop the connection (restart the log scan request, …) the registry is marked NOT SYNCHRONIZED and it won’t be marked SYNCHRONIZED again until the end-of-log (EOL) sync point is reached.&lt;/p&gt;  &lt;p&gt;Many customers have experienced failure to allow fail over because they stopped the secondary and then tried a move.&amp;#160; They assumed that because they no longer had primary, transaction activity it was safe.&amp;#160;&amp;#160; Not true as ghost, checkpoint and other processes can still be adding log records.&amp;#160;&amp;#160; As soon as you stop the secondary, by definition you no longer have HA so the primary marks the secondary &lt;em&gt;NOT SYNCHRONIZED&lt;/em&gt;.&lt;/p&gt;  &lt;p&gt;As long as the AG failover detection can use proper, cluster resource offline behaviors, SQL Server is shutdown cleanly or SQL Server is terminated harshly, while the secondary is in the SYNCHRONIZED state, automatic failover is possible.&amp;#160; If the SQL Server is not shutdown but a database is taken offline the state is updated to NOT SYNCHRONIZED.&lt;/p&gt;  &lt;p&gt;&lt;strong&gt;Single Failover Target&lt;/strong&gt;&lt;/p&gt;  &lt;p&gt;Remember that you can only have a single, automatic failover target.&amp;#160; To help your HA capabilities you may want to setup a second, synchronous replica.&amp;#160; While it can’t be the target of automatic failover it could help High Availability (HA).&amp;#160;&amp;#160; &lt;/p&gt;  &lt;p&gt;For example, the automatic failover, secondary target machine has a power outage.&amp;#160;&amp;#160; Connection on primary is no longer valid so the secondary is marked NOT SYNCHRONIZED.&amp;#160;&amp;#160; The alternate synchronous, replica can still be SYNCHRONIZED and a target for a manual move WITHOUT DATA LOSS.&amp;#160;&amp;#160; The automatic failover target, in this example, is only a move WITH ALLOW DATA LOSS target.&lt;/p&gt;  &lt;p&gt;Don’t forget that to enable true HA for this example the replica(s) should have redundant hardware.&amp;#160; Second network cards, cabling and such.&amp;#160; If you use the same network and a networking problem arises the connections on the primary are dropped and that immediately marks the replica(s) NOT SYNCHRONIZED.&lt;/p&gt;  &lt;p&gt;&lt;strong&gt;Resolving State&lt;/strong&gt;&lt;/p&gt;  &lt;p&gt;Most of the time the question addressed in this post comes up because the secondary is NOT becoming the primary and is in Resolving state.&amp;#160;&amp;#160; Looking at the state changes leading up to the issue the secondary was in SYNCHRONIZ&lt;u&gt;ING&lt;/u&gt;.&amp;#160; When the primary goes down the secondary knows it was not SYNCHRONIZ&lt;u&gt;ED&lt;/u&gt;.&amp;#160; The secondary is attempting to connect to the a primary and the primary is down so the state is RESOLVING.&amp;#160; &lt;/p&gt;  &lt;p&gt;-------------------------------------------------------------------------------------------------------&lt;/p&gt;  &lt;p&gt;&lt;strong&gt;Customizing Failover – All Kinds of Options&lt;/strong&gt;&lt;/p&gt;  &lt;p&gt;A secondary question that always follows this main question is:&amp;#160; &lt;em&gt;“If a disk fails on my database, within an AG why does automatic failover not occur?”&lt;/em&gt;&lt;/p&gt;  &lt;p&gt;The short answer is that the secondary connections are dropped during database shutdown – NOT SYNCHRONIZED.&amp;#160; (&lt;em&gt;SQL Server development is looking into keeping the SYNCHRONIZED state in this situation instead of forcing NOT SYNCHRONIZED in vNext, opening up the window for automatic failover possibilities&lt;/em&gt;.)&lt;/p&gt;  &lt;p&gt;The other part of the answer is that the built-in, failover logic is not designed to detect a single database failure.&amp;#160;&amp;#160; If you look at the failure conditions in SQL Server Books Online none of these are database level detections.&lt;/p&gt;  &lt;p&gt;I was part of the work we did to enhance the failover diagnostics and decision conditions/levels.&amp;#160; We specifically considered the custom solution needs.&amp;#160; We evaluated dozens of scenarios, ranked and targeted those conditions safe for the broad customer base using Always On.&amp;#160;&amp;#160; This design specifically involved allowing any customer to extend the logic for your specific business needs.&amp;#160; We made sure the mechanisms, the SQL Server and resource DLL use, were using publicly consumable interfaces and documented in SQL Server Books Online.&amp;#160; &lt;/p&gt;  &lt;p&gt;&lt;strong&gt;Note:&lt;/strong&gt;&amp;#160; All of the following can be done with PowerShell.&lt;/p&gt;  &lt;p&gt;&lt;strong&gt;XEvents&lt;/strong&gt;&lt;/p&gt;  &lt;p&gt;For XEvents you can use the &lt;em&gt;XEvent Linq Reader&lt;/em&gt; and monitor a live feed from the SQL Server.&amp;#160;&amp;#160; The easiest way to accomplish this would be to setup a SQL Agent job (continuous running so if the processes exits it restarts itself) which launches a C# executable or Powershell script.&lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;The job can make sure it is only starting the executable on the primary server.&lt;/li&gt;    &lt;li&gt;The executable can make sure the proper XEvent sessions are running (these sessions can even be defined to startup during SQL Server, service startup).&lt;/li&gt;    &lt;li&gt;The executable can monitor the steam of events for the custom trigger points you consider critical to your business needs and when the parameters fall out of the desired boundary(s) issue the &lt;em&gt;Cluster command&lt;/em&gt; to &lt;em&gt;MOVE&lt;/em&gt; the AG to another node.&lt;/li&gt;    &lt;li&gt;The XEvent session can also write to a file (.XEL) so the system has history of the event stream as well.&lt;/li&gt; &lt;/ul&gt;  &lt;p&gt;&lt;strong&gt;Note:&lt;/strong&gt; The executable should be drop connection resilient.&amp;#160;&amp;#160; The design of the XEvent live stream is to terminate the connection for the stream if the server detects the event stream is stalled (client not processing events fast enough.)&amp;#160;&amp;#160; This means the client needs to detect the connection failure and reset.&amp;#160;&amp;#160; This usually means actions are posted to a worker thread in the application and the main reader only accepts the events and hands them to background tasks.&lt;/p&gt;  &lt;p&gt;   &lt;br /&gt;&lt;strong&gt;Example:&lt;/strong&gt; &lt;a href="http://sqlblog.com/blogs/extended_events/archive/2011/07/20/introducing-the-extended-events-reader.aspx"&gt;http://sqlblog.com/blogs/extended_events/archive/2011/07/20/introducing-the-extended-events-reader.aspx&lt;/a&gt; &lt;/p&gt;  &lt;p&gt;&lt;strong&gt;sp_server_diagnostics&lt;/strong&gt; (&lt;a href="http://msdn.microsoft.com/en-us/library/ff878233.aspx"&gt;http://msdn.microsoft.com/en-us/library/ff878233.aspx&lt;/a&gt;) &lt;/p&gt;  &lt;p&gt;This was specifically designed to flow across a T-SQL connection (TDS) so anyone using a SQL Server client (.NET, ODBC, OLDEB, …) can execute the procedure and process the results.&amp;#160;&amp;#160; You don’t want dozens of these running on the SQL Server but you could easily monitor this stream as well and take any custom actions necessary.&lt;/p&gt;  &lt;p&gt;&lt;strong&gt;Note:&lt;/strong&gt;&amp;#160; The I/O result row is NOT used by the SQL Server resource dll to make failover decisions.&amp;#160; It is used for logging purposes only.&amp;#160;&amp;#160; It is not safe assumption that an I/O stall would be resolved by a failover of the system or even restart of the service.&amp;#160; We have many examples of virus scanners and such components that can cause this issue and it would lead to a Ping-Pong among nodes if we trigger automated failover to occur.&lt;/p&gt;  &lt;p&gt;&lt;strong&gt;DMVs and Policy Based Management (PBM)&lt;/strong&gt;&lt;/p&gt;  &lt;p&gt;In most cases it will be more efficient to setup an XEvent to monitor various aspects of the system.&amp;#160; (Specific errors, database status changes, AG status changes, ….).&amp;#160;&amp;#160; However, the DMVs are also useful and a great safety net.&amp;#160; We use many of the DMVs and the PBM rules to drive the Always On dashboard.&amp;#160;&amp;#160;&amp;#160; You can create your own policies and execute them as well as using the XEvent predicates to limit the events produced.&lt;/p&gt;  &lt;p&gt;Between some DMV queries and the policies you can easily detect things like corruption errors occurring, loss of a drive, etc…&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;/p&gt;  &lt;p&gt;&lt;strong&gt;External Factor Detections&lt;/strong&gt;&lt;/p&gt;  &lt;p&gt;Using PowerShell and WMI you can query information about the machine.&amp;#160; For example you can check each drive for reported failure conditions, such as too many sector remaps or temperature problems.&amp;#160;&amp;#160; When detected you can take preemptive action to move the AG and pause the node, marking it for proper maintenance.&lt;/p&gt;  &lt;p&gt;&lt;strong&gt;Example&lt;/strong&gt;     &lt;br /&gt;$a = get-wmiobject win32_DiskDrive     &lt;br /&gt;$a[0] | get-member&lt;/p&gt;  &lt;p&gt;   &lt;br /&gt;&lt;strong&gt;Loss of LDF&amp;#160; (No Automatic Failover)&lt;/strong&gt;&lt;/p&gt;  &lt;p&gt;A specific tenant of Always On is – protect the data- don’t automate things that can lead to data loss.&amp;#160; &lt;/p&gt;  &lt;p&gt;The scenario is a mount point, used to hold the LDF, is mistakenly removed from the primary node.&amp;#160;&amp;#160; This causes the SQL Server database to become suspect, missing log file but does not trigger automatic failover.&amp;#160;&amp;#160; &lt;/p&gt;  &lt;p&gt;If the mount point can simply be added back to the node the database can be brought back online and business continues as usual, no data loss.&amp;#160;&amp;#160; If we had forced failover (ALLOW DATA LOSS) it could have led to data loss for a situation that the administrators could have cleanly resolved.&lt;/p&gt;  &lt;p&gt;When the secondary drops a connection (loss of network, database LDF is damaged, …) the state is updated to ‘not synchronized’, preventing automatic failover.&amp;#160;&amp;#160; We are careful because allowing anything else may lead to split brain and other such scenarios that cause data loss.&amp;#160; Furthermore, if you change a primary to a secondary it goes into recovery state and at that point if we had serious damage and needed to recover the data it is much more difficult to access the database.&lt;/p&gt;  &lt;p&gt;A situation like this requires a business decision.&amp;#160; Can the issue be quickly resolved or does it require a failover with allow data loss?&amp;#160;&amp;#160; &lt;/p&gt;  &lt;p&gt;To help in preventing data loss the replicas are marked suspended.&amp;#160; As described in the following link you can use a snapshot database, before resuming, to capture the changes that will be lost.&amp;#160; &lt;a href="http://msdn.microsoft.com/en-us/library/ff877957.aspx"&gt;http://msdn.microsoft.com/en-us/library/ff877957.aspx&lt;/a&gt;&amp;#160;&amp;#160; Then using T-SQL queries and facilities such as TableDiff one can determine the best reconciliation.&lt;/p&gt;  &lt;p&gt;&lt;strong&gt;Also reference:&lt;/strong&gt; &lt;a href="http://download.microsoft.com/download/D/2/0/D20E1C5F-72EA-4505-9F26-FEF9550EFD44/Building%20a%20High%20Availability%20and%20Disaster%20Recovery%20Solution%20using%20AlwaysOn%20Availability%20Groups.docx"&gt;http://download.microsoft.com/download/D/2/0/D20E1C5F-72EA-4505-9F26-FEF9550EFD44/Building%20a%20High%20Availability%20and%20Disaster%20Recovery%20Solution%20using%20AlwaysOn%20Availability%20Groups.docx&lt;/a&gt; &lt;/p&gt;  &lt;p&gt;&lt;strong&gt;Note:&lt;/strong&gt; You want to make sure the snapshot has a short life span to avoid the additional overhead for a long period of time and the fact that is can hold up other operations, such as File Stream garbage collection actions.&lt;/p&gt;  &lt;p&gt;One could build additional monitoring to:&lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;Make sure primary was marked suspended&lt;/li&gt;    &lt;li&gt;Force the failover with allow data loss &lt;/li&gt;    &lt;li&gt;Create snapshot on OLD primary&lt;/li&gt;    &lt;li&gt;Resume OLD primary as a new secondary&lt;/li&gt; &lt;/ul&gt;  &lt;p&gt;Then take appropriate business steps to use the data in the snapshot to determine what the data loss would/could be.&amp;#160;&amp;#160;&amp;#160; This is likely to involve a custom, data resolver design (much like the custom conflict resolution options of database replication) to determine how the data should be resolved.&lt;/p&gt;  &lt;p&gt;&lt;strong&gt;Don’t Kill SQL&lt;/strong&gt;&lt;/p&gt;  &lt;p&gt;&lt;em&gt;Killing SQL Server is a dangerous practice.&lt;/em&gt;&amp;#160;&amp;#160;&amp;#160; It is highly unlikely but I can never rule out that it may be possible to introduce unwanted behavior, such as when SQL Server is attempting to update the cluster registry key, leaving the key corrupted.&amp;#160;&amp;#160; A corrupted registry key, blob for the Availability Group (AG) would then render every replica of the AG damaged because the AG configuration is damaged, &lt;u&gt;not the data&lt;/u&gt;!&amp;#160;&amp;#160; You would then have to carefully drop and recreate the AG in a way that did not require you to rebuild the actual databases but instead allows the cluster configuration to be corrected.&amp;#160; It is only few minute operation, once discovered, to fix it but immediate downtime and is usually a panic stricken situation.&lt;/p&gt;  &lt;p&gt;SQL Server is design to handle power outages and tested well to accommodate this.&amp;#160; Kill is a bit like simulating a power outage and not something Microsoft would recommend as a business practice.&amp;#160; Instead you should be using something like PowerShell and issuing a ‘move’ of the availability group in a clean and designed way.&lt;/p&gt;  &lt;p&gt;&lt;strong&gt;Example:&lt;/strong&gt; (Move-ClusterResource) &lt;a href="http://technet.microsoft.com/en-us/library/ee461049.aspx"&gt;http://technet.microsoft.com/en-us/library/ee461049.aspx&lt;/a&gt;&amp;#160;&amp;#160; &lt;/p&gt;  &lt;p&gt;&lt;strong&gt;&lt;u&gt;XEvent Session&lt;/u&gt;&lt;/strong&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style="margin: 0in 0in 0pt;"&gt;&lt;span style="color: blue; font-family: consolas; font-size: 9pt;"&gt;CREATE&lt;/span&gt;&lt;span style="font-family: consolas; font-size: 9pt;"&gt;&lt;font color="#000000"&gt; &lt;/font&gt;&lt;span style="color: blue;"&gt;EVENT&lt;/span&gt;&lt;font color="#000000"&gt; &lt;/font&gt;&lt;span style="color: blue;"&gt;SESSION&lt;/span&gt;&lt;font color="#000000"&gt; &lt;/font&gt;&lt;span style="color: teal;"&gt;[HadronSyncStateChanges_CommitHardenPolicies]&lt;/span&gt;&lt;font color="#000000"&gt; &lt;/font&gt;&lt;span style="color: blue;"&gt;ON&lt;/span&gt;&lt;font color="#000000"&gt; &lt;/font&gt;&lt;span style="color: blue;"&gt;SERVER&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style="margin: 0in 0in 0pt;"&gt;&lt;span style="color: blue; font-family: consolas; font-size: 9pt;"&gt;ADD&lt;/span&gt;&lt;span style="font-family: consolas; font-size: 9pt;"&gt;&lt;font color="#000000"&gt; &lt;/font&gt;&lt;span style="color: blue;"&gt;EVENT&lt;/span&gt;&lt;font color="#000000"&gt; &lt;/font&gt;&lt;span style="color: teal;"&gt;sqlserver&lt;/span&gt;&lt;span style="color: gray;"&gt;.&lt;/span&gt;&lt;span style="color: teal;"&gt;hadr_db_commit_mgr_set_policy&lt;/span&gt;&lt;span style="color: gray;"&gt;(&lt;/span&gt;&lt;/span&gt;&lt;span style="font-family: consolas; font-size: 9pt;"&gt;&lt;font color="#000000"&gt;&amp;#160;&amp;#160;&amp;#160; &lt;/font&gt;&lt;span style="color: blue;"&gt;ACTION&lt;/span&gt;&lt;span style="color: gray;"&gt;(&lt;/span&gt;&lt;span style="color: teal;"&gt;package0&lt;/span&gt;&lt;span style="color: gray;"&gt;.&lt;/span&gt;&lt;span style="color: teal;"&gt;callstack&lt;/span&gt;&lt;span style="color: gray;"&gt;,&lt;/span&gt;&lt;span style="color: teal;"&gt;sqlserver&lt;/span&gt;&lt;span style="color: gray;"&gt;.&lt;/span&gt;&lt;span style="color: teal;"&gt;database_name&lt;/span&gt;&lt;span style="color: gray;"&gt;)),&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style="margin: 0in 0in 0pt;"&gt;&lt;span style="color: blue; font-family: consolas; font-size: 9pt;"&gt;ADD&lt;/span&gt;&lt;span style="font-family: consolas; font-size: 9pt;"&gt;&lt;font color="#000000"&gt; &lt;/font&gt;&lt;span style="color: blue;"&gt;EVENT&lt;/span&gt;&lt;font color="#000000"&gt; &lt;/font&gt;&lt;span style="color: teal;"&gt;sqlserver&lt;/span&gt;&lt;span style="color: gray;"&gt;.&lt;/span&gt;&lt;span style="color: teal;"&gt;hadr_db_commit_mgr_update_harden&lt;/span&gt;&lt;span style="color: gray;"&gt;(&lt;/span&gt;&lt;/span&gt;&lt;span style="font-family: consolas; font-size: 9pt;"&gt;&lt;font color="#000000"&gt;&amp;#160;&amp;#160;&amp;#160; &lt;/font&gt;&lt;span style="color: blue;"&gt;ACTION&lt;/span&gt;&lt;span style="color: gray;"&gt;(&lt;/span&gt;&lt;span style="color: teal;"&gt;package0&lt;/span&gt;&lt;span style="color: gray;"&gt;.&lt;/span&gt;&lt;span style="color: teal;"&gt;callstack&lt;/span&gt;&lt;span style="color: gray;"&gt;,&lt;/span&gt;&lt;span style="color: teal;"&gt;sqlserver&lt;/span&gt;&lt;span style="color: gray;"&gt;.&lt;/span&gt;&lt;span style="color: teal;"&gt;database_name&lt;/span&gt;&lt;span style="color: gray;"&gt;)),&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style="margin: 0in 0in 0pt;"&gt;&lt;span style="color: blue; font-family: consolas; font-size: 9pt;"&gt;ADD&lt;/span&gt;&lt;span style="font-family: consolas; font-size: 9pt;"&gt;&lt;font color="#000000"&gt; &lt;/font&gt;&lt;span style="color: blue;"&gt;EVENT&lt;/span&gt;&lt;font color="#000000"&gt; &lt;/font&gt;&lt;span style="color: teal;"&gt;sqlserver&lt;/span&gt;&lt;span style="color: gray;"&gt;.&lt;/span&gt;&lt;font color="#000000"&gt;hadr_db_partner_set_sync_state&lt;/font&gt;&lt;span style="color: gray;"&gt;(&lt;/span&gt;&lt;/span&gt;&lt;span style="font-family: consolas; font-size: 9pt;"&gt;&lt;font color="#000000"&gt;&amp;#160;&amp;#160;&amp;#160; &lt;/font&gt;&lt;span style="color: blue;"&gt;ACTION&lt;/span&gt;&lt;span style="color: gray;"&gt;(&lt;/span&gt;&lt;span style="color: teal;"&gt;package0&lt;/span&gt;&lt;span style="color: gray;"&gt;.&lt;/span&gt;&lt;span style="color: teal;"&gt;callstack&lt;/span&gt;&lt;span style="color: gray;"&gt;,&lt;/span&gt;&lt;span style="color: teal;"&gt;sqlserver&lt;/span&gt;&lt;span style="color: gray;"&gt;.&lt;/span&gt;&lt;span style="color: teal;"&gt;database_name&lt;/span&gt;&lt;span style="color: gray;"&gt;))&lt;/span&gt;&lt;font color="#000000"&gt;,&lt;/font&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style="margin: 0in 0in 0pt;"&gt;&lt;span style="color: blue; font-family: consolas; font-size: 9pt;"&gt;ADD&lt;/span&gt;&lt;span style="font-family: consolas; font-size: 9pt;"&gt;&lt;font color="#000000"&gt; &lt;/font&gt;&lt;span style="color: blue;"&gt;EVENT&lt;/span&gt;&lt;font color="#000000"&gt; &lt;/font&gt;&lt;span style="color: teal;"&gt;sqlserver&lt;/span&gt;&lt;span style="color: gray;"&gt;.&lt;/span&gt;&lt;font color="#000000"&gt;hadr_db_manager_state &lt;/font&gt;&lt;span style="color: gray;"&gt;(&lt;/span&gt;&lt;/span&gt;&lt;span style="font-family: consolas; font-size: 9pt;"&gt;&lt;span style="color: blue;"&gt;ACTION&lt;/span&gt;&lt;span style="color: gray;"&gt;(&lt;/span&gt;&lt;span style="color: teal;"&gt;package0&lt;/span&gt;&lt;span style="color: gray;"&gt;.&lt;/span&gt;&lt;span style="color: teal;"&gt;callstack&lt;/span&gt;&lt;span style="color: gray;"&gt;,&lt;/span&gt;&lt;span style="color: teal;"&gt;sqlserver&lt;/span&gt;&lt;span style="color: gray;"&gt;.&lt;/span&gt;&lt;span style="color: teal;"&gt;database_name&lt;/span&gt;&lt;span style="color: gray;"&gt;))&lt;/span&gt;&lt;font color="#000000"&gt;,&lt;/font&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style="margin: 0in 0in 0pt;"&gt;&lt;span style="color: blue; font-family: consolas; font-size: 9pt;"&gt;ADD&lt;/span&gt;&lt;span style="font-family: consolas; font-size: 9pt;"&gt;&lt;font color="#000000"&gt; &lt;/font&gt;&lt;span style="color: blue;"&gt;EVENT&lt;/span&gt;&lt;font color="#000000"&gt; &lt;/font&gt;&lt;span style="color: teal;"&gt;sqlserver&lt;/span&gt;&lt;span style="color: gray;"&gt;.&lt;/span&gt;&lt;font color="#000000"&gt;hadr_ag_wsfc_resource_state&lt;/font&gt;&lt;span style="color: gray;"&gt;(&lt;/span&gt;&lt;/span&gt;&lt;span style="font-family: consolas; font-size: 9pt;"&gt;&lt;span style="color: blue;"&gt;ACTION&lt;/span&gt;&lt;span style="color: gray;"&gt;(&lt;/span&gt;&lt;span style="color: teal;"&gt;package0&lt;/span&gt;&lt;span style="color: gray;"&gt;.&lt;/span&gt;&lt;span style="color: teal;"&gt;callstack&lt;/span&gt;&lt;span style="color: gray;"&gt;,&lt;/span&gt;&lt;span style="color: teal;"&gt;sqlserver&lt;/span&gt;&lt;span style="color: gray;"&gt;.&lt;/span&gt;&lt;span style="color: teal;"&gt;database_name&lt;/span&gt;&lt;span style="color: gray;"&gt;))&lt;/span&gt;&lt;font color="#000000"&gt;,&lt;/font&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style="margin: 0in 0in 0pt;"&gt;&lt;span style="color: blue; font-family: consolas; font-size: 9pt;"&gt;ADD&lt;/span&gt;&lt;span style="font-family: consolas; font-size: 9pt;"&gt;&lt;font color="#000000"&gt; &lt;/font&gt;&lt;span style="color: blue;"&gt;EVENT&lt;/span&gt;&lt;font color="#000000"&gt; &lt;/font&gt;&lt;span style="color: teal;"&gt;sqlserver&lt;/span&gt;&lt;span style="color: gray;"&gt;.&lt;/span&gt;&lt;font color="#000000"&gt;hadr_scan_state&lt;/font&gt;&lt;span style="color: gray;"&gt;(&lt;/span&gt;&lt;/span&gt;&lt;span style="font-family: consolas; font-size: 9pt;"&gt;&lt;font color="#000000"&gt; &lt;/font&gt;&lt;span style="color: blue;"&gt;ACTION&lt;/span&gt;&lt;span style="color: gray;"&gt;(&lt;/span&gt;&lt;span style="color: teal;"&gt;package0&lt;/span&gt;&lt;span style="color: gray;"&gt;.&lt;/span&gt;&lt;span style="color: teal;"&gt;callstack&lt;/span&gt;&lt;span style="color: gray;"&gt;,&lt;/span&gt;&lt;span style="color: teal;"&gt;sqlserver&lt;/span&gt;&lt;span style="color: gray;"&gt;.&lt;/span&gt;&lt;span style="color: teal;"&gt;database_name&lt;/span&gt;&lt;span style="color: gray;"&gt;))&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style="margin: 0in 0in 0pt;"&gt;&lt;span style="color: blue; font-family: consolas; font-size: 9pt;"&gt;ADD&lt;/span&gt;&lt;span style="font-family: consolas; font-size: 9pt;"&gt;&lt;font color="#000000"&gt; &lt;/font&gt;&lt;span style="color: blue;"&gt;TARGET&lt;/span&gt;&lt;font color="#000000"&gt; &lt;/font&gt;&lt;span style="color: teal;"&gt;package0&lt;/span&gt;&lt;span style="color: gray;"&gt;.&lt;/span&gt;&lt;span style="color: teal;"&gt;event_file&lt;/span&gt;&lt;span style="color: gray;"&gt;(&lt;/span&gt;&lt;span style="color: blue;"&gt;SET&lt;/span&gt;&lt;font color="#000000"&gt; &lt;/font&gt;&lt;span style="color: blue;"&gt;filename&lt;/span&gt;&lt;span style="color: gray;"&gt;=&lt;/span&gt;&lt;span style="color: red;"&gt;N'C:\temp\SyncStates'&lt;/span&gt;&lt;span style="color: gray;"&gt;,&lt;/span&gt;&lt;span style="color: teal;"&gt;max_rollover_files&lt;/span&gt;&lt;span style="color: gray;"&gt;=(&lt;/span&gt;&lt;font color="#000000"&gt;100&lt;/font&gt;&lt;span style="color: gray;"&gt;))&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style="margin: 0in 0in 0pt;"&gt;&lt;span style="color: blue; font-family: consolas; font-size: 9pt;"&gt;WITH &lt;/span&gt;&lt;span style="color: gray; font-family: consolas; font-size: 9pt;"&gt;(&lt;/span&gt;&lt;span style="color: teal; font-family: consolas; font-size: 9pt;"&gt;MAX_MEMORY&lt;/span&gt;&lt;span style="color: gray; font-family: consolas; font-size: 9pt;"&gt;=&lt;/span&gt;&lt;span style="font-family: consolas; font-size: 9pt;"&gt;&lt;font color="#000000"&gt;4096 &lt;/font&gt;&lt;span style="color: teal;"&gt;KB&lt;/span&gt;&lt;span style="color: gray;"&gt;,&lt;/span&gt;&lt;span style="color: teal;"&gt;EVENT_RETENTION_MODE&lt;/span&gt;&lt;span style="color: gray;"&gt;=&lt;/span&gt;&lt;span style="color: teal;"&gt;NO_EVENT_LOSS&lt;/span&gt;&lt;span style="color: gray;"&gt;,&lt;/span&gt;&lt;span style="color: teal;"&gt;MAX_DISPATCH_LATENCY&lt;/span&gt;&lt;span style="color: gray;"&gt;=&lt;/span&gt;&lt;font color="#000000"&gt;5 &lt;/font&gt;&lt;span style="color: teal;"&gt;SECONDS&lt;/span&gt;&lt;span style="color: gray;"&gt;,&lt;/span&gt;&lt;span style="color: teal;"&gt;MAX_EVENT_SIZE&lt;/span&gt;&lt;span style="color: gray;"&gt;=&lt;/span&gt;&lt;font color="#000000"&gt;0 &lt;/font&gt;&lt;span style="color: teal;"&gt;KB&lt;/span&gt;&lt;span style="color: gray;"&gt;,&lt;/span&gt;&lt;span style="color: teal;"&gt;MEMORY_PARTITION_MODE&lt;/span&gt;&lt;span style="color: gray;"&gt;=&lt;/span&gt;&lt;span style="color: teal;"&gt;PER_CPU&lt;/span&gt;&lt;span style="color: gray;"&gt;,&lt;/span&gt;&lt;span style="color: teal;"&gt;TRACK_CAUSALITY&lt;/span&gt;&lt;span style="color: gray;"&gt;=&lt;/span&gt;&lt;span style="color: blue;"&gt;ON&lt;/span&gt;&lt;span style="color: gray;"&gt;,&lt;/span&gt;&lt;span style="color: teal;"&gt;STARTUP_STATE&lt;/span&gt;&lt;span style="color: gray;"&gt;=&lt;/span&gt;&lt;span style="color: blue;"&gt;ON&lt;/span&gt;&lt;span style="color: gray;"&gt;)&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style="margin: 0in 0in 0pt;"&gt;&lt;span style="font-family: consolas; font-size: 9pt;"&gt;&lt;span style="color: gray;"&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p&gt;&lt;span style="color: rgb(166, 166, 166); font-family: &amp;quot;Calibri&amp;quot;,&amp;quot;sans-serif&amp;quot;; font-size: 8pt; mso-ascii-theme-font: minor-latin; mso-fareast-font-family: &amp;quot;Times New Roman&amp;quot;; mso-fareast-theme-font: minor-fareast; mso-hansi-theme-font: minor-latin; mso-bidi-font-family: &amp;quot;Times New Roman&amp;quot;; mso-ansi-language: en-us; mso-fareast-language: en-us; mso-bidi-language: ar-sa; mso-no-proof: yes;"&gt;Bob Dorr - Principal SQL Server Escalation Engineer&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=10413044" width="1" height="1"&gt;</content><author><name>psssql</name><uri>http://blogs.msdn.com/psssql/ProfileUrlRedirect.ashx</uri></author><category term="How It Works" scheme="http://blogs.msdn.com/b/psssql/archive/tags/How+It+Works/" /><category term="Database Mirroring" scheme="http://blogs.msdn.com/b/psssql/archive/tags/Database+Mirroring/" /><category term="AlwaysON" scheme="http://blogs.msdn.com/b/psssql/archive/tags/AlwaysON/" /><category term="SQL Server 2012" scheme="http://blogs.msdn.com/b/psssql/archive/tags/SQL+Server+2012/" /></entry><entry><title>SQLIOSim Checksum Validations</title><link rel="alternate" type="text/html" href="http://blogs.msdn.com/b/psssql/archive/2013/04/05/sqliosim-checksum-validations.aspx" /><id>http://blogs.msdn.com/b/psssql/archive/2013/04/05/sqliosim-checksum-validations.aspx</id><published>2013-04-05T14:57:16Z</published><updated>2013-04-05T14:57:16Z</updated><content type="html">&lt;p&gt;I had a very specific question asked of me related to the SQLIOSIM.exe, checksum validation logic.&amp;#160; It is pretty simple logic (on purpose) but effective so here are the basics.&lt;/p&gt;  &lt;p&gt;&lt;span style="color: black; font-family: &amp;quot;Segoe UI&amp;quot;,&amp;quot;sans-serif&amp;quot;; font-size: 9pt;"&gt;The key is that there are multiple memory locations used to hold the data and do the comparison.&lt;/span&gt;&lt;span style="color: black; font-family: &amp;quot;Segoe UI&amp;quot;,&amp;quot;sans-serif&amp;quot;; font-size: 9pt;"&gt;&lt;o:p&gt;&amp;#160;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p&gt;&lt;a href="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-00-73-84-metablogapi/7245.image_5F00_3D1B5CAA.png"&gt;&lt;img title="image" style="border: 0px currentcolor; display: inline; background-image: none;" border="0" alt="image" src="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-00-73-84-metablogapi/0003.image_5F00_thumb_5F00_2347267B.png" width="643" height="322" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style="margin: 0in 0in 0pt;"&gt;&lt;font color="#000000" size="3" face="Times New Roman"&gt;&lt;/font&gt;&lt;/p&gt;  &lt;p class="MsoListParagraph" style="margin: 0in 0in 12pt 0.5in; text-indent: -0.25in; mso-list: l0 level1 lfo1;"&gt;&lt;!--[if !supportLists]--&gt;&lt;span style="color: black; font-family: &amp;quot;Segoe UI&amp;quot;,&amp;quot;sans-serif&amp;quot;; font-size: 9pt; mso-fareast-font-family: &amp;quot;Segoe UI&amp;quot;;"&gt;&lt;span style="mso-list: ignore;"&gt;1.&lt;span style="font: 7pt/normal &amp;quot;Times New Roman&amp;quot;; font-size-adjust: none; font-stretch: normal;"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;!--[endif]--&gt;&lt;span style="color: black; font-family: &amp;quot;Segoe UI&amp;quot;,&amp;quot;sans-serif&amp;quot;; font-size: 9pt;"&gt;Allocate a buffer in memory of 8K.&amp;#160; &lt;br /&gt;Stamp the page with random data using Crypto Random function(s)       &lt;br /&gt;Save Page Id, File Id, Random seed and calculated checksum values in the header of the page&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoListParagraph" style="margin: 0in 0in 12pt 0.5in; text-indent: -0.25in; mso-list: l0 level1 lfo1;"&gt;&lt;!--[if !supportLists]--&gt;&lt;span style="color: black; font-family: &amp;quot;Segoe UI&amp;quot;,&amp;quot;sans-serif&amp;quot;; font-size: 9pt; mso-fareast-font-family: &amp;quot;Segoe UI&amp;quot;;"&gt;&lt;span style="mso-list: ignore;"&gt;2.&lt;span style="font: 7pt/normal &amp;quot;Times New Roman&amp;quot;; font-size-adjust: none; font-stretch: normal;"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;!--[endif]--&gt;&lt;span style="color: black; font-family: &amp;quot;Segoe UI&amp;quot;,&amp;quot;sans-serif&amp;quot;; font-size: 9pt;"&gt;Send the page to stable media&amp;#160; (async I/O)      &lt;br /&gt;Check for proper write completion success&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoListParagraph" style="margin: 0in 0in 12pt 0.5in; text-indent: -0.25in; mso-list: l0 level1 lfo1;"&gt;&lt;!--[if !supportLists]--&gt;&lt;span style="color: black; font-family: &amp;quot;Segoe UI&amp;quot;,&amp;quot;sans-serif&amp;quot;; font-size: 9pt; mso-fareast-font-family: &amp;quot;Segoe UI&amp;quot;;"&gt;&lt;span style="mso-list: ignore;"&gt;3.&lt;span style="font: 7pt/normal &amp;quot;Times New Roman&amp;quot;; font-size-adjust: none; font-stretch: normal;"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;!--[endif]--&gt;&lt;span style="color: black; font-family: &amp;quot;Segoe UI&amp;quot;,&amp;quot;sans-serif&amp;quot;; font-size: 9pt;"&gt;Sometime after successful write(s).&amp;#160;&amp;#160; Allocate &lt;u&gt;another buffer&lt;/u&gt; and read the data from stable media.&amp;#160; &lt;br /&gt;(Note:&amp;#160; This is a separate buffer from that of the write call)&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoListParagraph" style="margin: 0in 0in 0pt 0.5in; text-indent: -0.25in; mso-list: l0 level1 lfo1;"&gt;&lt;!--[if !supportLists]--&gt;&lt;span style="color: black; font-family: &amp;quot;Segoe UI&amp;quot;,&amp;quot;sans-serif&amp;quot;; font-size: 9pt; mso-fareast-font-family: &amp;quot;Segoe UI&amp;quot;;"&gt;&lt;span style="mso-list: ignore;"&gt;4.&lt;span style="font: 7pt/normal &amp;quot;Times New Roman&amp;quot;; font-size-adjust: none; font-stretch: normal;"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;!--[endif]--&gt;&lt;span style="color: black; font-family: &amp;quot;Segoe UI&amp;quot;,&amp;quot;sans-serif&amp;quot;; font-size: 9pt;"&gt;Validate the bytes read.      &lt;br /&gt;      &lt;br /&gt;Do header checks for file id, page id, seed and checksum values       &lt;br /&gt;      &lt;br /&gt;Expected CheckSum: 0xEFC6D39C&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;/span&gt;&lt;span style="color: black; font-family: &amp;quot;Segoe UI&amp;quot;,&amp;quot;sans-serif&amp;quot;; font-size: 9pt;"&gt;---------- Checksum stored in the WRITE buffer&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style="margin: 0in 0in 0pt; text-indent: 0.5in;"&gt;&lt;span style="color: black; font-family: &amp;quot;Segoe UI&amp;quot;,&amp;quot;sans-serif&amp;quot;; font-size: 9pt;"&gt;Received CheckSum: 0xEFC6D39C&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;/span&gt;&lt;span style="color: black; font-family: &amp;quot;Segoe UI&amp;quot;,&amp;quot;sans-serif&amp;quot;; font-size: 9pt;"&gt;---------- Checksum stored in the READ buffer&amp;#160; (what stable media is returning)&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style="margin: 0in 0in 0pt; text-indent: 0.5in;"&gt;&lt;span style="color: black; font-family: &amp;quot;Segoe UI&amp;quot;,&amp;quot;sans-serif&amp;quot;; font-size: 9pt;"&gt;Calculated CheckSum: 0xFBD2A468&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;/span&gt;--------- Checksum as calculated on the READ buffer     &lt;br /&gt;&lt;/p&gt;  &lt;table cellspacing="0" cellpadding="2" width="688" border="0"&gt;&lt;tbody&gt;     &lt;tr&gt;       &lt;td valign="top" width="686"&gt;         &lt;br /&gt;The detailed (.TXT) output file(s) show the WRITE image, the READ image and the DIFFERENCES found between them&amp;#160; (think memcmp).&amp;#160;&amp;#160; When only a single buffer image is added to the detailed TXT file this indicates that the received header data was damaged or the WRITE buffer is no longer present in memory so only the on disk checksum vs calculated checksum are being compared. &lt;/td&gt;     &lt;/tr&gt;      &lt;tr&gt;       &lt;td valign="top" width="686"&gt;         &lt;br /&gt;If there appears to be damage SQLIOSim will attempt to read the same data 15 more times and validate before triggering the error condition.&amp;#160;&amp;#160; Studies from SQL Server and Exchange showed success of read-retries in some situations.&amp;#160; SQL Server and Exchange will perform up to 4 read-retries in the same situation. &lt;/td&gt;     &lt;/tr&gt;      &lt;tr&gt;       &lt;td valign="top" width="686"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;br /&gt;&lt;span style="color: black; font-family: &amp;quot;Segoe UI&amp;quot;,&amp;quot;sans-serif&amp;quot;; font-size: 9pt;"&gt;The window for damage possibilities is from the time the checksum is calculated to the time the read is validated.&amp;#160;&amp;#160; While this could be SQLIOSim the historical evidence shows this is a low probability.&amp;#160;&amp;#160; The majority of the time is in kernel and I/O path components and the majority of bugs over the last 8 years have been non-SQL related.&amp;#160;&amp;#160;&amp;#160; &lt;/span&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;/td&gt;     &lt;/tr&gt;      &lt;tr&gt;       &lt;td valign="top" width="686"&gt;&lt;span style="color: black; font-family: &amp;quot;Segoe UI&amp;quot;,&amp;quot;sans-serif&amp;quot;; font-size: 9pt;"&gt;           &lt;br /&gt;For vendor debugging the detailed TXT file contains the various page images as well as the sequence of Win32 API calls, thread ids and other information.&amp;#160;&amp;#160; Using techniques such as a bus analyzer or detailed I/O tracing the vendor can assist at pin-pointing the component causing the damage.&lt;/span&gt;&lt;/td&gt;     &lt;/tr&gt;   &lt;/tbody&gt;&lt;/table&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;p class="MsoNormal" style="margin: 0in 0in 0pt;"&gt;&lt;span style="color: black; font-family: &amp;quot;Segoe UI&amp;quot;,&amp;quot;sans-serif&amp;quot;; font-size: 9pt;"&gt;The top of the 8K page header is currently the following (Note: This may change with future versions of SQLIOSim.exe)&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style="margin: 0in 0in 0pt;"&gt;&lt;span style="color: black; font-family: &amp;quot;Segoe UI&amp;quot;,&amp;quot;sans-serif&amp;quot;; font-size: 9pt;"&gt;&lt;/span&gt;&lt;/p&gt;  &lt;blockquote&gt;   &lt;p class="MsoNormal" style="margin: 0in 0in 0pt;"&gt;&lt;span style="color: black; font-family: &amp;quot;Segoe UI&amp;quot;,&amp;quot;sans-serif&amp;quot;; font-size: 9pt;"&gt;DWORD&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; Page Number&amp;#160;&amp;#160;&amp;#160;&amp;#160; (Take * 8192 for file offset)&lt;/span&gt;&lt;/p&gt;    &lt;p class="MsoNormal" style="margin: 0in 0in 0pt;"&gt;&lt;span style="color: black; font-family: &amp;quot;Segoe UI&amp;quot;,&amp;quot;sans-serif&amp;quot;; font-size: 9pt;"&gt;DWORD&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; File Id&lt;/span&gt;&lt;/p&gt;    &lt;p class="MsoNormal" style="margin: 0in 0in 0pt;"&gt;&lt;span style="color: black; font-family: &amp;quot;Segoe UI&amp;quot;,&amp;quot;sans-serif&amp;quot;; font-size: 9pt;"&gt;DWORD&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; Seed value&lt;/span&gt;&lt;/p&gt;    &lt;p class="MsoNormal" style="margin: 0in 0in 0pt;"&gt;&lt;span style="color: black; font-family: &amp;quot;Segoe UI&amp;quot;,&amp;quot;sans-serif&amp;quot;; font-size: 9pt;"&gt;DWORD&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; Checksum CRC value&lt;/span&gt;&lt;/p&gt;    &lt;p class="MsoNormal" style="margin: 0in 0in 0pt;"&gt;&lt;span style="color: black; font-family: &amp;quot;Segoe UI&amp;quot;,&amp;quot;sans-serif&amp;quot;; font-size: 9pt;"&gt;BYTE&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; Data[8192 – size(HEADER)]&amp;#160;&amp;#160; &amp;lt;---------&amp;#160; Checksum protects this data&lt;/span&gt;&lt;/p&gt; &lt;/blockquote&gt;  &lt;p class="MsoNormal" style="margin: 0in 0in 0pt;"&gt;&lt;span style="color: rgb(166, 166, 166); font-family: &amp;quot;Calibri&amp;quot;,&amp;quot;sans-serif&amp;quot;; font-size: 8pt; mso-fareast-font-family: &amp;quot;Times New Roman&amp;quot;; mso-fareast-theme-font: minor-fareast; mso-bidi-font-family: &amp;quot;Times New Roman&amp;quot;; mso-ascii-theme-font: minor-latin; mso-hansi-theme-font: minor-latin; mso-ansi-language: en-us; mso-fareast-language: en-us; mso-bidi-language: ar-sa; mso-no-proof: yes;"&gt;Bob Dorr - Principal SQL Server Escalation Engineer      &lt;br style="mso-special-character: line-break;" /&gt;&lt;!--[if !supportLineBreakNewLine]--&gt;      &lt;br style="mso-special-character: line-break;" /&gt;&lt;!--[endif]--&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p&gt;&lt;font color="#000000" size="3" face="Times New Roman"&gt;&lt;/font&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style="margin: 0in 0in 0pt;"&gt;&lt;span style="color: black; font-family: &amp;quot;Segoe UI&amp;quot;,&amp;quot;sans-serif&amp;quot;; font-size: 9pt;"&gt;&lt;o:p&gt;&amp;#160;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p&gt;&lt;font color="#000000" size="3" face="Times New Roman"&gt;&lt;/font&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=10408013" width="1" height="1"&gt;</content><author><name>psssql</name><uri>http://blogs.msdn.com/psssql/ProfileUrlRedirect.ashx</uri></author><category term="Engine" scheme="http://blogs.msdn.com/b/psssql/archive/tags/Engine/" /><category term="2005 SP2" scheme="http://blogs.msdn.com/b/psssql/archive/tags/2005+SP2/" /><category term="Tools" scheme="http://blogs.msdn.com/b/psssql/archive/tags/Tools/" /><category term="2008" scheme="http://blogs.msdn.com/b/psssql/archive/tags/2008/" /><category term="2005" scheme="http://blogs.msdn.com/b/psssql/archive/tags/2005/" /><category term="2000" scheme="http://blogs.msdn.com/b/psssql/archive/tags/2000/" /><category term="SQL 2005" scheme="http://blogs.msdn.com/b/psssql/archive/tags/SQL+2005/" /><category term="SQL 2008" scheme="http://blogs.msdn.com/b/psssql/archive/tags/SQL+2008/" /><category term="2008 R2" scheme="http://blogs.msdn.com/b/psssql/archive/tags/2008+R2/" /><category term="SQL 2012" scheme="http://blogs.msdn.com/b/psssql/archive/tags/SQL+2012/" /></entry><entry><title>The Case of Anti-Virus filter drive interference with File Stream Restore</title><link rel="alternate" type="text/html" href="http://blogs.msdn.com/b/psssql/archive/2013/03/29/the-case-of-anti-virus-filter-drive-interference-with-file-stream-restore.aspx" /><id>http://blogs.msdn.com/b/psssql/archive/2013/03/29/the-case-of-anti-virus-filter-drive-interference-with-file-stream-restore.aspx</id><published>2013-03-29T21:47:06Z</published><updated>2013-03-29T21:47:06Z</updated><content type="html">&lt;p&gt;&lt;span style="color:purple; font-family:Segoe UI; font-size:9pt"&gt;"Denzil and I were working on this issue for a customer and Denzil has been gracious enough to write-up a blog for all of us." – Bob Dorr&lt;br/&gt;&lt;br/&gt;From Denzil:&lt;br/&gt;
		&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="color:black; font-family:Segoe UI; font-size:9pt"&gt;I recently worked with a customer on a Database restore issue where the database being restored had 2TB of File stream data. The restore in this case would just not complete successfully and would fail with the error below.&lt;br/&gt;
		&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="color:black; font-family:Segoe UI; font-size:9pt"&gt;10 percent processed.
&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="color:black; font-family:Segoe UI; font-size:9pt"&gt;20 percent processed.
&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="color:black; font-family:Segoe UI; font-size:9pt"&gt;30 percent processed.
&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="color:black; font-family:Segoe UI; font-size:9pt"&gt;40 percent processed.
&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="color:#c00000; font-family:Segoe UI; font-size:9pt"&gt;Msg 3634, Level 16, State 1, Line 1
&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="color:black; font-family:Segoe UI; font-size:9pt"&gt;The operating system returned the error '32(&lt;span style="background-color:yellow"&gt;The process cannot access the file because it is being used by another process.&lt;/span&gt;)' &lt;span style="background-color:yellow"&gt;while attempting 'OpenFile'&lt;/span&gt; on 'F:\SQLData11\DataFiles\535cc368-de43-4f03-9a64-f5506a3f532e\547fc3ed-da9f-44e0-9044-12babdb7cde8\00013562-0006edbb-0037'.
&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="color:black; font-family:Segoe UI; font-size:9pt"&gt;Msg 3013, Level 16, State 1, Line 1
&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="color:black; font-family:Segoe UI; font-size:9pt"&gt;RESTORE DATABASE is terminating abnormally.&lt;br/&gt;
		&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="color:black; font-family:Segoe UI; font-size:9pt"&gt;Subsequent restore attempts would fail with the same error though on "different" files and at a different point in the restore cycle.&lt;br/&gt;
		&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="color:black; font-family:Segoe UI; font-size:9pt"&gt;Given that this was "not" the same file or the same point of the restore on various attempts my thoughts immediately went to some filter driver under the covers wreaking some havoc.  I ran an a command to see what filter drivers were loaded (trimmed output below.)&lt;br/&gt;
		&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="color:black; font-family:Segoe UI; font-size:9pt"&gt;&lt;strong&gt;&lt;em&gt;C:\&amp;gt;fltmc instances&lt;/em&gt;&lt;/strong&gt;
		&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="color:black; font-family:Courier New; font-size:8pt"&gt;Filter                Volume Name           Altitude        Instance Name     
&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="color:black; font-family:Courier New; font-size:8pt"&gt;--------------------  -----------------------  ------------  ----------------------  -----   
&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="color:black; font-family:Courier New; font-size:8pt"&gt;BHDrvx64             F:\SQLData11              365100           BHDrvx64                     0   
&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="color:black; font-family:Courier New; font-size:8pt"&gt;eeCtrl               F:\SQLData11              329010           eeCtrl                        0    
&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="color:black; font-family:Courier New; font-size:8pt"&gt;SRTSP                F:\SQLData11              329000           SRTSP                        0  
&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="color:black; font-family:Courier New; font-size:8pt"&gt;&lt;span style="background-color:yellow"&gt;SymEFA&lt;/span&gt;                 F:\SQLData11              260600           SymEFA                        0  
&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="color:black; font-family:Courier New; font-size:8pt"&gt;RsFx0105               \Device\Mup              41001.05        RsFx0105 MiniFilter Instance  0    
&lt;/span&gt;&lt;/p&gt;&lt;p&gt;
 &lt;/p&gt;&lt;p&gt;&lt;span style="color:black; font-family:Segoe UI; font-size:9pt"&gt;SymEFA         = Symantec extended file attributes driver&lt;br/&gt;SRTSP        = Symantec Endpoint protection                &lt;br/&gt;RsFx0105     = SQL Server File Stream filter driver.&lt;br/&gt;
		&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="color:black; font-family:Segoe UI; font-size:9pt"&gt;In discussing this with the customer, Anti-virus exclusions were controlled by GPO so he had put in a request to exclude the respective folders, yet the issue still continued.&lt;br/&gt;
		&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="color:black; font-family:Segoe UI; font-size:9pt"&gt;In order to do my due diligence, the other question was whether we "released" the file handle after we created it, and whether someone else grabbed it? So we (Venu, Bob and I) did take a look at the code and this can be the case. On SQL Server 2008 R2 when we call the &lt;strong&gt;CreateFile&lt;/strong&gt; API and we hardcode the &lt;strong&gt;&lt;em&gt;shareAccess&lt;/em&gt;&lt;/strong&gt; parameter to 0 which is exclusive access while we have it open to prevent secondary access.&lt;br/&gt;
		&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;a href="http://msdn.microsoft.com/en-us/library/windows/desktop/aa363858(v=vs.85).aspx"&gt;&lt;span style="color:black; font-family:Segoe UI; font-size:9pt"&gt;http://msdn.microsoft.com/en-us/library/windows/desktop/aa363858(v=vs.85).aspx&lt;/span&gt;&lt;/a&gt;&lt;span style="color:black; font-family:Segoe UI; font-size:9pt"&gt;
		&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="color:black; font-family:Segoe UI; font-size:9pt"&gt;&lt;em&gt;If this parameter is zero and &lt;strong&gt;CreateFile&lt;/strong&gt; succeeds, the file or device cannot be shared and cannot be opened again until the handle to the file or device is closed. For more information, see the Remarks section.&lt;br/&gt;&lt;/em&gt;
		&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="color:black; font-family:Segoe UI; font-size:9pt"&gt;Once the file is created, we release the EX latch and can close the file handle, on the file, but sqlservr.exe continues to hold the lock on the file itself during the restore process. Once the restore operation is completed, we no longer hold an exclusive lock to the file.  &lt;br/&gt;
		&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="color:black; font-family:Segoe UI; font-size:9pt"&gt;We can reopen file handles during the Recovery process so the other thought was perhaps it was a transaction affected by recovery and GC and potentially some race condition but in this case we know that the restore was failing prior to that as it didn't reach 100% so that could be ruled out as well.&lt;br/&gt;
		&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="color:black; font-family:Segoe UI; font-size:9pt"&gt;Getting a dump at the failure time showed me the same Restore Stack but different dumps showed multiple different files in question so it wasn't a particular Log record sequence per say causing this.&lt;br/&gt;
		&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="color:black; font-family:Courier New; font-size:9pt"&gt;sqlservr!ex_raise&lt;br/&gt;sqlservr!HandleOSError
&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="color:black; font-size:9pt"&gt;&lt;span style="font-family:Courier New"&gt;&lt;span style="background-color:yellow"&gt;sqlservr!FileHandleCache::OpenFile&lt;/span&gt;&lt;br/&gt;sqlservr!FileHandleCache::ProbeForFileHandle&lt;br/&gt;sqlservr!FileHandleCache::GetFileHandle&lt;br/&gt;sqlservr!RestoreCopyContext::RestoreFilesystemData&lt;br/&gt;BackupIoRequest::StartDatabaseScatteredWrite&lt;br/&gt;&lt;/span&gt;&lt;span style="font-family:Segoe UI"&gt;
			&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="color:black; font-family:Segoe UI; font-size:9pt"&gt;Given now that it was unlikely it was SQL Server, I concentrated more on the Filter driver theory. I tried to capture Process monitor, but given the time it took and amount of files touched, Process monitor was not all that useful.  I couldn't filter on a specific folder as it failed on different folders and there were 10 + mount points involved.&lt;br/&gt;
		&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="color:black; font-family:Segoe UI; font-size:9pt"&gt;However from Process monitor while the restore was going on, I looked at the stack for some I/O operations (not ones that failed by any means) and I still saw fltmgr.sys sitting there for an OpenFile Call on a file in the filestream directory&lt;br/&gt;
		&lt;/span&gt;&lt;/p&gt;&lt;div&gt;&lt;table style="border-collapse:collapse" border="0"&gt;&lt;colgroup&gt;&lt;col style="width:274px"/&gt;&lt;col style="width:144px"/&gt;&lt;col style="width:420px"/&gt;&lt;/colgroup&gt;&lt;tbody valign="top"&gt;&lt;tr style="height: 20px"&gt;&lt;td vAlign="bottom" style="padding-left: 7px; padding-right: 7px"&gt;&lt;p&gt;&lt;span style="color:black; font-family:Courier New; font-size:9pt"&gt;fltmgr.sys + 0x2765&lt;/span&gt;&lt;/p&gt;&lt;/td&gt;&lt;td vAlign="bottom" style="padding-left: 7px; padding-right: 7px"&gt;&lt;p&gt;&lt;span style="color:black; font-family:Courier New; font-size:9pt"&gt;0xfffffa6001009765&lt;/span&gt;&lt;/p&gt;&lt;/td&gt;&lt;td vAlign="bottom" style="padding-left: 7px; padding-right: 7px"&gt;&lt;p&gt;&lt;span style="color:black; font-family:Courier New; font-size:9pt"&gt;C:\Windows\system32\drivers\fltmgr.sys&lt;/span&gt;&lt;/p&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr style="height: 20px"&gt;&lt;td vAlign="bottom" style="padding-left: 7px; padding-right: 7px"&gt;&lt;p&gt;&lt;span style="color:black; font-family:Courier New; font-size:9pt"&gt;fltmgr.sys + 0x424c&lt;/span&gt;&lt;/p&gt;&lt;/td&gt;&lt;td vAlign="bottom" style="padding-left: 7px; padding-right: 7px"&gt;&lt;p&gt;&lt;span style="color:black; font-family:Courier New; font-size:9pt"&gt;0xfffffa600100b24c&lt;/span&gt;&lt;/p&gt;&lt;/td&gt;&lt;td vAlign="bottom" style="padding-left: 7px; padding-right: 7px"&gt;&lt;p&gt;&lt;span style="color:black; font-family:Courier New; font-size:9pt"&gt;C:\Windows\system32\drivers\fltmgr.sys&lt;/span&gt;&lt;/p&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr style="height: 20px"&gt;&lt;td vAlign="bottom" style="padding-left: 7px; padding-right: 7px"&gt;&lt;p&gt;&lt;span style="color:black; font-family:Courier New; font-size:9pt"&gt;fltmgr.sys + 0x1f256&lt;/span&gt;&lt;/p&gt;&lt;/td&gt;&lt;td vAlign="bottom" style="padding-left: 7px; padding-right: 7px"&gt;&lt;p&gt;&lt;span style="color:black; font-family:Courier New; font-size:9pt"&gt;0xfffffa6001026256&lt;/span&gt;&lt;/p&gt;&lt;/td&gt;&lt;td vAlign="bottom" style="padding-left: 7px; padding-right: 7px"&gt;&lt;p&gt;&lt;span style="color:black; font-family:Courier New; font-size:9pt"&gt;C:\Windows\system32\drivers\fltmgr.sys&lt;/span&gt;&lt;/p&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr style="height: 20px"&gt;&lt;td vAlign="bottom" style="padding-left: 7px; padding-right: 7px"&gt;&lt;p&gt;&lt;span style="color:black; font-family:Courier New; font-size:9pt"&gt;ntoskrnl.exe + 0x2c8949&lt;/span&gt;&lt;/p&gt;&lt;/td&gt;&lt;td vAlign="bottom" style="padding-left: 7px; padding-right: 7px"&gt;&lt;p&gt;&lt;span style="color:black; font-family:Courier New; font-size:9pt"&gt;0xfffff80002918949&lt;/span&gt;&lt;/p&gt;&lt;/td&gt;&lt;td vAlign="bottom" style="padding-left: 7px; padding-right: 7px"&gt;&lt;p&gt;&lt;span style="color:black; font-family:Courier New; font-size:9pt"&gt;C:\Windows\system32\ntoskrnl.exe&lt;/span&gt;&lt;/p&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr style="height: 20px"&gt;&lt;td vAlign="bottom" style="padding-left: 7px; padding-right: 7px"&gt;&lt;p&gt;&lt;span style="color:black; font-family:Courier New; font-size:9pt"&gt;ntoskrnl.exe + 0x2c0e42&lt;/span&gt;&lt;/p&gt;&lt;/td&gt;&lt;td vAlign="bottom" style="padding-left: 7px; padding-right: 7px"&gt;&lt;p&gt;&lt;span style="color:black; font-family:Courier New; font-size:9pt"&gt;0xfffff80002910e42&lt;/span&gt;&lt;/p&gt;&lt;/td&gt;&lt;td vAlign="bottom" style="padding-left: 7px; padding-right: 7px"&gt;&lt;p&gt;&lt;span style="color:black; font-family:Courier New; font-size:9pt"&gt;C:\Windows\system32\ntoskrnl.exe&lt;/span&gt;&lt;/p&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr style="height: 20px"&gt;&lt;td vAlign="bottom" style="padding-left: 7px; padding-right: 7px"&gt;&lt;p&gt;&lt;span style="color:black; font-family:Courier New; font-size:9pt"&gt;ntoskrnl.exe + 0x2c19d5&lt;/span&gt;&lt;/p&gt;&lt;/td&gt;&lt;td vAlign="bottom" style="padding-left: 7px; padding-right: 7px"&gt;&lt;p&gt;&lt;span style="color:black; font-family:Courier New; font-size:9pt"&gt;0xfffff800029119d5&lt;/span&gt;&lt;/p&gt;&lt;/td&gt;&lt;td vAlign="bottom" style="padding-left: 7px; padding-right: 7px"&gt;&lt;p&gt;&lt;span style="color:black; font-family:Courier New; font-size:9pt"&gt;C:\Windows\system32\ntoskrnl.exe&lt;/span&gt;&lt;/p&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr style="height: 20px"&gt;&lt;td vAlign="bottom" style="padding-left: 7px; padding-right: 7px"&gt;&lt;p&gt;&lt;span style="color:black; font-family:Courier New; font-size:9pt"&gt;ntoskrnl.exe + 0x2c6fb7&lt;/span&gt;&lt;/p&gt;&lt;/td&gt;&lt;td vAlign="bottom" style="padding-left: 7px; padding-right: 7px"&gt;&lt;p&gt;&lt;span style="color:black; font-family:Courier New; font-size:9pt"&gt;0xfffff80002916fb7&lt;/span&gt;&lt;/p&gt;&lt;/td&gt;&lt;td vAlign="bottom" style="padding-left: 7px; padding-right: 7px"&gt;&lt;p&gt;&lt;span style="color:black; font-family:Courier New; font-size:9pt"&gt;C:\Windows\system32\ntoskrnl.exe&lt;/span&gt;&lt;/p&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr style="height: 20px"&gt;&lt;td vAlign="bottom" style="padding-left: 7px; padding-right: 7px"&gt;&lt;p&gt;&lt;span style="color:black; font-family:Courier New; font-size:9pt"&gt;ntoskrnl.exe + 0x2b61a8&lt;/span&gt;&lt;/p&gt;&lt;/td&gt;&lt;td vAlign="bottom" style="padding-left: 7px; padding-right: 7px"&gt;&lt;p&gt;&lt;span style="color:black; font-family:Courier New; font-size:9pt"&gt;0xfffff800029061a8&lt;/span&gt;&lt;/p&gt;&lt;/td&gt;&lt;td vAlign="bottom" style="padding-left: 7px; padding-right: 7px"&gt;&lt;p&gt;&lt;span style="color:black; font-family:Courier New; font-size:9pt"&gt;C:\Windows\system32\ntoskrnl.exe&lt;/span&gt;&lt;/p&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr style="height: 20px"&gt;&lt;td vAlign="bottom" style="padding-left: 7px; padding-right: 7px"&gt;&lt;p&gt;&lt;span style="color:black; font-family:Courier New; font-size:9pt"&gt;ntoskrnl.exe + 0x57573&lt;/span&gt;&lt;/p&gt;&lt;/td&gt;&lt;td vAlign="bottom" style="padding-left: 7px; padding-right: 7px"&gt;&lt;p&gt;&lt;span style="color:black; font-family:Courier New; font-size:9pt"&gt;0xfffff800026a7573&lt;/span&gt;&lt;/p&gt;&lt;/td&gt;&lt;td vAlign="bottom" style="padding-left: 7px; padding-right: 7px"&gt;&lt;p&gt;&lt;span style="color:black; font-family:Courier New; font-size:9pt"&gt;C:\Windows\system32\ntoskrnl.exe&lt;/span&gt;&lt;/p&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr style="height: 20px"&gt;&lt;td vAlign="bottom" style="padding-left: 7px; padding-right: 7px"&gt;&lt;p&gt;&lt;span style="color:black; font-family:Courier New; font-size:9pt"&gt;ntdll.dll + 0x471aa&lt;/span&gt;&lt;/p&gt;&lt;/td&gt;&lt;td vAlign="bottom" style="padding-left: 7px; padding-right: 7px"&gt;&lt;p&gt;&lt;span style="color:black; font-family:Courier New; font-size:9pt"&gt;0x77b371aa&lt;/span&gt;&lt;/p&gt;&lt;/td&gt;&lt;td vAlign="bottom" style="padding-left: 7px; padding-right: 7px"&gt;&lt;p&gt;&lt;span style="color:black; font-family:Courier New; font-size:9pt"&gt;C:\Windows\System32\ntdll.dll     ZwOpenFile&lt;/span&gt;&lt;/p&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr style="height: 20px"&gt;&lt;td vAlign="bottom" style="padding-left: 7px; padding-right: 7px"&gt;&lt;p&gt;&lt;span style="color:black; font-family:Courier New; font-size:9pt"&gt;kernel32.dll + 0x10d48&lt;/span&gt;&lt;/p&gt;&lt;/td&gt;&lt;td vAlign="bottom" style="padding-left: 7px; padding-right: 7px"&gt;&lt;p&gt;&lt;span style="color:black; font-family:Courier New; font-size:9pt"&gt;0x779d0d48&lt;/span&gt;&lt;/p&gt;&lt;/td&gt;&lt;td vAlign="bottom" style="padding-left: 7px; padding-right: 7px"&gt;&lt;p&gt;&lt;span style="color:black; font-family:Courier New; font-size:9pt"&gt;C:\Windows\system32\kernel32.dll&lt;/span&gt;&lt;/p&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr style="height: 20px"&gt;&lt;td vAlign="bottom" style="padding-left: 7px; padding-right: 7px"&gt;&lt;p&gt;&lt;span style="color:black; font-family:Courier New; font-size:9pt"&gt;kernel32.dll + 0x10a7c&lt;/span&gt;&lt;/p&gt;&lt;/td&gt;&lt;td vAlign="bottom" style="padding-left: 7px; padding-right: 7px"&gt;&lt;p&gt;&lt;span style="color:black; font-family:Courier New; font-size:9pt"&gt;0x779d0a7c&lt;/span&gt;&lt;/p&gt;&lt;/td&gt;&lt;td vAlign="bottom" style="padding-left: 7px; padding-right: 7px"&gt;&lt;p&gt;&lt;span style="color:black; font-family:Courier New; font-size:9pt"&gt;GetVolumeNameForRoot&lt;/span&gt;&lt;/p&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr style="height: 20px"&gt;&lt;td vAlign="bottom" style="padding-left: 7px; padding-right: 7px"&gt;&lt;p&gt;&lt;span style="color:black; font-family:Courier New; font-size:9pt"&gt;_____SQL______Process______Available + 0x695c7e&lt;/span&gt;&lt;/p&gt;&lt;/td&gt;&lt;td vAlign="bottom" style="padding-left: 7px; padding-right: 7px"&gt;&lt;p&gt;&lt;span style="color:black; font-family:Courier New; font-size:9pt"&gt;0x1a080fe&lt;/span&gt;&lt;/p&gt;&lt;/td&gt;&lt;td vAlign="bottom" style="padding-left: 7px; padding-right: 7px"&gt;&lt;p&gt;&lt;span style="color:black; font-family:Courier New; font-size:9pt"&gt;GetVolumeDeviceNameAndMountPoint&lt;/span&gt;&lt;/p&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr style="height: 20px"&gt;&lt;td vAlign="bottom" style="padding-left: 7px; padding-right: 7px"&gt;&lt;p&gt;&lt;span style="color:black; font-family:Courier New; font-size:9pt"&gt;_____SQL______Process______Available + 0x6d6898&lt;/span&gt;&lt;/p&gt;&lt;/td&gt;&lt;td vAlign="bottom" style="padding-left: 7px; padding-right: 7px"&gt;&lt;p&gt;&lt;span style="color:black; font-family:Courier New; font-size:9pt"&gt;0x1a48d18&lt;/span&gt;&lt;/p&gt;&lt;/td&gt;&lt;td vAlign="bottom" style="padding-left: 7px; padding-right: 7px"&gt;&lt;ul&gt;&lt;li&gt;&lt;span style="color:black; font-family:Courier New; font-size:9pt"&gt;ParseContainerPath&lt;/span&gt;&lt;/li&gt;&lt;/ul&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr style="height: 20px"&gt;&lt;td vAlign="bottom" style="padding-left: 7px; padding-right: 7px"&gt;&lt;p&gt;&lt;span style="color:black; font-family:Courier New; font-size:9pt"&gt;_____SQL______Process______Available + 0x6d714a&lt;/span&gt;&lt;/p&gt;&lt;/td&gt;&lt;td vAlign="bottom" style="padding-left: 7px; padding-right: 7px"&gt;&lt;p&gt;&lt;span style="color:black; font-family:Courier New; font-size:9pt"&gt;0x1a495ca&lt;/span&gt;&lt;/p&gt;&lt;/td&gt;&lt;td vAlign="bottom" style="padding-left: 7px; padding-right: 7px"&gt;&lt;p&gt;&lt;span style="color:black; font-family:Courier New; font-size:9pt"&gt;sqlservr!CFsaShareFilter::RsFxControlContainerOwnership&lt;/span&gt;&lt;/p&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr style="height: 20px"&gt;&lt;td vAlign="bottom" style="padding-left: 7px; padding-right: 7px"&gt; &lt;/td&gt;&lt;td vAlign="bottom" style="padding-left: 7px; padding-right: 7px"&gt; &lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;/div&gt;&lt;p&gt;&lt;span style="color:black; font-family:Segoe UI; font-size:9pt"&gt;Also looking at some other Symantec related issues, I found an article not necessarily to do with any SQL restores but the fact that this was a possibility – again this has to do with a specific issue on a specific build, but am illustrating that Filter drivers can cause some unexpected behaviors.&lt;br/&gt; 
&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="color:black; font-family:Segoe UI; font-size:9pt"&gt;As far as Anti-virus exclusions go, we actually have guidance in the article below: &lt;a href="http://support.microsoft.com/kb/309422"&gt;http://support.microsoft.com/kb/309422&lt;/a&gt;
			&lt;br/&gt;
		&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="color:black; font-family:Segoe UI; font-size:9pt"&gt;And also in our File stream best practices article: &lt;a href="http://msdn.microsoft.com/en-us/library/dd206979(v=SQL.105).aspx"&gt;http://msdn.microsoft.com/en-us/library/dd206979(v=SQL.105).aspx&lt;/a&gt;&lt;br/&gt;
		&lt;/span&gt;&lt;/p&gt;&lt;p style="margin-left: 36pt"&gt;&lt;span style="color:black; font-family:Segoe UI; font-size:9pt"&gt;&lt;em&gt;When you set up FILESTREAM storage volumes, consider the following guidelines:
&lt;/em&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="margin-left: 36pt"&gt;&lt;span style="color:black; font-family:Segoe UI; font-size:9pt"&gt;&lt;em&gt;•Turn off short file names on FILESTREAM computer systems. Short file names take significantly longer to create. To disable short file names, use the Windows fsutil utility.
&lt;/em&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="margin-left: 36pt"&gt;&lt;span style="color:black; font-family:Segoe UI; font-size:9pt"&gt;&lt;em&gt;•Regularly defragment FILESTREAM computer systems.
&lt;/em&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="margin-left: 36pt"&gt;&lt;span style="color:black; font-family:Segoe UI; font-size:9pt"&gt;&lt;em&gt;•Use 64-KB NTFS clusters. Compressed volumes must be set to 4-KB NTFS clusters.
&lt;/em&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="margin-left: 36pt"&gt;&lt;span style="color:black; font-family:Segoe UI; font-size:9pt"&gt;&lt;em&gt;•Disable indexing on FILESTREAM volumes and set disablelastaccess to set disablelastaccess, use the Windows fsutil utility.
&lt;/em&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="margin-left: 36pt"&gt;&lt;span style="color:black; font-family:Segoe UI; font-size:9pt"&gt;&lt;em&gt;•&lt;strong&gt;Disable antivirus scanning of FILESTREAM volumes when it is not unnecessary&lt;/strong&gt;. If antivirus scanning is necessary, avoid setting policies that will automatically delete offending files.
&lt;/em&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="margin-left: 36pt"&gt;&lt;span style="color:black; font-family:Segoe UI; font-size:9pt"&gt;&lt;em&gt;•Set up and tune the RAID level for fault tolerance and the performance that is required by an application&lt;/em&gt;.&lt;br/&gt;
		&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="color:black; font-family:Segoe UI; font-size:9pt"&gt;Looking at another run of "&lt;strong&gt;&lt;em&gt;fltmc instances&lt;/em&gt;&lt;/strong&gt;" command output and still saw the Anti-virus components on the list for those mount points. Given we "thought" we had put an exclusion in for the whole drive, and it was showing up, it was time to look at this closer&lt;br/&gt;
		&lt;/span&gt;&lt;/p&gt;&lt;ol&gt;&lt;li&gt;&lt;span style="color:black; font-family:Segoe UI; font-size:9pt"&gt;Excluded the drives where the data was being stored – Restore still failed
&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span style="color:black; font-family:Segoe UI; font-size:9pt"&gt;Stopped the AV Services  - Restore still failed
&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span style="color:black; font-family:Segoe UI; font-size:9pt"&gt;Uninstalled Anti-virus – Restore now succeeded&lt;br/&gt;
			&lt;/span&gt;&lt;/li&gt;&lt;/ol&gt;&lt;p&gt;&lt;span style="color:black; font-family:Segoe UI; font-size:9pt"&gt;Voila once we uninstalled AV on this machine, the restore succeeded. The customer is broaching this this with the AV vendor to figure out more of the root cause.
&lt;/span&gt;&lt;/p&gt;&lt;p&gt;
 &lt;/p&gt;&lt;p&gt;&lt;span style="color:black; font-family:Segoe UI; font-size:9pt"&gt;Denzil Ribeiro – Senior PFE
&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=10406406" width="1" height="1"&gt;</content><author><name>psssql</name><uri>http://blogs.msdn.com/psssql/ProfileUrlRedirect.ashx</uri></author><category term="File Stream" scheme="http://blogs.msdn.com/b/psssql/archive/tags/File+Stream/" /></entry></feed>