<?xml version="1.0" encoding="utf-8"?>
<rss xmlns:atom="https://www.w3.org/2005/Atom" xmlns:sy="https://purl.org/rss/1.0/modules/syndication/" xmlns:dc="https://purl.org/dc/elements/1.1/" xmlns:content="https://purl.org/rss/1.0/modules/content/" xmlns:wfw="https://wellformedweb.org/CommentAPI/" xmlns:slash="https://purl.org/rss/1.0/modules/slash/"
  version="2.0">
  <channel>
    <title>Vikas Rana</title>
    <atom:link
      href="https://docs.microsoft.com/archive/blogs/vikas_rana/feed.xml"
      rel="self"
      type="application/rss+xml" />
    <link>https://docs.microsoft.com/archive/blogs/vikas_rana/feed.xml</link>
    <description />
    <lastBuildDate>Wed, 17 Apr 2019 03:13:05 GMT</lastBuildDate>
    <language>en-US</language>
    <sy:updatePeriod>hourly</sy:updatePeriod>
    <sy:updateFrequency>1</sy:updateFrequency>
    <item>
      <title>Query Store Entering Error State</title>
      <link>https://docs.microsoft.com/archive/blogs/vikas_rana/query-store-entering-error-state</link>
      <pubDate>Wed, 27 Jun 2018 14:22:03 GMT</pubDate>
      <dc:creator><![CDATA[Vikas Rana]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/vikas_rana/?p=315</guid>
      <description><![CDATA[Extremely rarely Query Store can end up in ERROR state because of internal errors or due to race...]]></description>
      <content:encoded><![CDATA[Extremely rarely Query Store can end up in ERROR state because of internal errors or due to race condition when failover/restart happens while QDS cleanup running.

Query Store can be recovered by executing <strong>sp_query_store_consistency_check</strong> stored procedure within the affected database.

Please remember if QDS in ERROR state in that case it may affect Automatic plan correction feature and may cause performance issue if you are using plan correction feature extensively.

For CRITICAL environment it’s very important to automatically detect this situation and mitigate immediately. You can consider creating a scheduled job to check the QDS status and take appropriate action based on actual state.

Here is the sample code we have created which you can test\customize based on your environment\requirement. As always please test following code in TEST\UAT environment before deploying on production.

If you would like to improve following T-SQL code then please update here:

<a href="https://github.com/vikasrana2006/Query-Store-Entering-Error-State/blob/master/QDS_ERROR_STATE_CORRECTION.sql">https://github.com/vikasrana2006/Query-Store-Entering-Error-State/blob/master/QDS_ERROR_STATE_CORRECTION.sql</a>

&nbsp;
<table width="652">
<tbody>
<tr>
<td width="584">
<h6><span style="color: #0000ff">IF EXISTS (SELECT * FROM sys.database_query_store_options WHERE actual_state=3)</span></h6>
<h6></h6>
<h6><span style="color: #0000ff">BEGIN</span></h6>
<h6></h6>
<h6><span style="color: #0000ff">BEGIN TRY</span></h6>
<h6></h6>
<h6><span style="color: #0000ff">ALTER DATABASE [QDS] SET QUERY_STORE = OFF</span></h6>
<h6><span style="color: #0000ff">Exec [QDS].dbo.<strong>sp_query_store_consistency_check</strong></span></h6>
<h6><span style="color: #0000ff">ALTER DATABASE [QDS] SET QUERY_STORE = ON</span></h6>
<h6><span style="color: #0000ff">ALTER DATABASE [QDS] SET QUERY_STORE (OPERATION_MODE = READ_WRITE)</span></h6>
<h6></h6>
<h6><span style="color: #0000ff">END TRY</span></h6>
<h6></h6>
<h6><span style="color: #0000ff">BEGIN CATCH</span></h6>
<h6></h6>
<h6><span style="color: #0000ff">SELECT </span></h6>
<h6><span style="color: #0000ff">    ERROR_NUMBER() AS ErrorNumber </span></h6>
<h6><span style="color: #0000ff">    ,ERROR_SEVERITY() AS ErrorSeverity </span></h6>
<h6><span style="color: #0000ff">    ,ERROR_STATE() AS ErrorState </span></h6>
<h6><span style="color: #0000ff">    ,ERROR_PROCEDURE() AS ErrorProcedure </span></h6>
<h6><span style="color: #0000ff">    ,ERROR_LINE() AS ErrorLine </span></h6>
<h6><span style="color: #0000ff">    ,ERROR_MESSAGE() AS ErrorMessage;</span></h6>
<h6></h6>
<h6><span style="color: #0000ff">END CATCH;  </span></h6>
<h6></h6>
<h6><span style="color: #0000ff">END</span></h6>
&nbsp;

&nbsp;

<span>Vikas Rana | </span><a href="https://twitter.com/vikasrana_dba">Twitter</a><span> | </span><a href="https://www.linkedin.com/in/vikasrana2006/">Linkedin</a><span> | Escalation Engineer</span>
<span>Microsoft IGTSC</span></td>
</tr>
</tbody>
</table>
&nbsp;]]></content:encoded>
    </item>
    <item>
      <title>Query Store Best Practices for Mission Critical or Busy SQL Server</title>
      <link>https://docs.microsoft.com/archive/blogs/vikas_rana/query-store-best-practices-for-mission-critical-or-busy-sql-server</link>
      <pubDate>Fri, 20 Oct 2017 16:18:19 GMT</pubDate>
      <dc:creator><![CDATA[Vikas Rana]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/vikas_rana/?p=305</guid>
      <description><![CDATA[Query Store feature helping lot of SQL Admin in isolating top resource consuming queries quickly...]]></description>
      <content:encoded><![CDATA[<strong></strong>

Query Store feature helping lot of SQL Admin in isolating top resource consuming queries quickly and also troubleshooting plan choice regressed scenario which is difficult to isolate or time consuming process. Now with powerful report and using few clicks you can check top resource consuming query and force optimum plan. In this article I would like to highlight some of best practices if you are enabling Query Store on mission critical and high transactions Server

So as you already know that Query Store have following <strong>capture Mode </strong>for data collection:

<strong>All</strong> – Captures all queries. <strong><u>This is the default option</u></strong>.

<strong>Auto</strong> – Infrequent queries and queries with insignificant compile and execution duration are ignored. Thresholds for execution count, compile and runtime duration are internally determined.

<strong>None</strong> – Query Store stops capturing new queries.

&nbsp;

QDS store runtime stats in cache until they are persisted on disk asynchronously, you could track memory usage using memory clerk USERSTORE_QDSSTMT &amp; CACHESTORE_QDSRUNTIMESTATS. So write operation from cache to disk is very fast and you may not see large memory allocation against these memory clerks however workload with a lot of frequent ad hoc/unparameterized queries would make cache to grow.

If are running QDS with capture mode “<strong>ALL</strong>” on busy Server or mission CRITICAL Server then consider following best practices to save cache memory and reduce database recovery time:
<ol>
 	<li>Considering switching capture mode to “<span style="color: #ff0000"><strong>Auto</strong></span>” if you are not troubleshooting any ongoing issue for which you needs to capture all queries stats.</li>
 	<li>If your workload contain lot of <span style="color: #ff0000"><strong>ad-hoc batch</strong></span> then considering using “<strong>auto</strong>” capture mode as capturing detail for ad-hoc workload will not provide much benefit.</li>
 	<li>Enable Trace Flag 7745 which <span style="text-decoration: underline">Forces Query Store to not flush data to disk on database shutdown</span>. <strong>Note:</strong> Using this trace may cause Query Store data not previously <span style="color: #ff0000"><strong>flushed to disk to be lost in case of shutdown</strong></span>. For a SQL Server shutdown, the command SHUTDOWN WITH NOWAIT can be used instead of this trace flag to force an immediate shutdown.</li>
 	<li>Enable Trace Flag 7752 to <span style="text-decoration: underline">Enables asynchronous load of Query Store</span>. <strong>Note:</strong> Use this trace flag if SQL Server is experiencing high number of <strong>QDS_LOADDB waits</strong> related to Query Store synchronous load (default behavior).</li>
</ol>
<strong><u>References</u></strong>

<strong>Best Practice with the Query Store</strong>

<a href="https://docs.microsoft.com/en-us/sql/relational-databases/performance/best-practice-with-the-query-store">https://docs.microsoft.com/en-us/sql/relational-databases/performance/best-practice-with-the-query-store</a>

<strong>Query Store Usage Scenarios</strong>

<a href="https://docs.microsoft.com/en-us/sql/relational-databases/performance/query-store-usage-scenarios">https://docs.microsoft.com/en-us/sql/relational-databases/performance/query-store-usage-scenarios</a>

https://docs.microsoft.com/en-us/sql/t-sql/database-console-commands/dbcc-traceon-trace-flags-transact-sql

&nbsp;

<span>Vikas Rana | </span><a href="https://twitter.com/vikasrana_dba">Twitter</a><span> | </span><a href="https://www.linkedin.com/in/vikasrana2006/">Linkedin</a><span> | Support Escalation Engineer</span>
<span>Microsoft India GTSC</span>]]></content:encoded>
    </item>
    <item>
      <title>Query Data Store Forced Plan behavior on AlwaysOn Readable Secondary</title>
      <link>https://docs.microsoft.com/archive/blogs/vikas_rana/query-data-store-forced-plan-behavior-on-alwayson-readable-secondary</link>
      <pubDate>Fri, 13 Oct 2017 19:10:08 GMT</pubDate>
      <dc:creator><![CDATA[Vikas Rana]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/vikas_rana/?p=275</guid>
      <description><![CDATA[&nbsp;

We are getting following questions repeatedly from many customers so thought of writing a...]]></description>
      <content:encoded><![CDATA[&nbsp;

We are getting following questions repeatedly from many customers so thought of writing a quick blog to explain the behavior.

<strong>Question: </strong>For example if you have Query Data Store (QDS) enabled for user database participating in Always On Availability Groups and you <strong>Forced Plan</strong> for specific query, what happened if same query running on <strong>readable secondary</strong> will it use <strong>Forced Plan</strong>?

<strong>Answer:</strong> QDS is not supported on Readable Secondary, so though you have Forced Plan on Primary Replica you “<strong>may”</strong> see different plan on secondary database because QDS do not force same plan on readable secondary.

Please note, SQL do not create <strong>Plan Guide</strong> to Force Execution Plan in QDS.

QDS needs to store runtime stats in databases which is not possible when database in readable state.

I am sharing diagram from following article for your reference: <a href="https://docs.microsoft.com/en-us/sql/relational-databases/performance/how-query-store-collects-data">https://docs.microsoft.com/en-us/sql/relational-databases/performance/how-query-store-collects-data</a>

<a href="https://msdnshared.blob.core.windows.net/media/2017/10/Query_Store_Stats.jpg"><img src="https://msdnshared.blob.core.windows.net/media/2017/10/Query_Store_Stats.jpg" alt="" width="995" height="403" class="alignnone size-full wp-image-295" /></a>

&nbsp;

<strong>Question:</strong> <strong>Will QDS retain FORCED Plan information when Database failover from Primary replica to secondary Replica?</strong>

<strong>Answer: </strong>Yes, QDS store <strong>Forced Plan </strong>information in <strong>sys.query_store_plan</strong> table, so in case of failover you will continue to see same behavior on new Primary.

select * from sys.query_store_plan where is_forced_plan=1

<strong>Question: How QDS Force Query Plan? Is it creating Plan Guide to Force Plan?</strong>

<strong>Answer: </strong>As I mentioned earlier QDS do not use plan guide, instead of it use “<strong>USE PLAN</strong>” query hint which takes an <strong>xml_plan</strong> as an argument, so QDS basically pull this XML plan information from <strong>query_plan</strong> column from <strong>sys.query_store_plan</strong> table.

<strong>You can refer following diagram to know how SQL SERVER force Plan.</strong>

&nbsp;

<a href="https://msdnshared.blob.core.windows.net/media/2017/10/Query_Store_Execution.jpg"><img src="https://msdnshared.blob.core.windows.net/media/2017/10/Query_Store_Execution.jpg" alt="" width="853" height="545" class="alignnone size-full wp-image-285" /></a>

&nbsp;

&nbsp;

Vikas Rana | <a href="https://twitter.com/vikasrana_dba">Twitter</a> | <a href="https://www.linkedin.com/in/vikasrana2006/">Linkedin</a> | Support Escalation Engineer
Microsoft India GTSC]]></content:encoded>
    </item>
    <item>
      <title>Log Reader Agent Fail on Always On availability Groups configured on Multi-subnet</title>
      <link>https://docs.microsoft.com/archive/blogs/vikas_rana/log-reader-agent-fail-on-always-on-availability-groups-configured-on-multi-subnet</link>
      <pubDate>Wed, 09 Aug 2017 16:48:27 GMT</pubDate>
      <dc:creator><![CDATA[Vikas Rana]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/vikas_rana/?p=187</guid>
      <description><![CDATA[Recently I was working with one of Microsoft Partner on following issue wherein customer was...]]></description>
      <content:encoded><![CDATA[Recently I was working with one of Microsoft Partner on following issue wherein customer was migrating to SQL SERVER 2016 and during testing they have found Log Reader Agent was failing. I would like to share my learning from this issue and let me know if it is helpful or if you have any question.

<span style="color: #0000ff"><strong>Consider following scenario:</strong></span>
<ul>
 	<li>You have Always On availability Groups configured on Multi-subnet.</li>
 	<li>You have AlwaysOn Listener configured and running with RegisterAllProvidersIP 1 to support Modern application which use MultiSubnetFailover in connection string.</li>
 	<li>You have Transactional replication configured with remote distributor.</li>
 	<li>You have <a href="https://docs.microsoft.com/en-us/sql/database-engine/availability-groups/windows/configure-replication-for-always-on-availability-groups-sql-server">redirected</a> Original Publisher to the AG Listener Name using “sp_redirect_publisher” stored procedure</li>
</ul>
In this scenario Log Reader Agent may fail and log following error message:

<span style="color: #0000ff"><strong>Error messages:</strong></span>

<span style="color: #ff0000">Unable to query the redirected server 'SQLAGLS' for original publisher 'SQLPUB' and publisher database 'PUBDB' to determine the name of the remote server; Error 7303, Error message 'Error 7303, Level 16, State 1, Message: Cannot initialize the data source object of <strong>OLE DB provider</strong> "SQLNCLI11" for linked server "[xxxx]".'. (Source: MSSQL_REPL, Error number: MSSQL_REPL21879) Get help: <a href="https://help/MSSQL_REPL21879">https://help/MSSQL_REPL21879</a></span>

<span style="color: #ff0000">Errors were logged when validating the redirected publisher. (Source: MSSQL_REPL, Error number: MSSQL_REPL22037) Get help: <a href="https://help/MSSQL_REPL22037">https://help/MSSQL_REPL22037</a></span>

&nbsp;

So in this scenario Log Reader Agent failing because replication use <strong>OLE DB provider</strong> to connect to Publisher Server which does not support <strong>MultiSubnetFailover</strong> yet. So when RegisterAllProvidersIP set to 1 for Listener resource in that case it register all dependent IP in DNS. So when OLEDB provider query SQLAGLS then DNS may return IP which is not online hence Log Reader Agent may fail.

I would recommend reading following blog to understand more about RegisterAllProvidersIP &amp; HostRecordTTL parameters and it’s impact on connection in multi-subnet scenario:

<a href="https://blogs.msdn.microsoft.com/alwaysonpro/2014/06/03/connection-timeouts-in-multi-subnet-availability-group/">https://blogs.msdn.microsoft.com/alwaysonpro/2014/06/03/connection-timeouts-in-multi-subnet-availability-group/</a>

<span style="color: #0000ff"><strong><u>Solution</u></strong></span>

So in this current scenario if we set <strong>RegisterAllProvidersIP to 0</strong> which mean return only active IP in that case Log Reader Agent will work fine however during AG failover it will cause connectivity issue because client operating systems will not resolve the AG Listener name to the new IP address until the currently cached entry expires and modern app will not be able to take advantage of  <strong>MultiSubnetFailover. </strong>If we reduce HostRecordTTL value to some lower number then this will increase the traffic on DNS.

<span style="color: #0000ff"><strong>So what is our best option?</strong></span>

Considering this scenario instead of using existing AG Listener we can create a dedicated new Listener for replication and set following parameters:

<strong>Get-ClusterResource SQLAGLSREPL| Set-ClusterParameter HostRecordTTL 120</strong>

<strong>Get-ClusterResource SQLAGLSREPL |Set-ClusterParameter RegisterAllProvidersIP 0</strong>

So RegisterAllProvidersIP 0 will ensure AG Listener return only active IP and HostRecordTTL 120 will restore connectivity quickly (120 seconds or less) in case of AG failover to different subnet.

Considering you are using this listener only for Replication hence setting HostRecordTTL to lower number will not cause large amount of traffic to DNS.

&nbsp;

<span style="color: #454545;text-indent: 0px;letter-spacing: normal;font-family: WOL_Reg, 'Segoe UI', Tahoma, Arial, sans-serif;font-size: 14px;font-style: normal;font-weight: normal;float: none;background-color: #ffffff">Vikas Rana | </span><a href="https://twitter.com/vikasrana_dba">Twitter</a><span style="color: #454545;text-indent: 0px;letter-spacing: normal;font-family: WOL_Reg, 'Segoe UI', Tahoma, Arial, sans-serif;font-size: 14px;font-style: normal;font-weight: normal;float: none;background-color: #ffffff"> |<span> </span></span><a href="https://www.linkedin.com/in/vikasrana2006/">Linkedin</a><span style="color: #454545;text-indent: 0px;letter-spacing: normal;font-family: WOL_Reg, 'Segoe UI', Tahoma, Arial, sans-serif;font-size: 14px;font-style: normal;font-weight: normal;float: none;background-color: #ffffff"> | Support Escalation Engineer</span><br style="color: #454545;text-indent: 0px;letter-spacing: normal;font-family: WOL_Reg, 'Segoe UI', Tahoma, Arial, sans-serif;font-size: 14px;font-style: normal;font-weight: normal;background-color: #ffffff" /><span style="color: #454545;text-indent: 0px;letter-spacing: normal;font-family: WOL_Reg, 'Segoe UI', Tahoma, Arial, sans-serif;font-size: 14px;font-style: normal;font-weight: normal;float: none;background-color: #ffffff">Microsoft India GTSC</span>]]></content:encoded>
    </item>
    <item>
      <title>SQL SERVER Transactional and Merge Replication internal and work flow explained</title>
      <link>https://docs.microsoft.com/archive/blogs/vikas_rana/sql-server-transactional-and-merge-replication-internal-and-work-flow-explained</link>
      <pubDate>Tue, 30 May 2017 16:30:06 GMT</pubDate>
      <dc:creator><![CDATA[Vikas Rana]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/vikas_rana/?p=186</guid>
      <description><![CDATA[Recently Sravani and I delivered session on SQL SERVER Transactional and Merge Replication and...]]></description>
      <content:encoded><![CDATA[Recently Sravani and I delivered session on SQL SERVER Transactional and Merge Replication and covered following topics:
<ul>
 	<li>Different types of Replication in SQL Server</li>
 	<li>Transaction replication work flow and troubleshooting latency – tips</li>
 	<li>Merge replication workflow and troubleshooting agent failures</li>
 	<li>Understanding Merge replication metadata</li>
 	<li>Replication with SQL Server Availability groups</li>
 	<li>Demos for replication issues</li>
</ul>
You can view this video on channel9 using following URL

<a href="https://channel9.msdn.com/Blogs/Developer-Support-Series-PGI-Sessions/Developer-Support-Series-SQL-Server-Replication">https://channel9.msdn.com/Blogs/Developer-Support-Series-PGI-Sessions/Developer-Support-Series-SQL-Server-Replication</a>

&nbsp;

Vikas Rana | <a href="https://twitter.com/vikasrana_dba">Twitter</a> | <a href="https://www.linkedin.com/in/vikasrana2006/">Linkedin</a> | Support Escalation Engineer
Microsoft India GTSC]]></content:encoded>
    </item>
    <item>
      <title>Troubleshoot 586 error message id with state 5 - The prepared statement handle 1 is not valid in this</title>
      <link>https://docs.microsoft.com/archive/blogs/vikas_rana/troubleshoot-586-error-message-id-with-state-5</link>
      <pubDate>Fri, 31 Mar 2017 13:55:33 GMT</pubDate>
      <dc:creator><![CDATA[Vikas Rana]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/vikas_rana/?p=185</guid>
      <description><![CDATA[Recently I worked with one of customer where in jTDS application getting an error 586 and in...]]></description>
      <content:encoded><![CDATA[<span style="font-size: 12pt"></span><span>Recently I worked with one of customer where in jTDS application getting an error 586 and in Profiler Trace we </span><span>could see an exception with </span><span>error message id : 586 State 5 </span><span>with below text:</span><span></span>

<span><span style="font-size: 10.5pt;color: #ff0000">The prepared statement handle 1 is not valid in this
context.<span>  </span>Please verify that
current database, user default schema, and ANSI_NULLS and QUOTED_IDENTIFIER set
options are not changed since the handle is prepared.</span></span>

<span>I was able to reproduce this issue and could see following error message in SSMS:</span>

<span style="color: #ff0000"><span><b><span style="font-size: 10.5pt"><strong>Msg 586</strong></span></b></span><span style="font-size: 10.5pt">,Level 16, <b><strong>State 5</strong></b></span><span style="font-size: 10.5pt">, Procedure sp_execute, Line 1 [Batch Start Line2]</span></span>

<span style="color: #ff0000">The prepared statement handle 1 is not valid in this context.  Please verify that<span style="font-size: 10.5pt"> current database, user default schema, and ANSI_NULLS and QUOTED_IDENTIFIER set
options are not changed since the handle is prepared.</span></span>

<span style="font-size: 12pt"></span><span><span style="font-size: 10.5pt"> </span></span><span>Here is the script I used to reproduce this issue:</span>

<span style="color: #0000ff"><span></span></span><span style="color: #0000ff">use tempdb</span>
<span style="color: #0000ff">go</span>
<span style="color: #0000ff">declare @p1 int</span>
<span style="color: #0000ff">exec sp_prepare @p1 output,N'@pp varchar(255)',N'SELECT @pp'</span>
<span style="color: #0000ff">select @p1 as PrepHandle</span>
<span style="color: #0000ff">exec sp_execute @p1, @pp='This is 1st Execute'</span>
<strong><span style="color: #00ff00">use master</span></strong>
<span style="color: #0000ff">exec sp_execute @p1, @pp='This is 2nd Execute'</span>
<span style="color: #0000ff">go</span>

&nbsp;

<span style="color: #0000ff">use tempdb</span>
<span style="color: #0000ff">go</span>
<span style="color: #0000ff">declare @p1 int</span>
<span style="color: #0000ff">exec sp_prepare @p1 output,N'@pp varchar(255)',N'SELECT @pp'</span>
<span style="color: #0000ff">select @p1 as PrepHandle</span>
<span style="color: #0000ff">exec sp_execute @p1, @pp='This is 1st Execute'</span>
<strong><span style="color: #00ff00">SET ANSI_NULLS OFF</span></strong>
<span style="color: #0000ff">exec sp_execute @p1, @pp='This is 2nd Execute'</span>
<span style="color: #0000ff">go</span>
<p class="MsoNormal" style="margin: 0in 0in 0pt;line-height: normal"><span><span style="font-size: 10.5pt"> </span></span></p>
<p class="MsoNormal" style="margin: 0in 0in 0pt;line-height: normal"><span>So whenever you are tracking 586 error message with state 5 please check in Profiler Trace if application changing the database context or changing ANSI_NULLS. Happy Learning!!!</span></p>
<p class="MsoNormal" style="margin: 0in 0in 0pt;line-height: normal"><span> </span><span> </span></p>
<p class="MsoNormal" style="margin: 0in 0in 0pt;line-height: normal"><span>Vikas Rana (<a href="https://twitter.com/vikasrana_dba">@vikasrana_dba</a>)</span></p>
<p class="MsoNormal" style="margin: 0in 0in 0pt;line-height: normal"><span>Support Escalation Engineer
Microsoft India GTSC</span></p>
<span style="font-size: 12pt"></span>
<p class="MsoNormal" style="margin: 0in 0in 0pt;line-height: normal"><span><span style="font-size: 10.5pt"> </span></span></p>
<span style="font-size: 12pt"></span>
<p class="MsoNormal" style="margin: 0in 0in 0pt;line-height: normal"><span><span style="font-size: 10.5pt"> </span></span></p>]]></content:encoded>
    </item>
    <item>
      <title>Utility Control Point reporting incorrect CPU utilization when Server has more than 40 logical processor</title>
      <link>https://docs.microsoft.com/archive/blogs/vikas_rana/utility-control-point-reporting-incorrect-cpu-utilization-when-server-has-more-than-40-logical-processor</link>
      <pubDate>Wed, 22 Mar 2017 09:46:17 GMT</pubDate>
      <dc:creator><![CDATA[Vikas Rana]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/vikas_rana/?p=155</guid>
      <description><![CDATA[Recently I have worked with one of customer wherein Utility Control Point (UCP) reporting incorrect...]]></description>
      <content:encoded><![CDATA[Recently I have worked with one of customer wherein Utility Control Point (UCP) reporting incorrect CPU utilization when Server has more than 40 logical processor. So due to this issue customer getting false alert for CPU utilization, when CPU on Server below normal threshold.

During troubleshooting we have found <span><strong>num_processors</strong> column of <strong>sysutility_mi_cpu_stage_internal</strong> table contain incorrect value. So server has 80 Logical processor however we could see only 40 being reported, so due to this all calculation was going wrong.</span>

&nbsp;

<strong>SELECT [num_processors]</strong>
<strong> ,[cpu_name]</strong>
<strong> ,[cpu_caption]</strong>
<strong> ,[cpu_family_id]</strong>
<strong> ,[cpu_architecture_id]</strong>
<strong> ,[server_instance_name]</strong>
<strong> ,[virtual_server_name]</strong>
<strong> ,[physical_server_name]</strong>
<strong> ,[instance_processor_usage_percentage]</strong>
<strong> ,[computer_processor_usage_percentage]</strong>
<strong> FROM [msdb].[dbo].[sysutility_mi_cpu_stage_internal]</strong>

&nbsp;

We followed below workaround on <strong>SQL SERVER 2016 SP1</strong> to resolve this issue:

1. On each enrolled machine go to the <strong>sysutility_mi_collect_and_upload</strong> SQL Server Agent Job.

2. Edit the <strong>Stage Data Collected from PowerShell Script</strong> step

3. In the PowerShell script find the line

<strong>[Int32] $numProcessors = [System.Environment]::ProcessorCount (line 741 in 2016 SP1 copy of the script)</strong>

4. Replace this line with

<strong>[Int32] $numProcessors = (@(gwmi Win32_Processor) | measure -property NumberOfLogicalProcessors -sum).Sum</strong>

<strong>Note:</strong> Please take msdb and entire script backup before you modify this code. If you edit the code incorrectly then this can cause UCP job to fail. I have tested this workaround only with SQL SERVER 2016 SP 1 only.

&nbsp;

Vikas Rana

<a href="https://twitter.com/vikasrana_dba">Twitter</a>| <a href="https://www.linkedin.com/in/vikasrana2006/">Linkedin</a> | Support Escalation Engineer
Microsoft India GTSC]]></content:encoded>
    </item>
    <item>
      <title>Msg 13575 OR Msg 13542 error message while adding period columns</title>
      <link>https://docs.microsoft.com/archive/blogs/vikas_rana/msg-13575-or-msg-13597-error-message-while-adding-period-columns</link>
      <pubDate>Tue, 29 Nov 2016 14:46:58 GMT</pubDate>
      <dc:creator><![CDATA[Vikas Rana]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/vikas_rana/?p=145</guid>
      <description><![CDATA[You may see following error message while trying to enable system-versioned temporal table and...]]></description>
      <content:encoded><![CDATA[You may see following error message while trying to enable system-versioned temporal table and adding period columns for a table which contain data:

<strong></strong><strong></strong><strong><em><strong>1<sup>st</sup> <u>error message:</u></strong></em></strong>

<span style="color: #ff0000">Msg 13575, Level 16, State 0, Line 32</span>

<span style="color: #ff0000">ADD PERIOD FOR SYSTEM_TIME failed because table 'temporaltest.dbo.CUSTOMERINFO' contains records where end of period is not equal to MAX datetime.</span>

<strong><sup>2nd</sup> <u>error message</u>:</strong>

<span style="color: #ff0000">Msg 13542, Level 16, State 0, Line 8733</span>

<span style="color: #ff0000">ADD PERIOD FOR SYSTEM_TIME on table ' temporaltest.dbo.CUSTOMERINFO' failed because there are open records with start of period set to a value in the future.</span>

This issue can occur for memory optimized table as well as non-memory optimized table.

You can reproduce this issue using following T-SQL:

/************************************************************************************************************************/

<span style="color: #0000ff;font-size: small">CREATE DATABASE [temporaltest]</span>

<span style="color: #0000ff;font-size: small">CONTAINMENT = NONE</span>

<span style="color: #0000ff;font-size: small">ON PRIMARY</span>

<span style="color: #0000ff;font-size: small">( NAME = N'temporaltest', FILENAME = N'E:\temp\temporaltest.mdf' , SIZE = 8192KB , MAXSIZE = UNLIMITED, FILEGROWTH = 65536KB ),</span>

<span style="color: #0000ff;font-size: small">FILEGROUP [imoltp_mod] CONTAINS MEMORY_OPTIMIZED_DATA DEFAULT</span>

<span style="color: #0000ff;font-size: small">( NAME = N'imoltp_mod1', FILENAME = N'e:\temp\imoltp_mod1' , MAXSIZE = UNLIMITED)</span>

<span style="color: #0000ff;font-size: small">LOG ON</span>

<span style="color: #0000ff;font-size: small">( NAME = N'temporaltest_log', FILENAME = N'E:\temp\temporaltest_log.ldf' , SIZE = 8192KB , MAXSIZE = 2048GB , FILEGROWTH = 65536KB )</span>

<span style="color: #0000ff;font-size: small">GO</span>

<span style="color: #0000ff;font-size: small">use temporaltest</span>

<span style="color: #0000ff;font-size: small">GO</span>

<span style="color: #0000ff;font-size: small">CREATE TABLE [dbo].[CUSTOMERINFO]</span>

<span style="color: #0000ff;font-size: small">(</span>

<span style="color: #0000ff;font-size: small">[ID] [bigint] IDENTITY(1,1) NOT NULL,</span>

<span style="color: #0000ff;font-size: small">[EMPID] [int] NOT NULL,</span>

<span style="color: #0000ff;font-size: small">CONSTRAINT [CUSTOMERINFO_primaryKey] PRIMARY KEY NONCLUSTERED HASH</span>

<span style="color: #0000ff;font-size: small">(</span>

<span style="color: #0000ff;font-size: small">[EMPID]</span>

<span style="color: #0000ff;font-size: small">)WITH ( BUCKET_COUNT = 128)</span>

<span style="color: #0000ff;font-size: small">)WITH ( MEMORY_OPTIMIZED = ON , DURABILITY = SCHEMA_AND_DATA )</span>

<span style="color: #0000ff;font-size: small">GO</span>

<span style="color: #0000ff;font-size: small">insert into [CUSTOMERINFO] ([EMPID]) select 1</span>

<span style="color: #0000ff;font-size: small">GO</span>

<span style="color: #0000ff;font-size: small">select * from [CUSTOMERINFO]</span>

<span style="color: #0000ff;font-size: small">GO</span>

<span style="color: #0000ff;font-size: small">ALTER TABLE [CUSTOMERINFO]</span>

<span style="color: #0000ff;font-size: small">ADD PERIOD FOR SYSTEM_TIME (SysStartTime, SysEndTime),</span>

<span style="color: #0000ff;font-size: small">SysStartTime datetime2 GENERATED ALWAYS AS ROW START HIDDEN NOT NULL DEFAULT GETUTCDATE(),</span>

<span style="color: #0000ff;font-size: small">SysEndTime datetime2 GENERATED ALWAYS AS ROW END HIDDEN NOT NULL DEFAULT CONVERT(DATETIME2, '9999-12-31 23:59:59.99999999');</span>

/************************************************************************************************************************/

<b><u><strong><span><strong>WORKAROUND</strong></span></strong></u></b>

If you are seeing same symptoms in that case you can break your T-SQL in 4 parts as shown below which should help you to resolve this issue:

/************************************************************************************************************************/

<span style="color: #0000ff">ALTER TABLE [CUSTOMERINFO]</span>

<span style="color: #0000ff">ADD</span>

<span style="color: #0000ff">SysStartTime datetime2 NOT NULL DEFAULT GETUTCDATE(),</span>

<span style="color: #0000ff">SysEndTime datetime2 NOT NULL DEFAULT CONVERT(DATETIME2, '9999-12-31 23:59:59.99999999');</span>

<span style="color: #0000ff">GO</span>

<span style="color: #0000ff">ALTER TABLE [CUSTOMERINFO]</span>

<span style="color: #0000ff">ADD PERIOD FOR SYSTEM_TIME (SysStartTime, SysEndTime);</span>

<span style="color: #0000ff">GO</span>

<span style="color: #0000ff">ALTER TABLE [CUSTOMERINFO] </span>

<span style="color: #0000ff">alter column SysStartTime ADD HIDDEN;</span>

<span style="color: #0000ff">GO</span>

<span style="color: #0000ff">ALTER TABLE [CUSTOMERINFO] </span>

<span style="color: #0000ff">alter column SysEndTime ADD HIDDEN;</span>

/************************************************************************************************************************/
<p class="MsoNormal" style="margin: 0in 0in 0pt;line-height: normal"><span style="font-size: 11pt"> </span></p>
Vikas Rana (<a href="https://twitter.com/vikasrana_dba" class="ProfileHeaderCard-screennameLink u-linkComplex js-nav"><span class="username u-dir" dir="ltr">@<b class="u-linkComplex-target">vikasrana_dba</b></span></a>)

Support Escalation Engineer
Microsoft India GTSC

<span style="font-size: 12pt"></span>]]></content:encoded>
    </item>
    <item>
      <title>SQL SERVER 2016 installation failing due to MSVCR120 missing Update (EXCEPTION_ILLEGAL_INSTRUCTION)</title>
      <link>https://docs.microsoft.com/archive/blogs/vikas_rana/sql-server-2016-installation-failing-due-to-msvcr120-missing-update-exception_illegal_instruction</link>
      <pubDate>Wed, 23 Nov 2016 16:52:18 GMT</pubDate>
      <dc:creator><![CDATA[Vikas Rana]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/vikas_rana/?p=85</guid>
      <description><![CDATA[I was working on one of SQL SETUP issue with my colleague Shaurabh Thapa where in SQL SERVER 2016...]]></description>
      <content:encoded><![CDATA[I was working on one of SQL SETUP issue with my colleague Shaurabh Thapa where in SQL SERVER 2016 installation was failing. So we looked into the setup logs and in detail.txt we could see following information:

&nbsp;

<strong><u>Detail.txt</u></strong>

(01) 2016-10-10 17:25:48 Slp: Sco: Returning service process id 0

(01) 2016-10-10 17:25:48 Slp: Configuration action failed for feature SQL_Engine_Core_Inst during timing ConfigRC and scenario ConfigRC.

(01) 2016-10-10 17:25:48 Slp: The service did not respond to the start or control request in a timely fashion.

(01) 2016-10-10 17:25:48 Slp: The configuration failure category of current exception is ConfigurationFailure

(01) 2016-10-10 17:25:48 Slp: Configuration action failed for feature SQL_Engine_Core_Inst during timing ConfigRC and scenario ConfigRC.

(01) 2016-10-10 17:25:48 Slp: System.ComponentModel.Win32Exception (0x80004005): The service did not respond to the start or control request in a timely fashion.

(01) 2016-10-10 17:25:48 Slp:    at Microsoft.SqlServer.Configuration.Sco.Service.StartService(String[] startParams)

(01) 2016-10-10 17:25:48 Slp:    at Microsoft.SqlServer.Configuration.SqlEngine.SqlServerServiceSCM.StartSqlServer(String[] parameters, Boolean withFailpoint)

(01) 2016-10-10 17:25:48 Slp:    at Microsoft.SqlServer.Configuration.SqlEngine.SqlServerStartup.StartSQLServerForInstall(String sqlCollation, String masterFullPath, Boolean isConfiguringTemplateDBs, Boolean isSlipstreamRunning)

(01) 2016-10-10 17:25:48 Slp:    at Microsoft.SqlServer.Configuration.SqlEngine.SqlEngineDBStartConfig.ConfigSQLServerSystemDatabases(EffectiveProperties properties, Boolean isConfiguringTemplateDBs, Boolean useInstallInputs)

(01) 2016-10-10 17:25:48 Slp:    at Microsoft.SqlServer.Configuration.SqlEngine.SqlEngineDBStartConfig.DoCommonDBStartConfig(ConfigActionTiming timing)

(01) 2016-10-10 17:25:48 Slp:    at Microsoft.SqlServer.Configuration.SqlEngine.SqlEngineDBStartConfig.Install(ConfigActionTiming timing, Dictionary`2 actionData, PublicConfigurationBase spcb)

(01) 2016-10-10 17:25:48 Slp:    at Microsoft.SqlServer.Configuration.SqlConfigBase.PrivateConfigurationBase.Execute(ConfigActionScenario scenario, ConfigActionTiming timing, ConfigBaseAction action, Dictionary`2 actionData, PublicConfigurationBase spcbCurrent)

(01) 2016-10-10 17:25:48 Slp:    at Microsoft.SqlServer.Configuration.SqlConfigBase.SqlFeatureConfigBase.Execute(ConfigActionScenario scenario, ConfigActionTiming timing, ConfigBaseAction action, Dictionary`2 actionData, PublicConfigurationBase spcbCurrent)

(01) 2016-10-10 17:25:48 Slp:    at Microsoft.SqlServer.Configuration.SqlConfigBase.SlpConfigAction.ExecuteAction(String actionId)

(01) 2016-10-10 17:25:48 Slp:    at Microsoft.SqlServer.Configuration.SqlConfigBase.SlpConfigAction.Execute(String actionId, TextWriter errorStream)

(01) 2016-10-10 17:25:48 Slp: The following is an exception stack listing the exceptions in outermost to innermost order

(01) 2016-10-10 17:25:48 Slp: Inner exceptions are being indented

(01) 2016-10-10 17:25:48 Slp:

(01) 2016-10-10 17:25:48 Slp: Exception type: System.ComponentModel.<strong>Win32Exception</strong>

(01) 2016-10-10 17:25:48 Slp:     Message:

(01) 2016-10-10 17:25:48 Slp:         <strong>The service did not respond to the start or control request in a timely fashion</strong>.

(01) 2016-10-10 17:25:48 Slp:

(01) 2016-10-10 17:25:48 Slp:     HResult : 0x80004005

(01) 2016-10-10 17:25:48 Slp:     Error : 1053

(01) 2016-10-10 17:25:48 Slp:     Data:

(01) 2016-10-10 17:25:48 Slp:       SQL.Setup.FailureCategory = ConfigurationFailure

(01) 2016-10-10 17:25:48 Slp:       <strong>WatsonConfigActionData</strong> = <strong>INSTALL@CONFIGRC@SQL_ENGINE_CORE_INST</strong>

(01) 2016-10-10 17:25:48 Slp:       WatsonExceptionFeatureIdsActionData = System.String[]

(01) 2016-10-10 17:25:48 Slp:     Stack:

(01) 2016-10-10 17:25:48 Slp:         at Microsoft.SqlServer.Configuration.Sco.Service.StartService(String[] startParams)

(01) 2016-10-10 17:25:48 Slp:         at Microsoft.SqlServer.Configuration.SqlEngine.SqlServerServiceSCM.StartSqlServer(String[] parameters, Boolean withFailpoint)

(01) 2016-10-10 17:25:48 Slp:         at Microsoft.SqlServer.Configuration.SqlEngine.SqlServerStartup.StartSQLServerForInstall(String sqlCollation, String masterFullPath, Boolean isConfiguringTemplateDBs, Boolean isSlipstreamRunning)

(01) 2016-10-10 17:25:48 Slp:         at Microsoft.SqlServer.Configuration.SqlEngine.SqlEngineDBStartConfig.ConfigSQLServerSystemDatabases(EffectiveProperties properties, Boolean isConfiguringTemplateDBs, Boolean useInstallInputs)

(01) 2016-10-10 17:25:48 Slp:         at Microsoft.SqlServer.Configuration.SqlEngine.SqlEngineDBStartConfig.DoCommonDBStartConfig(ConfigActionTiming timing)

(01) 2016-10-10 17:25:48 Slp:         at Microsoft.SqlServer.Configuration.SqlEngine.SqlEngineDBStartConfig.Install(ConfigActionTiming timing, Dictionary`2 actionData, PublicConfigurationBase spcb)

(01) 2016-10-10 17:25:48 Slp:         at Microsoft.SqlServer.Configuration.SqlConfigBase.PrivateConfigurationBase.Execute(ConfigActionScenario scenario, ConfigActionTiming timing, ConfigBaseAction action, Dictionary`2 actionData, PublicConfigurationBase spcbCurrent)

(01) 2016-10-10 17:25:48 Slp:         at Microsoft.SqlServer.Configuration.SqlConfigBase.SqlFeatureConfigBase.Execute(ConfigActionScenario scenario, ConfigActionTiming timing, ConfigBaseAction action, Dictionary`2 actionData, PublicConfigurationBase spcbCurrent)

(01) 2016-10-10 17:25:48 Slp:         at Microsoft.SqlServer.Configuration.SqlConfigBase.SlpConfigAction.ExecuteAction(String actionId)

(01) 2016-10-10 17:25:48 Slp:         at Microsoft.SqlServer.Configuration.SqlConfigBase.SlpConfigAction.Execute(String actionId, TextWriter errorStream)

(01) 2016-10-10 17:25:48 Slp: Watson Bucket 1

Original Parameter Values

(01) 2016-10-10 17:25:48 Slp: Parameter 0 : SQL Server 2016@RTM@

(01) 2016-10-10 17:25:48 Slp: Parameter 1 : Microsoft.SqlServer.Configuration.Sco.Service.StartService

(01) 2016-10-10 17:25:48 Slp: Parameter 2 : Microsoft.SqlServer.Configuration.Sco.Service.StartService

(01) 2016-10-10 17:25:48 Slp: Parameter 3 : System.ComponentModel.Win32Exception@-2147467259

(01) 2016-10-10 17:25:48 Slp: Parameter 4 : System.ComponentModel.Win32Exception@-2147467259

(01) 2016-10-10 17:25:48 Slp: Parameter 5 : SqlEngineDBStartConfigAction_install_configrc

(01) 2016-10-10 17:25:48 Slp: Parameter 6 : INSTALL@CONFIGRC@SQL_ENGINE_CORE_INST

(01) 2016-10-10 17:25:48 Slp: Parameter 7 : 1053

(01) 2016-10-10 17:25:48 Slp: Parameter 8 : 1053

(01) 2016-10-10 17:25:26 SQLEngine: : Checking Engine checkpoint 'StartEngineService'

(01) 2016-10-10 17:25:26 SQLEngine: --SqlServerServiceSCM: Starting SQL via SCM (-mSqlSetup -Q -qLatin1_General_CI_AS -T4022 -T4010 -T3659 -T3610 -T8015)...

(01) 2016-10-10 17:25:26 Slp: Sco: Attempting to start service MSSQL$SQL2016

(01) 2016-10-10 17:25:26 Slp: Sco: Attempting to open SC Manager

(01) 2016-10-10 17:25:26 Slp: Sco: Attempting to open service handle for service MSSQL$SQL2016

(01) 2016-10-10 17:25:44 Slp: Sco: Attempting to close service handle for service MSSQL$SQL2016

(01) 2016-10-10 17:25:44 Slp: Sco: Attempting to close SC Manager

(01) 2016-10-10 17:25:44 SQLEngine: --SqlServerServiceSCM: Exception generated: The service did not respond to the start or control request in a timely fashion.

&nbsp;

So we can cleary see that SQL SERVER Service failed to start and hitting an <strong>exception</strong>. We looked into the Watson dump signature and can clearly see a <strong>APPCRASH</strong> and faulting module was MSVCR120.dll with <strong>EXCEPTION_ILLEGAL_INSTRUCTION exception</strong>.

&nbsp;

Version=1

EventType=<strong>APPCRASH</strong>

EventTime=131194442869667947

ReportType=2

Consent=1

ReportIdentifier=d1637b61-8499-11e6-80b6-aeb7d004036e

IntegratorReportIdentifier=d1637b60-8499-11e6-80b6-aeb7d004036e

NsAppName=sqlservr.exe

Response.type=4

Sig[0].Name=Application Name

Sig[0].Value=sqlservr.exe

Sig[1].Name=Application Version

Sig[1].Value=2015.130.1601.5

Sig[2].Name=Application Timestamp

Sig[2].Value=5724ae45

Sig[3].Name=<strong>Fault Module Name</strong>

Sig[3].Value=<strong>MSVCR120.dll</strong>

Sig[4].Name=Fault Module Version

Sig[4].Value=12.0.40649.5

Sig[5].Name=Fault Module Timestamp

Sig[5].Value=56bc00d3

Sig[6].Name=Exception Code

<strong>Sig[6].Value=c000001d</strong>                 =============&gt; <span style="text-decoration: underline">This means <strong>EXCEPTION_ILLEGAL_INSTRUCTION</strong></span>

Sig[7].Name=Exception Offset

Sig[7].Value=00000000000931f3

DynamicSig[1].Name=OS Version

DynamicSig[1].Value=6.3.9600.2.0.0.272.7

DynamicSig[2].Name=Locale ID

DynamicSig[2].Value=2057

DynamicSig[22].Name=Additional Information 1

DynamicSig[22].Value=9d85

DynamicSig[23].Name=Additional Information 2

DynamicSig[23].Value=9d85f85e0140d2c5e78ed7595acfc4cb

DynamicSig[24].Name=Additional Information 3

DynamicSig[24].Value=4062

DynamicSig[25].Name=Additional Information 4

DynamicSig[25].Value=406218417176eedb9b6d8b2c6586febb

UI[2]=C:\Program Files\Microsoft SQL Server\MSSQL13.MSSQLSERVER\MSSQL\Binn\sqlservr.exe

UI[5]=Check online for a solution (recommended)

UI[6]=Check for a solution later (recommended)

UI[7]=Close

UI[8]=SQL Server Windows NT - 64 Bit stopped working and was closed

UI[9]=A problem caused the application to stop working correctly. Windows will notify you if a solution is available.

UI[10]=&amp;Close

&nbsp;

&nbsp;

<strong><u>Solution</u></strong>

We found that customer already installed Critical Update for Microsoft VC++ 2013 Runtime but issue was still happening.

<a href="https://support.microsoft.com/en-us/kb/3164398">https://support.microsoft.com/en-us/kb/3164398</a>

We have done further research on this and later asked customer to apply following fix and after that SQL SERVER 2016 installation completed successfully.

<strong>FIX: Programs that are built in Visual C++ 2013 crash with "Illegal Instruction" exception</strong>

<a href="https://support.microsoft.com/en-in/kb/3174417">https://support.microsoft.com/en-in/kb/3174417</a>

&nbsp;

I hope this will help.

&nbsp;

Vikas Rana (<a href="https://twitter.com/vikasrana_dba" class="ProfileHeaderCard-screennameLink u-linkComplex js-nav"><span class="username u-dir" dir="ltr">@<b class="u-linkComplex-target">vikasrana_dba</b></span></a>)

Support Escalation Engineer
Microsoft India GTSC]]></content:encoded>
    </item>
    <item>
      <title>SSMS behaviour if you have Cluster Shared Volume and C drive repeating while choosing location for backup\restore\database attach</title>
      <link>https://docs.microsoft.com/archive/blogs/vikas_rana/ssms-behavior-if-you-have-cluster-shared-volume-and-c-drive-repeating-while-choosing-location-for-backuprestoredatabase-attach</link>
      <pubDate>Wed, 23 Nov 2016 15:27:44 GMT</pubDate>
      <dc:creator><![CDATA[Vikas Rana]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/vikas_rana/?p=36</guid>
      <description><![CDATA[Consider this scenario, when you try to attach, restore or taking database backup using SQL SERVER...]]></description>
      <content:encoded><![CDATA[Consider this scenario, when you try to attach, restore or taking database backup using SQL SERVER Management Studio GUI and trying to choose the location then you may see C: drive repeating.

<a href="https://msdnshared.blob.core.windows.net/media/2016/11/SSMS_GUI_LOCATION.jpg"><img src="https://msdnshared.blob.core.windows.net/media/2016/11/SSMS_GUI_LOCATION.jpg" alt="ssms_gui_location" width="640" height="463" class="alignnone size-full wp-image-45" /></a>

&nbsp;

So this behavior may raise questions like, is it by design behavior? Will this cause any issue? Which drive to choose?

So this typically happened if you are using <strong>Cluster Shared Volume </strong>in your environment and have more than one <strong>CSV</strong> located under C drive. In such scenario you may see this behavior while doing any of above database activity using SSMS GUI, so you can choose any drive and this will not cause any issue as all are representing C drive only.

Also worth mentioning that when you have multiple CSV on Server then following DMV basically used in background to pull the drives information which basically return two rows for C drives which contain complete path detail and that’s the reason you may see multiple C drives in SSMS GUI if you have CSV.

<strong>select * from sys.dm_io_cluster_valid_path_names</strong>

&nbsp;

&nbsp;
<table width="497">
<tbody>
<tr>
<td width="188" style="text-align: center"><strong>path_name</strong></td>
<td width="137" style="text-align: center"><strong>cluster_owner_node</strong></td>
<td width="172" style="text-align: center"><strong>is_cluster_shared_volume</strong></td>
</tr>
<tr>
<td style="text-align: center">E:\</td>
<td style="text-align: center">45536SQLNODE1</td>
<td style="text-align: center">0</td>
</tr>
<tr>
<td style="text-align: center">C:\ClusterStorage\Volume1\</td>
<td style="text-align: center">45536SQLNODE1</td>
<td style="text-align: center">1</td>
</tr>
<tr>
<td style="text-align: center">C:\ClusterStorage\Volume2\</td>
<td style="text-align: center">45536SQLNODE1</td>
<td style="text-align: center">1</td>
</tr>
</tbody>
</table>
&nbsp;

Just in case if you are using CSV and getting following error message while using SQL SERVER 2014 SSMS and unable to access the path on Server:

<span style="text-decoration: underline">Cannot access the specified path or file on the server. Verify that you have the necessary security privileges and that the path or file exists. If you know that the service account can access a specific file, type in the full path for the file in the File Name control in the Locate dialog box.</span>

&nbsp;

Fix for this issue already released for SQL SERVER 2014:

<strong>FIX: "Cannot access the specified path or file on the server" when you use CSV in SSMS to back up or restore database</strong>

<a href="https://support.microsoft.com/en-in/kb/3048627">https://support.microsoft.com/en-in/kb/3048627</a>

&nbsp;

I hope this will help.

&nbsp;

Vikas Rana (<a href="https://twitter.com/vikasrana_dba" class="ProfileHeaderCard-screennameLink u-linkComplex js-nav"><span class="username u-dir" dir="ltr">@<b class="u-linkComplex-target">vikasrana_dba</b></span></a>)

Support Escalation Engineer
Microsoft India GTSC]]></content:encoded>
    </item>
  </channel>
</rss>