<?xml version="1.0" encoding="utf-8"?>
<rss xmlns:atom="http://www.w3.org/2005/Atom" xmlns:sy="http://purl.org/rss/1.0/modules/syndication/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
  version="2.0">
  <channel>
    <title>Sakthi's SQL Server Channel</title>
    <atom:link
      href="https://docs.microsoft.com/archive/blogs/sqlsakthi/feed.xml"
      rel="self"
      type="application/rss+xml" />
    <link>https://docs.microsoft.com/archive/blogs/sqlsakthi/feed.xml</link>
    <description>A window to express my views about SQL Server Database Management System.</description>
    <lastBuildDate>Thu, 25 Jan 2018 03:20:54 GMT</lastBuildDate>
    <language>en-US</language>
    <sy:updatePeriod>hourly</sy:updatePeriod>
    <sy:updateFrequency>1</sy:updateFrequency>
    <item>
      <title>User realm discovery failed from ADOMD</title>
      <link>https://docs.microsoft.com/archive/blogs/sqlsakthi/user-realm-discovery-failed-from-adomd</link>
      <pubDate>Thu, 25 Jan 2018 03:19:05 GMT</pubDate>
      <dc:creator><![CDATA[Sakthivel Chidambaram]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/sqlsakthi/?p=675</guid>
      <description><![CDATA[This is a short blog post to share a solution to the error "User realm discovery failed". This is a...]]></description>
      <content:encoded><![CDATA[This is a short blog post to share a solution to the error "User realm discovery failed". This is a generic error when you authenticate in Azure Active Directory (AAD) from any application. In my scenario, we got this error when were trying to authenticate to Azure Analysis Services using ADOMD provider.

Here is the connection string we had in our code:
<blockquote>DataSource=asazure://westus.asazure.windows.net/tabularservername;Persist Security Info=True;User ID=<span style="color: #800000">internaldomain\serviceaccountname</span>;Password=highlycomplexpassword</blockquote>
and we got this error:
<blockquote>User realm discovery failed. System: The remote server returned an error: (404) Not Found.</blockquote>
On the first thought, I thought this had to do with the version of analysis services binaries I was using since the support for AAD might not be available in older version of analysis services dll but that theory was ruled out when we tried the <a href="https://docs.microsoft.com/en-us/azure/analysis-services/analysis-services-data-providers">latest version of analysis services binaries</a> and we still got the same error.

So, I tried to take a closer look at the error, this part of the error message "User realm discovery failed" gave a clue that AAD is unable to locate the service account we are using. So, we made a change to use the <a href="https://docs.microsoft.com/en-us/azure/active-directory/connect/active-directory-aadconnect-user-signin">UPN format</a> for the service account and viola, it worked!

So, here is how the connection string with UPN format will look like
<blockquote>DataSource=asazure://westus.asazure.windows.net/tabularservername;Persist Security Info=True;User ID=<span style="color: #800000">serviceaccountname@contoso.com;</span>Password=highlycomplexpassword</blockquote>
Hope it helps!]]></content:encoded>
    </item>
    <item>
      <title>Error: "Could not retrieve backup settings for primary" in Log shipping Backup job</title>
      <link>https://docs.microsoft.com/archive/blogs/sqlsakthi/error-could-not-retrieve-backup-settings-for-primary-in-log-shipping-backup-job</link>
      <pubDate>Wed, 13 Jun 2012 23:04:00 GMT</pubDate>
      <dc:creator><![CDATA[Sakthivel Chidambaram]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/sqlsakthi/2012/06/13/error-could-not-retrieve-backup-settings-for-primary-in-log-shipping-backup-job/</guid>
      <description><![CDATA[This one is simple but interesting...
Log shipping which was running for an year, suddenly stopped...]]></description>
      <content:encoded><![CDATA[<p>This one is simple but interesting...</p>
<p>Log shipping which was running for an year, suddenly stopped working. Log shipping monitor says that there are no backups restored for last 14849 minutes... Why?</p>
<p>We started figuring this out, the copy and restore jobs were running fine but only the backup job was failing.</p>
<p>What was the error generated by the Log shipping backup job?</p>
<p><span style="color: #000000; font-family: courier new,courier;">*** Error: Could not retrieve backup settings for primary ID 'abfb9a42-207e-451b-968c-3ac29edc16f9'.(Microsoft.SqlServer.Management.LogShipping) ***</span><br /><span style="color: #000000; font-family: courier new,courier;">*** Error: <span style="background-color: #ffff00;">Failed to connect to server SQLSERVER2001</span>.(Microsoft.SqlServer.ConnectionInfo) ***</span><br /><span style="color: #000000; font-family: courier new,courier;">*** Error: 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)(.Net SqlClient Data Provider) ***</span><br /><span style="color: #000000; font-family: courier new,courier;">----- END OF TRANSACTION LOG BACKUP -----</span></p>
<p>But the&nbsp;name of the&nbsp;SQL Server name is SQLSERVER2012, so why is it looking for SQLSERVER2001? This is because the server was renamed from SQLSERVER2001 to SQLSERVER2012 recently but the sys.servers was not updated with this change.</p>
<p>As a result,&nbsp;SELECT @@SERVERNAME still points to old name so we ran commands given below to update sys.server entry and then <span style="text-decoration: underline;">RESTARTED</span> SQL Server:</p>
<p><span style="color: #0000ff;">EXEC sp_dropserver 'Your_OLD_Computer_Name'</span></p>
<p><span style="color: #0000ff;">GO</span></p>
<p><span style="color: #0000ff;">EXEC sp_addserver 'Your_NEW_Computer_Name', 'local'</span></p>
<p><span style="color: #0000ff;">GO</span></p>
<p>Now we&nbsp;reconfigured log shipping&nbsp;to make it work. You can either do this or update the Log shipping backup with correct SQL Server instance name or create a SQL Server alias pointing back to new server name to make it work. Still not working? Leave the error message in the comments here....</p>
<p><span style="text-decoration: underline;"><strong>Reference:</strong></span></p>
<p>Rename a Computer that Hosts a Stand-Alone Instance of SQL Server - <a href="http://msdn.microsoft.com/en-us/library/ms143799.aspx">http://msdn.microsoft.com/en-us/library/ms143799.aspx</a></p>]]></content:encoded>
    </item>
    <item>
      <title>Wow... We have MAXDOP calculator for SQL Server... It makes my job easier...</title>
      <link>https://docs.microsoft.com/archive/blogs/sqlsakthi/wow-we-have-maxdop-calculator-for-sql-server-it-makes-my-job-easier</link>
      <pubDate>Wed, 23 May 2012 21:17:00 GMT</pubDate>
      <dc:creator><![CDATA[Sakthivel Chidambaram]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/sqlsakthi/2012/05/23/wow-we-have-maxdop-calculator-for-sql-server-it-makes-my-job-easier/</guid>
      <description><![CDATA[So after Max. Server Memory calculator, to make your life much more easier, here is the Max Degree...]]></description>
      <content:encoded><![CDATA[<p>So after Max. Server Memory calculator, to make your life much more easier, here is the Max Degree of Parallelism or MAXDOP calculator.</p>
<p><span style="background-color: #ffffff;">We are usi</span><span style="background-color: #ffffff;">ng SQL DMV's to&nbsp;find out&nbsp;the number of NUMA nodes and Powershell query to&nbsp;find out the number of processor cores and then use the recommendations given in&nbsp;<a href="http://support.microsoft.com/kb/2023536">http://support.microsoft.com/kb/2023536</a> to&nbsp;give a MAXDOP value to be set in SQL Server.</span></p>
<p><span style="background-color: #ffffff;">As stated in this KB:</span></p>
<p><span style="background-color: #ffff99;">"...<em>The maximum value of 8 provided in the above guideline is applicable for typical SQL Server activity and the overhead for the exchange operators used in parallel query plans. You could vary this maximum value depending upon your specific application patterns and concurrent activity on the SQL Server. </em></span></p>
<p><span style="background-color: #ffff99;"><em>For example:-&nbsp;</em></span></p>
<p><span style="background-color: #ffff99;"><em>If&nbsp;you have very small number of concurrently&nbsp;executing queries&nbsp;relative to the number of&nbsp;processors,&nbsp;then you&nbsp;can set maxdop to a higher value like 16.<br />If&nbsp;you have&nbsp;very&nbsp;large number of concurrently&nbsp;executing queries&nbsp;relative to the number of&nbsp;processors, then you can set maxdop to a lower value such as 4.&nbsp;<br />Any value you propose to use should be thoroughly tested against the specific application activity or pattern of queries..."</em></span></p>
<p><span style="background-color: #ffffff;">You can then follow <a href="http://msdn.microsoft.com/en-us/library/ms189094.aspx">http://msdn.microsoft.com/en-us/library/ms189094.aspx</a>&nbsp;and set Max. Degree of Parallelism in SQL Server.</span></p>
<p><span style="background-color: #ffffff;">Please note that we detect the number of cores available in the Server from OS perspective, so if you have limited the number of processors to SQL Server, this calculator will not be able to adjust the values accordingly so may not be useful to you.</span></p>
<p><span style="background-color: #ffffff;">This calculator assumes that there are equal number of processors per NUMA node.</span></p>
<p><span style="background-color: #ffffff;">This calculator works for SQL Server 2005 &amp; above running on Windows Server 2008 and above. To make this to work on Windows 2003, please install the hotfix mentioned in&nbsp;</span><span style="background-color: #ffffff;"><a href="http://blogs.technet.com/b/mapblog/archive/2012/02/03/why-doesn-t-the-map-toolkit-report-the-number-of-cores.aspx">http://blogs.technet.com/b/mapblog/archive/2012/02/03/why-doesn-t-the-map-toolkit-report-the-number-of-cores.aspx</a></span></p>
<p><span style="background-color: #ffffff;"><span style="background-color: #ffff00;">Calculator: <a href="http://blogs.msdn.com/b/sqlsakthi/p/maxdop-calculator-sqlserver.aspx"><span style="background-color: #ffff00;">http://blogs.msdn.com/b/sqlsakthi/p/maxdop-calculator-sqlserver.aspx</span></a></span></span></p>
<p><span style="background-color: #ffffff;">Keep your feedbacks coming through comments section in this blog post...</span></p>
<p><span style="background-color: #ffffff;"></span>&nbsp;</p>
<p><em><strong><span style="background-color: #ffffff;">Sakthivel Chidambaram, Microsoft</span></strong></em></p>]]></content:encoded>
    </item>
    <item>
      <title>Cool... Now we have a calculator for finding out a Max. Server Memory value</title>
      <link>https://docs.microsoft.com/archive/blogs/sqlsakthi/cool-now-we-have-a-calculator-for-finding-out-a-max-server-memory-value</link>
      <pubDate>Fri, 18 May 2012 22:18:00 GMT</pubDate>
      <dc:creator><![CDATA[Sakthivel Chidambaram]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/sqlsakthi/2012/05/18/cool-now-we-have-a-calculator-for-finding-out-a-max-server-memory-value/</guid>
      <description><![CDATA[This calculator is now withdrawn 
since I'm not able to invest my time 
to improve it to make it...]]></description>
      <content:encoded><![CDATA[<p><span style="color: #ff0000; font-size: x-large; background-color: #ffff00;">This calculator is now withdrawn </span></p>
<p><span style="color: #ff0000; font-size: x-large; background-color: #ffff00;">since I'm not able to invest my time </span></p>
<p><span style="color: #ff0000; font-size: x-large; background-color: #ffff00;">to improve it to make it "stay current". </span></p>
<p><span style="color: #ff0000; font-size: x-large; background-color: #ffff00;">Apologize for the inconvenience!</span></p>
<p>&nbsp;</p>
<p>Hello SQL Community,</p>
<p>I&nbsp;have written a simplified &ldquo;Max. Server Memory&rdquo; calculator for calculating "Max. Server Memory" value for 64-bit SQL Server instances after seeing my <a href="http://blogs.msdn.com/b/sqlsakthi/archive/2011/03/12/importance-of-setting-max-server-memory-in-sql-server-and-how-to-set-it.aspx">blog</a>&nbsp;referenced in MSDN forums, blogs&nbsp;etc., to automate the calculation of Max. Server Memory.</p>
<p><span style="text-decoration: underline;"><strong>Few things to take care before you use this calculator:</strong></span></p>
<p><span style="background-color: #ccffcc; color: #000000;"><strong><span style="background-color: #ff0000;">IMPORTANT</span></strong>: This calculator is designed to help Novice SQL Database Administrators or someone who manages SQL Server but is really not an expert in SQL Server. So to put it simple, this calculator is meant for SQL Server professionals with Level 100 knowledge in SQL Server</span></p>
<p><span style="background-color: #ffcc99; color: #000000;">Based on my support experience, lot of performance &amp; memory related problems are because customer&rsquo;s don&rsquo;t set a Max. Server Memory and they don&rsquo;t do that because they don&rsquo;t know what to set. This is my personal interest to help those people who are in need but confused because there are so many recommendations around how to calculate &amp; set this value.</span></p>
<p>Lot of other things like software based replication, HBA card, Fusion IO card, Antivirus Real-time scanning, Firewall monitoring the traffic flow through ports etc., need good amount memory which is not accounted here simply because we don't see these in all the Environments. If you use anything other than the features given in the calculator here, please make sure you adjust the Max. Server Memory accordingly!!!</p>
<p>So important thing is, take the Max. Server Memory value recommended here as a reference value and then manipulate the value according to your custom environment and then configure Max. Server Memory in SQL Server accordingly. This is not all, please refer to following instructions on&nbsp;how to monitor&nbsp;memory usage of SQL Server &amp;&nbsp;OS and make sure you monitor the performance of the server during peak load&nbsp;to see whether the value is right or needs a change so that you don't hurt&nbsp; the performance of other applications &amp; Operating System!!!</p>
<p>This calculator will not help on server having more than 1 instance of SQL Server because the memory required for&nbsp;OS, SSIS, Antivirus etc., are shared so&nbsp;the calculation becomes little complex.</p>
<p>Max. Server Memory value shown here is <span style="text-decoration: underline;"><strong>not to be assumed as an official Microsoft recommendation</strong></span></p>
<p>This calculator is applicable only for 64-bit SQL Server</p>
<p>Things have changed for SQL Server 2012 so this calculator is applicable only for SQL Server 2005, 2008, 2008 R2</p>
<p>If you think you know how to arrive at this value better than what is shown in the calculator, you can share the&nbsp;feedback in the comments section or&nbsp;skip the recommendations because you are not the right audience to use this calculator.</p>
<p>Max Worker thread calculation used to arrive at memory requirement for worker threads is based on Books On Line - <a href="http://bit.ly/KflAa8">http://bit.ly/KflAa8</a></p>
<p>&nbsp;You can monitor the health of SQL Server Memory using these Performance monitor counters:</p>
<p><strong>Page Life Expectancy</strong> Counter under SQL Server Buffer Manager which is the average number of seconds a page stays in cache. It should be atleast = 300 * (Total RAM in GB)/4. Though our recommendation earlier was PLE should be 300, if a page is staying just for 5 minutes on a server with 128 GB RAM then it&nbsp;is not a right value to say that there is no memory pressure.<br /><strong>Memory Grants Pending</strong>, in the Perfmon object SQL Server Memory Manager (Close to 0 or lower is better) (OR)<br /><strong>Memory grant queue waits</strong> in the Perfmon object SQL Server Wait Statistics Object (Close to 0 or lower is better)</p>
<p>To Monitor the health of memory available for other processes &amp; OS:</p>
<p><strong>Available MBytes</strong> under Perfmon object Memory - Refer <a href="http://blogs.msdn.com/b/slavao/archive/2006/11/13/q-a-does-sql-server-always-respond-to-memory-pressure.aspx">http://blogs.msdn.com/b/slavao/archive/2006/11/13/q-a-does-sql-server-always-respond-to-memory-pressure.aspx</a> for some reference values</p>
<p>More information on troubleshooting memory bottleneck is available at <a href="http://technet.microsoft.com/en-us/library/cc966401.aspx">http://technet.microsoft.com/en-us/library/cc966401.aspx</a></p>
<p>Max server memory setting only controls size of the Buffer Pool and hence doesn't affect allocations going through Multi Page Allocator (MPA). You can monitor your &nbsp;Multi Page Allocator usage by using sys.dm_os_memory_clerks DMV and adjust the Max. Server Memory accordingly.</p>
<p>So here we go</p>
<p><strong><span style="background-color: #ffff00;">Calculator</span></strong>: <a href="http://blogs.msdn.com/b/sqlsakthi/p/max-server-memory-calculator.aspx">http://blogs.msdn.com/b/sqlsakthi/p/max-server-memory-calculator.aspx</a></p>
<p><span style="background-color: #ffff99;"><strong><span style="background-color: #ffff00;">UPDATE</span></strong>: Per feedbacks from MVP's over twitter and blogs, modified the calculator to give more meaningful value for memory required by Operating System since we see more systems with high Physical memory loaded. </span></p>
<p><span style="background-color: #ffff99;">Formula used to calculate memory required for OS: 2GB + 12% of physical memory. (Thinking of how or why this value? It is 2 GB base and 7% for kernel pool (paged pool, NPP and PFN database) and 5% for cache.)</span></p>
<p>Technology used: <a title="Office Web Apps" href="http://office.microsoft.com/en-us/web-apps/" target="_blank">Office Web Apps</a>&nbsp;(Try it for free)&nbsp;&amp; MSDN Static Pages.</p>
<p>You can download the Excel to view the formula used to arrive at the Max. Server Memory value.</p>
<p><span style="text-decoration: underline;"><strong>Note:</strong></span></p>
<p>Number of processors visible to SQL Server may not be equal to number of processors available in the server. Thinking why? these links will help:</p>
<p><a href="http://blogs.msdn.com/b/psssql/archive/2012/01/23/assigning-sql-server-sql-agent-to-a-processor-group-oom-hang-performance-counters-always-zero-for-buffer-pool.aspx">http://blogs.msdn.com/b/psssql/archive/2012/01/23/assigning-sql-server-sql-agent-to-a-processor-group-oom-hang-performance-counters-always-zero-for-buffer-pool.aspx</a></p>
<p><a href="http://blogs.msdn.com/b/psssql/archive/2009/06/16/sql-server-on-windows-7-windows-2008-r2-with-more-than-64-cpus.aspx">http://blogs.msdn.com/b/psssql/archive/2009/06/16/sql-server-on-windows-7-windows-2008-r2-with-more-than-64-cpus.aspx</a></p>
<p>Post your feedback and comments in this blog post!</p>
<p>You may also try MAXDOP calculator available at <a href="http://blogs.msdn.com/b/sqlsakthi/archive/2012/05/24/wow-we-have-maxdop-calculator-for-sql-server-it-makes-my-job-easier.aspx">http://blogs.msdn.com/b/sqlsakthi/archive/2012/05/24/wow-we-have-maxdop-calculator-for-sql-server-it-makes-my-job-easier.aspx</a></p>
<p><em><strong>Sakthivel Chidambaram, Microsoft</strong></em></p>]]></content:encoded>
    </item>
    <item>
      <title>SQL Server 2012 Upgrade Technical Guide &amp; What's new Whitepaper Released</title>
      <link>https://docs.microsoft.com/archive/blogs/sqlsakthi/sql-server-2012-upgrade-technical-guide-whats-new-whitepaper-released</link>
      <pubDate>Tue, 15 May 2012 20:58:00 GMT</pubDate>
      <dc:creator><![CDATA[Sakthivel Chidambaram]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/sqlsakthi/2012/05/15/sql-server-2012-upgrade-technical-guide-whats-new-whitepaper-released/</guid>
      <description><![CDATA[SQL Server team has&nbsp;published the "SQL Server 2012 Upgrade Technical Guide" at...]]></description>
      <content:encoded><![CDATA[<p>SQL Server team has&nbsp;published the "SQL Server 2012 Upgrade Technical Guide" at <a href="http://download.microsoft.com/download/9/5/3/9533501A-6F3E-4D03-A6A3-359AF6A79877/SQL_Server_2012_Upgrade_Technical_Reference_Guide_White_Paper.pdf">http://download.microsoft.com/download/9/5/3/9533501A-6F3E-4D03-A6A3-359AF6A79877/SQL_Server_2012_Upgrade_Technical_Reference_Guide_White_Paper.pdf</a></p>
<p>I&nbsp;encourage you to upgrade to SQL Server 2012 using this guide (HOW TO UPGRADE), What&rsquo;s New whitepaper (WHY UPGRADE) downloadable from <a href="http://download.microsoft.com/download/E/9/D/E9DBB1BB-89AE-4C70-AF02-AAFC29451A85/SQL_Server_2012_Whats_New_White_Paper.pdf">http://download.microsoft.com/download/E/9/D/E9DBB1BB-89AE-4C70-AF02-AAFC29451A85/SQL_Server_2012_Whats_New_White_Paper.pdf</a> and other resources in the web site <a href="http://www.microsoft.com/sqlserver/en/us/product-info/why-sql-server.aspx">http://www.microsoft.com/sqlserver/en/us/product-info/why-sql-server.aspx</a></p>
<p>&nbsp;</p>]]></content:encoded>
    </item>
    <item>
      <title>INF:What happens to a database when transaction rollback fails?</title>
      <link>https://docs.microsoft.com/archive/blogs/sqlsakthi/infwhat-happens-to-a-database-when-transaction-rollback-fails</link>
      <pubDate>Tue, 08 May 2012 00:51:16 GMT</pubDate>
      <dc:creator><![CDATA[Sakthivel Chidambaram]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/sqlsakthi/2012/05/08/infwhat-happens-to-a-database-when-transaction-rollback-fails/</guid>
      <description><![CDATA[Today while working on a SQL Server performance case, I was asked this question "What happens to a...]]></description>
      <content:encoded><![CDATA[<p>Today while working on a SQL Server performance case, I was asked this question "What happens to a database when transaction rollback fails?". I thought of sharing the answer to the community so that it can help DBA's to understand how SQL Server handles this scenario.</p>
<p>So what happens when a transaction rollback fails? <strong>Database will shutdown automatically and restart itself to perform the Recovery.</strong></p>
<p>Here is a sequence copied from SQL Server errorlog to explain what happens<u1:p></u1:p></p>
<p><span style="font-family: courier new,courier;">Error: 802, Severity: 17, State: 20.</span><br /><span style="font-family: courier new,courier;">There is insufficient memory available in the buffer pool.</span></p>
<p><span style="font-family: courier new,courier;">Error: 3314, Severity: 21, State: 4.</span><br /><span style="font-family: courier new,courier;">During undoing of a logged operation in database 'SAKTHIDB', an error occurred at log record ID (494194:2565:21). Typically, the specific failure is logged previously as an error in the Windows Event Log service. Restore the database or file from a backup, or repair the database.</span><br /><span style="font-family: courier new,courier;"></span></p>
<p><span style="font-family: courier new,courier;">Database SAKTHIDB was shut down due to error 802 in routine 'XdesRMReadWrite::RollbackToLsn'. Restart for non-snapshot databases will be attempted after all connections to the database are aborted.</span><u1:p></u1:p></p>
<p><span style="font-family: courier new,courier;">Recovery of database 'SAKTHIDB' (5) is 0% complete (approximately 2968 seconds remain). Phase 1 of 3. This is an informational message only. No user action is required.</span></p>
<p><span style="font-family: courier new,courier;">Recovery of database 'SAKTHIDB' (5) is 98% complete (approximately 19 seconds remain). Phase 3 of 3. This is an informational message only. No user action is required.</span><u1:p></u1:p></p>
<p><span style="font-family: courier new,courier;">2 transactions rolled back in database 'SAKTHIDB' (5). This is an informational message only. No user action is required.</span><u1:p></u1:p></p>
<p><span style="font-family: courier new,courier;">Recovery completed for database SAKTHIDB (database ID 5) in 937 second(s) (analysis 15261 ms, redo 889025 ms, undo 31435 ms.) This is an informational message only. No user action is required.</span><u1:p></u1:p></p>
<p>The &ldquo;..<span style="font-family: courier new,courier;">Database SAKTHIDB was shut down due to error</span>...&rdquo; tells you what was the error that caused the database to shutdown in our case was due to error 802 (insufficient memory) and also tell the routine name which in our case is RollbacktoLSN. It also tells you that Restart of all non-snapshot databases will be attempted which happened in our case and eventually recovery completed.</p>
<p>There is also an error printed by the failed routine with error 3314 stating undoing of a logged operation failed. Refer <a href="http://msdn.microsoft.com/en-us/library/ff713991(v=sql.100).aspx">http://msdn.microsoft.com/en-us/library/ff713991(v=sql.100).aspx</a>&nbsp;for more information on 3314 errors.</p>
<p>Hope that Helps!</p>
<p>&nbsp;</p>
<p><em><strong>Sakthivel Chidambaram, SQL Server Support</strong></em></p>]]></content:encoded>
    </item>
    <item>
      <title>"Failed to save Local Policy Database" while granting any privilege to SQL Service SID in Group Policy Editor</title>
      <link>https://docs.microsoft.com/archive/blogs/sqlsakthi/failed-to-save-local-policy-database-while-granting-any-privilege-to-sql-service-sid-in-group-policy-editor</link>
      <pubDate>Sat, 05 May 2012 01:20:35 GMT</pubDate>
      <dc:creator><![CDATA[Sakthivel Chidambaram]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/sqlsakthi/2012/05/05/failed-to-save-local-policy-database-while-granting-any-privilege-to-sql-service-sid-in-group-policy-editor/</guid>
      <description><![CDATA[When you try to grant any privilege to SQL Server Service SID using Group Policy Editor in Windows...]]></description>
      <content:encoded><![CDATA[<p>When you try to grant any privilege to SQL Server Service SID using Group Policy Editor in Windows 2008, you might get this error:</p>
<p><a href="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/38/27/6038.err.png" original-url="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-38-27/6038.err.png"><img border="0" alt="" src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/38/27/6038.err.png" original-url="http://blogs.msdn.com/resized-image.ashx/__size/550x0/__key/communityserver-blogs-components-weblogfiles/00-00-01-38-27/6038.err.png" width="224" height="249" /></a></p>
<p><span style="font-family: courier new,courier; font-size: medium;">An extended error has occurred.</span><br /><span style="font-family: courier new,courier; font-size: medium;">Failed to save Local Policy Database.</span></p>
<p>This happens only when you try to add virtual accounts like</p>
<p><strong>NT SERVICE\MSSQLSERVER</strong></p>
<p><strong>NT SERVICE\SQLSERVERAGENT</strong></p>
<p>to grant certain privileges like <em>Act as part of the operating system</em>, <em>Increase quotas</em>, <em>replace process level token</em>, <em>Log on as a batch job</em> to the SQL Server Service SID and SQL Server Agent Service SID.</p>
<p>Granting privileges to Service SID was introduced in SQL Server 2008 since it was a pain in SQL Server 2005 when somebody accidentaly deleted the domain or local groups created by SQL Server to which all the permissions were granted. Read more about this here <a href="http://msdn.microsoft.com/en-us/library/cc280562.aspx">http://msdn.microsoft.com/en-us/library/cc280562.aspx</a></p>
<p>This error is a known issue w.r.t Group Policy Editor since it was not able to handle these virtual accounts. Fix for this issue is available through Windows hotfix <a href="http://support.microsoft.com/kb/2491998">http://support.microsoft.com/kb/2491998</a></p>
<p>Workaround is to use the ntrights utility available as part of Windows 2003 Resource Kit. You can use the Windows 2003 version of ntrights to do this in Windows 2008 or simply apply the hotfix to take care of granting privileges to the&nbsp;virtual accounts in the group policy editor.</p>
<p>Sample syntax to grant "Replace process level token" to SQL Server Service SID &amp; SQL Server Agent Service SID:</p>
<p><span style="font-family: courier new,courier;">ntrights +r SeAssignPrimaryTokenPrivilege -u "NT SERVICE\MSSQLSERVER"</span><br /><span style="font-family: courier new,courier;">ntrights +r SeAssignPrimaryTokenPrivilege -u "NT SERVICE\SQLSERVERAGENT"</span></p>
<p>Check the link <a href="http://msdn.microsoft.com/en-us/library/windows/desktop/bb530716(v=vs.85).aspx">http://msdn.microsoft.com/en-us/library/windows/desktop/bb530716(v=vs.85).aspx</a> for the complete list of privileges to Privilege Name mapping</p>]]></content:encoded>
    </item>
    <item>
      <title>"stop before startup" after "Using large pages for buffer pool" during SQL Server startup</title>
      <link>https://docs.microsoft.com/archive/blogs/sqlsakthi/stop-before-startup-after-using-large-pages-for-buffer-pool-during-sql-server-startup</link>
      <pubDate>Wed, 18 Apr 2012 23:50:00 GMT</pubDate>
      <dc:creator><![CDATA[Sakthivel Chidambaram]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/sqlsakthi/2012/04/18/stop-before-startup-after-using-large-pages-for-buffer-pool-during-sql-server-startup/</guid>
      <description><![CDATA[Worked on a SQL Server startup issue which I would like to share here:
Here is how the SQL Server...]]></description>
      <content:encoded><![CDATA[<p>Worked on a SQL Server startup issue which I would like to share here:</p>
<p>Here is how the SQL Server errorlog looked like</p>
<p><span style="font-family: courier new,courier;">2012-04-19 03:43:26.50 Server Microsoft SQL Server 2005 - 9.00.4035.00 (Intel IA-64) </span><br /><span style="font-family: courier new,courier;">Nov 24 2008 12:59:53 </span><br /><span style="font-family: courier new,courier;">Copyright (c) 1988-2005 Microsoft Corporation</span><br /><span style="font-family: courier new,courier;">Enterprise Edition (64-bit) on Windows NT 5.2 (Build 3790: Service Pack 2)</span><br /><span style="font-family: courier new,courier;">...</span><br /><span style="font-family: courier new,courier;">...</span><br /><span style="font-family: courier new,courier;">2012-04-19 03:43:26.52 Server Registry startup parameters:</span><br /><span style="font-family: courier new,courier;">2012-04-19 03:43:26.52 Server -d J:\Microsoft SQL Server\MSSQL.1\MSSQL\DATA\master.mdf</span><br /><span style="font-family: courier new,courier;">2012-04-19 03:43:26.52 Server -e J:\Microsoft SQL Server\MSSQL.1\MSSQL\LOG\ERRORLOG</span><br /><span style="font-family: courier new,courier;">2012-04-19 03:43:26.52 Server -l J:\Microsoft SQL Server\MSSQL.1\MSSQL\DATA\mastlog.ldf</span><br /><span style="font-family: courier new,courier;">...</span><br /><span style="font-family: courier new,courier;">...</span><br /><span style="font-family: courier new,courier;">2012-04-19 03:43:26.52 Server -T 834</span><br /><span style="font-family: courier new,courier;">...</span><br /><span style="font-family: courier new,courier;">...</span><br /><span style="font-family: courier new,courier;">2012-04-19 03:43:26.53 Server Large Page Extensions enabled.</span><br /><span style="font-family: courier new,courier;">2012-04-19 03:43:26.53 Server Large Page Granularity: 16777216 </span><br /><span style="font-family: courier new,courier;">2012-04-19 03:43:26.57 Server Large Page Allocated: 32MB </span><br /><span style="font-family: courier new,courier;">2012-04-19 03:43:26.59 Server Large Page Allocated: 32MB </span><br /><span style="font-family: courier new,courier;">2012-04-19 03:43:26.69 Server <span style="background-color: #ffff00;">Using large pages for buffer pool</span>.</span><br /><span style="font-family: courier new,courier;">2012-04-19 03:48:27.12 Server <span style="background-color: #ffff00;">Service control: stop before startup</span></span></p>
<p>So I checked with another server on what should be the next step in the SQL Server error log after "Using larges pages..." since that's where SQL Server seems to have failed and it is supposed to be</p>
<p><span style="font-family: courier new,courier;">"xxxxx MB of large page memory allocated"</span></p>
<p>So it seems like large page memory allocation failed. When we look at the startup parameters, we see trace flag 834 and this trace flag forces SQL Server to use large pages for Buffer pool memory allocations.</p>
<p>As per <a href="http://support.microsoft.com/kb/920093">http://support.microsoft.com/kb/920093:</a></p>
<p><em>"... Trace flag 834 may prevent the server from starting if memory is fragmented and if large pages cannot be allocated. Therefore, trace flag 834 is best suited for servers that are dedicated to SQL Server...."</em></p>
<p>So in our case there was already another SQL instance running on the same node blocking this instance in allocating Large pages for buffer pool so we gave options to Cx to decide removing 834 trace flag or add more memory.</p>
<p>This could also happen if the large page allocation is taking longer time causing timeout. Note that server we troubleshooted is on a clustered environment.</p>
<p>&nbsp;</p>
<p><em><strong>Sakthivel Chidambaram, SQL Server Support</strong></em></p>]]></content:encoded>
    </item>
    <item>
      <title>Restore database stuck at 90% waiting on PREEMPTIVE_OS_WRITEFILEGATHER</title>
      <link>https://docs.microsoft.com/archive/blogs/sqlsakthi/restore-database-stuck-at-90-waiting-on-preemptive_os_writefilegather</link>
      <pubDate>Wed, 11 Apr 2012 06:14:00 GMT</pubDate>
      <dc:creator><![CDATA[Sakthivel Chidambaram]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/sqlsakthi/2012/04/11/restore-database-stuck-at-90-waiting-on-preemptive_os_writefilegather/</guid>
      <description><![CDATA[There are already few blogs and a KB to talk about this problem so I'm trying to tie them together...]]></description>
      <content:encoded><![CDATA[<p>There are already few blogs and a KB to talk about this problem so I'm trying to tie them together to make sure you get this quickly</p>
<p>When you are restoring a database (in my case a database having 32 files), post 90% complete, all but one threads in sysprocesses went into SUSPENDED state waiting on BACKUPTHREAD.</p>
<p>One thread was in runnable state with a wait time of close to 6 hrs. and the wait type was PREEMPTIVE_OS_WRITEFILEGATHER</p>
<p>A quick search got me <a href="http://support.microsoft.com/kb/2091024">http://support.microsoft.com/kb/2091024</a> which explains the problem which in our case was a 380 GB LDF file and SQL Server was busy in zeroing out the file.</p>
<p>So all we have to do was to wait for it to complete</p>
<p>But how to prevent this situation or what can be done if you are in this situation?</p>
<p>1. Monitor the size of your LDF and %space used within the LDF using DBCC <span style="font-size: x-small;" size="2">SQLPERF</span><span style="color: #808080; font-size: x-small;" color="#808080" size="2"><span style="color: #808080; font-size: x-small;" color="#808080" size="2">(</span></span><span style="color: #ff0000; font-size: x-small;" color="#ff0000" size="2"><span style="color: #ff0000; font-size: x-small;" color="#ff0000" size="2">'logspace'</span></span><span style="color: #808080; font-size: x-small;" color="#808080" size="2"><span style="color: #808080; font-size: x-small;" color="#808080" size="2">)</span></span> to make sure you don't have a&nbsp;really big LDF file with just&nbsp;2% space used. You should remember that when you take a backup of this database which has say 300 GB LDF file with 10% used space, still SQL Server has to create a 300 GB LDF&nbsp;file during Restore and zero out 270 GB of disk space so this is going to take lot of time.</p>
<p>2. If you are already in this situation and if you still have access to the source database which you took backup, try shrinking the LDF and take the backup again to perform the restore. This should be a quick process rather than waiting for zeroing to complete</p>
<p>3. Stop any activity (if possible) to free-up the target disk's header so that it can dedicatedly work on zeroing out the LDF file</p>
<p>FYI: This Instant File Initialization is not applicable to LDF which means SQL Server has to zero out the disk when LDF file is expanded to new offset. But you can prevent zeroing out in MDF file but granting "Perform Volume Maintenance Task" privilege to SQL Server service account. Reference: <a href="http://msdn.microsoft.com/en-us/library/ms175935.aspx">http://msdn.microsoft.com/en-us/library/ms175935.aspx</a></p>
<p><span style="text-decoration: underline;"><strong>More info:</strong></span></p>
<p>To see which files are being zeroed out, you can use the undocumented trace flag <a href="http://blogs.msdn.com/psssql/archive/2008/01/23/how-it-works-what-is-restore-backup-doing.aspx">3004</a> and the undocumented xp_readerrorlog. Undocumented means it is unsupported and may change or be removed with no notice at any time. Trace flag 3004 shows information about backups and file creations. Trace flag 3605 redirects the output to the SQL error log.</p>
<p><span style="color: #ff0000;">WARNING: These trace flags should be used under the guidance of Microsoft SQL Server support. They are used in this post for discussion purposes only and may not be supported in future versions.</span></p>
<p>DBCC TRACEON(3004,3605,-1)</p>
<p>GO</p>]]></content:encoded>
    </item>
    <item>
      <title>Re-configure Replication after restoring publication database from Backup - Replication Scenario</title>
      <link>https://docs.microsoft.com/archive/blogs/sqlsakthi/re-configure-replication-after-restoring-publication-database-from-backup-replication-scenario</link>
      <pubDate>Wed, 14 Mar 2012 03:28:00 GMT</pubDate>
      <dc:creator><![CDATA[Sakthivel Chidambaram]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/sqlsakthi/2012/03/14/re-configure-replication-after-restoring-publication-database-from-backup-replication-scenario/</guid>
      <description><![CDATA[Sharing one of the interesting scenario I worked today.
Somebody messed up the data at publication...]]></description>
      <content:encoded><![CDATA[<p>Sharing one of the interesting scenario I worked today.</p>
<p>Somebody messed up the data at publication database (few rows updated with a value which they aren't supposed to) and publication database was restored from&nbsp;a older backup to rollback the change. Now when log reader agent was started it starting failing with an error:</p>
<p><span style="font-family: courier new,courier; font-size: small;">2012-03-14 01:08:14.360 Publisher: {call sp_repldone ( 0x00159ebb000031250001, 0x00159ebb000031250001, 0, 0)}</span><br /><span style="font-family: courier new,courier; font-size: small;">2012-03-14 01:08:14.376 Status: 0, code: 20011, text: 'The process could not execute 'sp_repldone/sp_replcounters' on 'SQLPROD'.'.</span><br /><span style="font-family: courier new,courier; font-size: small;">2012-03-14 01:08:14.423 The process could not execute 'sp_repldone/sp_replcounters' on 'SQLPROD'.</span><br /><span style="font-family: courier new,courier; font-size: small;">2012-03-14 01:08:14.470 Repl Agent Status: 6</span><br /><span style="font-family: courier new,courier; font-size: small;">2012-03-14 01:08:14.517 Status: 0, code: 9003, text: 'The log scan number (1416891:12581:1) passed to log scan in database 'DBNAME' is not valid. This error may indicate data corruption or that the log file (.ldf) does not match the data file (.mdf). If this error occurred during replication, re-create the publication. Otherwise, restore from backup if the problem results in a failure during startup. '.</span><br /><span style="font-family: courier new,courier; font-size: small;">2012-03-14 01:08:14.579 Status: 0, code: 22017, text: 'The process could not set the last distributed transaction.'.</span><br /><span style="font-family: courier new,courier; font-size: small;">2012-03-14 01:08:14.610 Status: 0, code: 22037, text: 'The process could not execute 'sp_repldone/sp_replcounters' on 'SQLPROD'.'.</span></p>
<p>-- DBCC OPENTRAN in the publication database shows:</p>
<p>Replicated Transaction Information:<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Oldest distributed LSN&nbsp;&nbsp;&nbsp;&nbsp; : (1416699:339145:57)<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Oldest non-distributed LSN : (1416699:341745:3)</p>
<p>-- So distribution database has more information about the publication database than what publication database has now because it was restored from a older backup.&nbsp;To be precise:<br />Publication database says it has sent this LSN&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; --&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 1416699:339145:57 (Oldest distributed LSN)<br />Publication database says it has to start sending from this LSN&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; --&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 141<span style="background-color: #ffff00;">6699</span>:341745:3 (Oldest non-distributed LSN)</p>
<p>But Log reader agent says I have to start from here&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;--&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 141<span style="background-color: #ffff00;">6891</span>:12581:1 (High value comapred to what publication database says)</p>
<p>So how do you handle this situation? Well here is the guide:</p>
<p><span style="text-decoration: underline;"><strong>Option 1:</strong></span></p>
<p>The Log Reader Agent can be recovered by using the <a title="sp_replrestart" href="http://msdn.microsoft.com/en-us/library/ms174390.aspx" target="_blank">sp_replrestart</a> stored procedure, which re-synchronizes the metadata between the Publisher and the Distributor. This can result in Subscribers potentially having more data than the Publisher. In the event that these changes are made to the publication database again and subsequently replicated, the Distribution Agent will fail with data consistency errors. To override these errors use the Distribution Agent profile &ldquo;Continue on data consistency errors.&rdquo;<br />Note:&nbsp; Care should be taken when overriding these errors. For more information, see <a title="Skipping Errors in Transactional Replication" href="http://technet.microsoft.com/en-us/library/ms151331.aspx" target="_blank">Skipping Errors in Transactional Replication</a> in SQL Server Books Online.</p>
<p>How if works? sp_replrestart will fill&nbsp;NO-OP (No-Operation) transaction which will cause the LSN's to increase until the log LSN matches the LSN as per Distribution database. So from there-on, Logreader agent will&nbsp;be able to read the&nbsp;LSN, it is expecting.</p>
<p>Note: Depending on how old the&nbsp;backup of the Published database which was restored, it may take hours for this operation and may make the transaction log to grow big.<br />and grow by gigs, until they match.</p>
<p><span style="background-color: #ff0000;"><strong>Caution:</strong>&nbsp;</span> This option (Option 1) can lead to inconsistencies between data at the Publisher and data at the Subscribers!!!</p>
<p><span style="text-decoration: underline;"><strong>Option 2:</strong></span><br />--&gt; Stop all applications accessing the publication database.</p>
<p>--&gt; Run the Distribution Agent until all Subscribers are synchronized with the outstanding commands in the distribution database. Verify that all commands are delivered to Subscribers by using the Undistributed Commands tab in Replication Monitor or by querying the MSdistribution_status view in the distribution database.</p>
<p>--&gt; Use the tablediff Utility or another tool to manually synchronize the Publisher with the Subscriber, which allows you to recover data from the subscription database that was not contained in the publication database backup.</p>
<p>--&gt; Drop the subscription(s).</p>
<p>--&gt; At the Publisher on the publication database, execute sp_addsubscription. Specify the name of the database at the Subscriber containing the published data for @destination_db, a value of push for @subscription_type, and a value of 'replication support only' for @sync_type.</p>
<p>--&gt; At the Publisher on the publication database, execute sp_addpushsubscription_agent or sp_addpullsubscription_agent and start the distribution agent.</p>
<p>--&gt; Now you can allow changes to the publication database.</p>
<p>&nbsp;How it works? 'replication support only' in the @sync_type&nbsp;says that we already have data and schema at the subscriber and we are asking replication to just create stored procedures and other replication objects and start synchoronization.</p>
<p><span style="text-decoration: underline;"><strong>Option 3:</strong></span> (<span style="background-color: #00ff00;">Recommended</span>)</p>
<p>Script the Publication -&gt; Drop Subscriptions -&gt; Drop Publication -&gt; Re-create them</p>
<p>You can use "Sync with Backup" to avoid these scenarios but at the expense of high log reader latency depending on the frequency of the log backup at the publication database. Read more about "sync with backup" option from <a href="http://msdn.microsoft.com/en-us/library/ms152560.aspx">http://msdn.microsoft.com/en-us/library/ms152560.aspx</a></p>
<p>&nbsp;</p>
<p>Please comment if you tried this and whether it helped you or you faced some issues.!</p>
<p>&nbsp;</p>
<p><em><strong>Sakthivel Chidambaram,</strong></em></p>
<p><em><strong>SQL Server Support, Microsoft</strong></em></p>]]></content:encoded>
    </item>
  </channel>
</rss>