<?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>Poojakamath</title>
    <atom:link
      href="https://docs.microsoft.com/archive/blogs/poojakamath/feed.xml"
      rel="self"
      type="application/rss+xml" />
    <link>https://docs.microsoft.com/archive/blogs/poojakamath/feed.xml</link>
    <description />
    <lastBuildDate>Thu, 19 Jul 2018 07:50:26 GMT</lastBuildDate>
    <language>en-US</language>
    <sy:updatePeriod>hourly</sy:updatePeriod>
    <sy:updateFrequency>1</sy:updateFrequency>
    <item>
      <title>Find the Session ID of an executing SQL Agent job</title>
      <link>https://docs.microsoft.com/archive/blogs/poojakamath/find-the-session-id-of-an-executing-sql-agent-job</link>
      <pubDate>Thu, 19 Jul 2018 07:50:26 GMT</pubDate>
      <dc:creator><![CDATA[Pooja Kamath]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/poojakamath/?p=985</guid>
      <description><![CDATA[On a busy production server I wanted to check when a job started running , I tried to look at the...]]></description>
      <content:encoded><![CDATA[On a busy production server I wanted to check when a job started running , I tried to look at the sysjob history table in the MSDB

&nbsp;

However there are no entries for inflight jobs (meaning no entries for job that haven't failed or pass)

The sysjobschedules table from msdb will only show you failed or successful runs

&nbsp;

While there are scripts available online to do this , you can use the below DMV's as well

&nbsp;

select * from sys.jobs

--&gt;Copy the job ID of your job name

select PROGRAM_NAME , * from sysprocesses where spid&gt; 50

&nbsp;

<em>The result will be something like:</em>

<em>SQLAgent - TSQL JobStep (Job xx23453AB7EC97864084xxxxxF72B8CC9E : Step 1)</em>

--&gt;Make sure the program_name matches the Job ID you are looking for
Get the spid from here

&nbsp;

--&gt; You can now use it in below DMV's to check for blockings or waittypes

select * from sys.dm_exec_requests where session_id = 102
select last_batch, * from sysprocesses where spid = 102

&nbsp;]]></content:encoded>
    </item>
    <item>
      <title>Where is my SQL BPA(Best Practice Analyzer) for SQL 2014/2016/2017?</title>
      <link>https://docs.microsoft.com/archive/blogs/poojakamath/where-is-my-sql-bpabest-practice-analyzer-for-sql-201420162017</link>
      <pubDate>Thu, 03 May 2018 09:24:47 GMT</pubDate>
      <dc:creator><![CDATA[Pooja Kamath]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/poojakamath/?p=875</guid>
      <description><![CDATA[We recently built a SQL 2016 Server for a client and wanted to check if the best practices have been...]]></description>
      <content:encoded><![CDATA[We recently built a SQL 2016 Server for a client and wanted to check if the best practices have been followed or not.

Most of us have used the tool BPA (Best Practice Analyzer) to evaluate an instance.

The Microsoft SQL Server 2012 BPA is a diagnostic tool that performs the following functions:
<ul>
 	<li>Gathers information about a Server and a Microsoft SQL Server 2012 instance installed on that Server</li>
 	<li>Determines if the configurations are set according to the recommended best practices</li>
 	<li>Reports on all configurations, indicating settings that differ from recommendations</li>
 	<li>Indicates potential problems in the installed instance of SQL Server</li>
 	<li>Recommends solutions to potential problems</li>
</ul>
&nbsp;

The latest version I worked with was the BPA for SQL 2012 found <a href="https://www.microsoft.com/en-us/download/details.aspx?id=29302">here</a>

Now we didn’t have this tool available for download for SQL 2014 or SQL 2016. It appears the BPA has been replaced by Policy Evaluation using built in Best Practice Templates. Here is how you can perform one.

These are the policies that will be evaluated as part of the template :

<a href="https://docs.microsoft.com/en-us/sql/relational-databases/policy-based-management/monitor-and-enforce-best-practices-by-using-policy-based-management?view=sql-server-2017">https://docs.microsoft.com/en-us/sql/relational-databases/policy-based-management/monitor-and-enforce-best-practices-by-using-policy-based-management?view=sql-server-2017</a>

&nbsp;

To perform an on-demand evaluation by using Object Explorer
<ol>
 	<li>Start Management Studio, and then connect to the Database Engine.</li>
 	<li>In Object Explorer, expand <strong>Management</strong>, expand <strong>Policy Management</strong>, right-click <strong>Policies</strong>, and then click <strong>Evaluate</strong>.</li>
</ol>
<a href="https://msdnshared.blob.core.windows.net/media/2018/05/12.png"><img src="https://msdnshared.blob.core.windows.net/media/2018/05/12-300x269.png" alt="" width="300" height="269" class="alignnone size-medium wp-image-885" /></a>

2. In the <strong>Evaluate Policies</strong> dialog box, next to the <strong>Source</strong> box, click the ellipsis (<strong>…</strong>) button

<a href="https://msdnshared.blob.core.windows.net/media/2018/05/210.png"><img src="https://msdnshared.blob.core.windows.net/media/2018/05/210-300x101.png" alt="" width="470" height="158" class="wp-image-895 aligncenter" /></a>

3. In the <strong>Select Source</strong> dialog box, you can select either <strong>Files</strong> or <strong>Server</strong> as the source of the policy files to evaluate. Click <strong>Files</strong>, and then select the individual policy files that you want to evaluate. To do this, follow these steps:
<ol>
 	<li>Click <strong>Files</strong>.</li>
 	<li>Next to <strong>Files</strong>, click the ellipsis (<strong>…</strong>) button.</li>
 	<li>In the <strong>Select Policy</strong>dialog box, browse to the following folder, which contains the best practices <a href="https://msdnshared.blob.core.windows.net/media/2018/05/32.png"><img src="https://msdnshared.blob.core.windows.net/media/2018/05/32-300x181.png" alt="" width="331" height="200" class="alignnone  wp-image-905" /></a></li>
</ol>
<strong>C:\Program Files (x86)\Microsoft SQL Server\110\Tools\Policies\DatabaseEngine\1033</strong>
<ol>
 	<li>Select one or more .xml policy files to evaluate, and then click <strong>Open</strong>.<a href="https://msdnshared.blob.core.windows.net/media/2018/05/41.png"><img src="https://msdnshared.blob.core.windows.net/media/2018/05/41-300x40.png" alt="" width="323" height="43" class="alignnone  wp-image-925" /></a></li>
</ol>
The list of selected files appears in the <strong>Files</strong> box.
<ol>
 	<li>In the <strong>Select Source</strong>dialog box, click <strong>OK</strong>.</li>
 	<li>If the <strong>Loading Policies</strong>dialog box appears, click <strong>Close</strong>.</li>
 	<li>The policies that you selected are listed on the <strong>Policy Selection</strong> page. Be aware that a warning icon next to a policy indicates that the policy contains scripts.
<ol>
 	<li>Click <strong>Evaluate</strong> to evaluate the policies.</li>
</ol>
</li>
</ol>
<a href="https://msdnshared.blob.core.windows.net/media/2018/05/6.png"><img src="https://msdnshared.blob.core.windows.net/media/2018/05/6-289x300.png" alt="" width="289" height="300" class="alignnone size-medium wp-image-945" /></a>

&nbsp;

In the <strong>Results</strong> table, the results for each policy are listed. A red "x" icon indicates that policy compliance failed.

<a href="https://msdnshared.blob.core.windows.net/media/2018/05/7.png"><img src="https://msdnshared.blob.core.windows.net/media/2018/05/7-300x211.png" alt="" width="300" height="211" class="alignnone size-medium wp-image-955" /></a>

You can click on the Details to see what policy has failed

<a href="https://msdnshared.blob.core.windows.net/media/2018/05/8.png"><img src="https://msdnshared.blob.core.windows.net/media/2018/05/8-300x156.png" alt="" width="300" height="156" class="alignnone size-medium wp-image-965" /></a>

Make sure that you fully understand the policy setting before automatically updating a target instance.]]></content:encoded>
    </item>
    <item>
      <title>Configure Alerts for a Hung/Stuck SQL Agent Job step</title>
      <link>https://docs.microsoft.com/archive/blogs/poojakamath/configure-alerts-for-a-hungstuck-sql-agent-job-step</link>
      <pubDate>Fri, 20 Apr 2018 13:59:43 GMT</pubDate>
      <dc:creator><![CDATA[Pooja Kamath]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/poojakamath/?p=855</guid>
      <description><![CDATA[SQL Server does a decent job alerting us of SQL Agent Job failures/ Success

But, what if we  want...]]></description>
      <content:encoded><![CDATA[SQL Server does a decent job alerting us of SQL Agent Job failures/ Success

But, what if we  want to know if a job is hung, been running for a long time and has been stuck?

When my customer approached me with the below problem I realized that the Job history table in the MSDB does not have entries for Job or Job Steps that are hung or in Transit.

It only adds an entry to the Job History table after the Job has completed or Failed.

&nbsp;

We had the following SQL Agent Job in our environment
1. We were using an SSIS package with an <a href="https://docs.microsoft.com/en-us/sql/integration-services/control-flow/wmi-event-watcher-task?view=sql-server-2017">WMI Event Watcher Task</a> to continuously watch for arrival of new files. Each day the new file would arrive at 3AM

2. After this there were more steps in the Job execution which would process the file..etc

The Job had steps 1 to 8

The problem was that it was getting hung on the 2nd  step which was the SSIS Package execution. This was to process the file after the WMI Event Watcher Task determined that the file had arrived. It was getting hung “intermittently” with no specific pattern , even after the file has arrived.

Each time the application user would raise a complaint that they did not recieve a file for  processing their Daily report which would then alert the SQL team. They would find the Job stuck executing the Step 2.

To fix it they would check if the file had arrived and then jump to step3.

We needed a proactive way to alert us if the Job step was stuck. Hence we used the below approach

Find your Step_id and Job_Id from

<strong>Use msdb</strong>
<strong> go</strong>
<strong> select * from dbo.sysjobsteps</strong>

&nbsp;

We created a new SQL Agent Job for msdb database to alert us:

<strong>declare @run_date int</strong>
<strong> set @run_date = (select TOP 1 run_date from dbo.sysjobhistory where step_id = 2 and job_id='XXXXXXX-XXX-XXXX-XXXX-XXXXXXX' ORDER BY run_date DESC)</strong>
--Getting the latest run_date of the Job step
<strong> declare @return_value int = 0;</strong>

<strong>declare @d1 int = (SELECT YEAR(GETDATE()) * 10000 + MONTH(GETDATE()) * 100 + DAY(GETDATE()))</strong>
-- Getting todays date in the same format as the last run_date

<strong>declare @run_time int = (select TOP 1 run_time from dbo.sysjobhistory where step_id =2 and job_id='XXXXXX-XXX-XXXX-XXXX-XXXXXXX' ORDER BY run_date DESC)</strong>
--Getting the latest run_time of the Job Step

<strong>declare @threshold_time int = 50000</strong>
--Declare a threshold time at which you want to be alerted. Example Job step was to complete at 3am ,but even at 5AM it hasnt posted a success message
--Here 5am is your threshold_time

<strong>if @d1 &gt; @run_date and @run_time &lt; @threshold_time SET @return_value = 1 ;</strong>
-- If the Job History doesnt have run_date record for Today and if Job History shows that the latest run_time is less than the threshold_time
--it means the Job Step hasn't run or is probably stuck , which means we should be alerted

<strong>IF (@return_value) &gt; 0</strong>
<strong> begin</strong>
<strong> exec msdb.dbo.sp_send_dbmail</strong>
<strong> @profile_name = 'Default',</strong>
<strong> @recipients = 'me@example.com',</strong>
<strong> @subject = 'warning step 2 is stuck'</strong>
<strong> end</strong>

<em> </em>To setup Database Mail you can refer the following <a href="https://www.mssqltips.com/sqlservertip/1100/setting-up-database-mail-for-sql-server/">steps</a> We now get alerted when our job step is stuck! Hope this helps if someone has the same issue. If you have any more ideas on how to approach this please do share in the comment section below:) <span style="font-family: Georgia, 'Times New Roman', 'Bitstream Charter', Times, serif"><span> </span></span>]]></content:encoded>
    </item>
    <item>
      <title>SQL 2012 BPA error- 'Login does not exist on SQL Server OR Login is not a member of the Systems Administrator role'</title>
      <link>https://docs.microsoft.com/archive/blogs/poojakamath/sql-2012-bpa-error-login-does-not-exist-on-sql-server-or-login-is-not-a-member-of-the-systems-administrator-role</link>
      <pubDate>Mon, 08 May 2017 11:51:15 GMT</pubDate>
      <dc:creator><![CDATA[Pooja Kamath]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/poojakamath/?p=846</guid>
      <description><![CDATA[I was recently trying to use the diagnostic tool Microsoft SQL Server 2012 Best Practice Analyzer on...]]></description>
      <content:encoded><![CDATA[I was recently trying to use the diagnostic tool <a href="https://www.microsoft.com/en-us/download/details.aspx?id=29302">Microsoft SQL Server 2012 Best Practice Analyzer </a>on my customer's machine that was getting ready for a migration.

<span lang="EN"><span>·<span style="font: 7pt 'Times New Roman';margin: 0px">        </span></span></span><span lang="EN">Using this tool a DBA can determine whether the SQL Server is configured as per the best practices recommended by the SQL Server Products Team. </span>

<span lang="EN"><span>·<span style="font: 7pt 'Times New Roman';margin: 0px">        </span></span></span><span lang="EN">This tool validates your instance of SQL Server with certain built-in rules that can help you rectify common installation and configuration issues. </span>

&nbsp;

&nbsp;

While this is a great tool that generates a ready report for us, we were not able to get it running on a default cluster instance.

We were able to successfully generate reports on a Standalone instance  and a named cluster instance without issues but the default cluster instance was throwing an error " <strong>Login does not exist on SQL Server OR Login is not a member of the Systems Administrator role"</strong>

&nbsp;

We made sure we belonged to the local windows administrator's group on both nodes of the (active/passive) cluster –<strong> both as an individual login and as a member of a domain group.</strong> The AD account was in the SQL sysadmin group too.

We have couple of online forums and blogs suggesting the modification of Engine.ps1 file but they didn't work for us and we ended up with the same error.

Sharing what finally worked for us and allowed us to generate a report

&nbsp;

<strong>Workaround:</strong>

===========
<ol>
 	<li><span style="background: #fcfcfc;margin: 0px;color: #333333;font-family: 'Segoe UI',sans-serif;font-size: 10pt">Open</span><span style="color: #000000;font-family: Calibri"> up the file Engine.ps1 to modify</span></li>
</ol>
<span style="color: #000000;font-family: Calibri">Should be found in %Programdata%\Microsoft\Microsoft Baseline Configuration Analyzer 2\Modules\SQL2012BPA\Engine</span>

<span><span style="font-family: Calibri">2. We added this </span></span><span style="margin: 0px;color: orangered;font-family: 'Lucida Console';font-size: 9pt">$SQLInstanceID =</span><span style="margin: 0px;color: #2e75b6;font-family: 'Lucida Console';font-size: 9pt">”MSSQL11.MSSQLServer” </span><span><span style="font-family: Calibri">just below the line </span></span><span style="margin: 0px;color: orangered;font-family: 'Lucida Console';font-size: 9pt">$SQLInstanceID</span><span style="margin: 0px;font-family: 'Lucida Console';font-size: 9pt"><span style="color: #000000"> </span><span>=</span><span style="color: #000000"> </span><span>$SQLInstallPath</span><span>[</span><span>3</span><span>]</span></span><span><span style="font-family: Calibri"> to make this work.</span></span>

3. Run the Best Practice Analyzer GUI without providing the name of the Instance (leave it blank)

&nbsp;

Hope this  simple solution saves some valuable time for someone attempting to run the BPA on a Default Clustered Instance of SQL 2012

&nbsp;

Solution Credits to <a href="https://www.linkedin.com/in/john-hatricks-a932a134/">John Hatricks </a>for parsing through the Powershell script to find this solution!

&nbsp;

&nbsp;

&nbsp;

&nbsp;

&nbsp;]]></content:encoded>
    </item>
    <item>
      <title>Using REST API to pause Azure SQL Data Warehouse - “Bearer authorization error='invalid_token', error_description='The authentication scheme of not supported”</title>
      <link>https://docs.microsoft.com/archive/blogs/poojakamath/using-rest-api-to-pause-azure-sql-data-warehouse-bearer-authorization-errorinvalid_token-error_descriptionthe-authentication-scheme-of-not-supported</link>
      <pubDate>Sat, 24 Dec 2016 11:24:58 GMT</pubDate>
      <dc:creator><![CDATA[Pooja Kamath]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/poojakamath/?p=845</guid>
      <description><![CDATA[&nbsp; A customer of mine recently approached me for assistance to help resolve an Authorization...]]></description>
      <content:encoded><![CDATA[<p class="MsoNormal" style="margin: 0in 0in 10pt"><span></span>&nbsp;</p> <p class="MsoNormal" style="margin: 0in 0in 10pt"><span>A customer of mine recently approached me for assistance to help resolve an Authorization error he was receiving , when he was running a custom prepared automation script in C# that would pause and restart the SQL data warehouse.</span> </p> <p class="MsoNormal" style="margin: 0in 0in 10pt"><span>To save costs, you can pause and resume compute resources on-demand.&nbsp; </span><span>He had tried the instructions provided here <a><font color="#0563c1">https://azure.microsoft.com/en-in/documentation/articles/sql-data-warehouse-manage-compute-rest-api/</font></a> <span>&nbsp;</span><br><br>The URL created looked like this:<br><a><span style="text-decoration:"><font style="text-decoration: none" color="#000000">https://management.azure.com/subscriptions/&lt;subscription</font></span></a><font color="#000000"> ID&gt;/resourceGroups/&lt;resource group name&gt;/providers/Microsoft.Sql/servers/&lt;servername&gt;.database.windows.net/databases/&lt;dbname&gt;/pause?api-version=2014-04-01-preview+HTTP%2F1.1 <br></font><br>It asked for an Authorization option and he provided the Authorization by following the link. <br><a><font color="#0563c1">https://msdn.microsoft.com/en-IN/library/azure/dn798668.aspx</font></a> <span>&nbsp;</span><br><br>After getting the Authorization key, when he executed the REST API to pause the SQL database from REST client It gave the following error <br><br>“<font color="#ff0000"><b><span><font style="background-color: #ffff00" color="#000000">Bearer authorization</font></span></b>_uri='https://login.windows.net/</font></span><font color="#ff0000">xxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxx</font><span><font color="#ff0000">', <span><font style="background-color: #ffff00" color="#000000">error='<b>invalid_token</b>', error_description='The authentication scheme of</font></span> eyJ0eXAiOiJKV1QiLCJhbGciOiJSUzI1NiIsIng1dCI6Ik1uQ19WWmNBVGZNNXBPWWlKSE1iYTlnb0VLWSIsImtpZCI6Ik1uQ19WWmNBVGZNNXBPWWlKSE1iYTlnb0VLWSJ9.eyJhdWQiOiJodHRwczovL21hbmFnZW1lbnQuYXp1cmUuY29tLyIsImlzcyI6Imh0dHBzOi8vc3RzLndpbmRvd3MubmV0LzY4MjE5NTc0LWZjN2EtNGY0Yy05ZjY5LWYyZDcwMjZkMmY0MC8iLCJpYXQiOjE0Njk3NjU2OTgsIm5iZiI6MTQ2OTc2NTY5OCwiZXhwIjoxNDY5NzY5NTk4LCJhcHBpZCI6IjEyZmQ0MTU1LWU4YTEtNGEyMi1iOTE3LWRiMWE3YzNmYjcyZSIsImFwcGlkYWNyIjoiMSIsImlkcCI6Imh0dHBzOi8vc3RzLndpbmRvd3MubmV0LzY4MjE5NTc0LWZjN2EtNGY0Yy05ZjY5LWYyZDcwMjZkMmY0MC8iLCJvaWQiOiI2YWU3ZjkyMy0xMTBjLTQ3ZDItODg0Yi05M2I5ZmM4OThiMGMiLCJzdWIiOiI2YWU3ZjkyMy0xMTBjLTQ3ZDItODg0Yi05M2I5ZmM4OThiMGMiLCJ0aWQiOiI2ODIxOTU3NC1mYzdhLTRmNGMtOWY2OS1mMmQ3MDI2ZDJmNDAiLCJ2ZXIiOiIxLjAifQ.BfIsC85k4HZTIOnSaM_MqnvJHUJG8eBUhSPxKTm4qgkPQ366DN4chQeNoLIz51Gmd4cxZqcUR7zf8ZCA8iJMe9Per-tTUoyHoYHUqVt07d0HKmsHELEsFuEAveAFZM6jL_3oYHPBOQvmvzrsHnjMxVU2JL7e1_V8j9qADpMi3G1GuimsyQU2ObojhV1FkVOoFJD7p2BaBDOfHRuyJ_r32SIdYc35D7yyrT6lJ7Kdb6ZZrtPFjMaxiecSTe-_nvMD2O6rJBoA_bo2gTaf8nlW6PJIfovGPyvCceqKo1wAMbrPbEpHKJYryfP42v-iz81yr_Y51Ye0teumsmwJdPJKvQ is </font><span><font style="background-color: #ffff00" color="#000000">not supported</font></span>”</span></p> <p class="MsoNormal" style="margin: 0in 0in 10pt"><span>&nbsp;</span></p> <p class="MsoNormal" style="margin: 0in 0in 10pt"><span></span>&nbsp;</p> <p class="MsoNormal" style="margin: 0in 0in 10pt"><b><span>Steps to resolution:</span></b></p> <p class="MsoNormal" style="margin: 0in 0in 10pt"><span>+++++++++++++++++++++++++++++++++</span></p> <p class="MsoNormal" style="margin: 0in 0in 10pt"><span>A simple way of testing whether the REST API calls are working is by using POSTMAN client which is an add-on to Google chrome browser. It is an intuitive user interface that would make testing APIs effortless</span></p> <p class="MsoNormal" style="margin: 0in 0in 10pt"><span>My colleague Suhas recently blogged about using Testing Azure REST API using POSTMAN Client -</span><span> The steps and the screenshots to setup the environment to test the Azure REST API using POSTMAN Client is described very well in his blog <a><font color="#0563c1">https://blogs.msdn.microsoft.com/suhaspv/2016/11/22/geo-replication-fail-over-testing-using-rest-api/</font></a> </span></p> <p class="MsoNormal" style="margin: 0in 0in 10pt"><span>I decided to give this a shot to save time for testing!</span></p> <p class="MsoNormal" style="margin: 0in 0in 10pt"><span>&nbsp;</span></p> <p class="MsoNormal" style="margin: 0in 0in 10pt"><span>&nbsp;</span></p> <p class="MsoNormal" style="margin: 0in 0in 10pt"><span>I was able to test the scenario out using the client (Postman app) and was able to pause and unpause my Azure SQL DW&nbsp; successfully by altering the REST API to our scenario</span></p> <p class="MsoNormal" style="margin: 0in 0in 10pt"><span>I used the </span><span> REST API from the following: <a><font color="#0563c1">https://azure.microsoft.com/en-in/documentation/articles/sql-data-warehouse-manage-compute-rest-api/</font></a> <span>&nbsp;</span></span></p> <p class="MsoNormal" style="margin: 0in 0in 10pt"><span>Rest API calls used: </span></p> <p class="MsoNormal" style="margin: 0in 0in 10pt"><i><span><font color="#c55a11">POST https://management.azure.com/subscriptions/&lt;subscriptionid&gt;/resourceGroups/&lt;resourcegroupname&gt;/providers/Microsoft.Sql/servers/&lt;Dwservername&gt;/databases/&lt;dbname&gt;/resume?api-version=2014-04-01-preview <span>&nbsp;</span></font></span></i></p> <p class="MsoNormal" style="margin: 0in 0in 10pt"><span>&nbsp;</span><i><span><font color="#c55a11">POST https://management.azure.com/subscriptions/&lt;subscriptionid&gt;/resourceGroups/&lt;resourcegroupname&gt;/providers/Microsoft.Sql/servers/&lt;Dwservename&gt;/databases/&lt;dbname&gt;/pause?api-version=2014-04-01-preview </font></span></i></p> <p class="MsoNormal" style="margin: 0in 0in 10pt"><b><span>Note:</span></b><span> I <u><strong>did not</strong></u> use the api-version=2014-04-01-preview HTTP/1.1 as mentioned in the above article as I was getting an error with it. So you may want to try with both to be sure. </span></p> <p class="MsoNormal" style="margin: 0in 0in 10pt"><span>&nbsp;</span></p> <p class="MsoNormal" style="margin: 0in 0in 10pt"><span>&nbsp;</span></p> <p class="MsoNormal" style="margin: 0in 0in 10pt"><span>However my customer was still receiving an error like the below when he tried attempt to generate a Request Token in Postman even though he provided a Manage Service API Access</span></p> <p class="MsoNormal" style="margin: 0in 0in 10pt"><i><span style="color:"><font color="#ff0000">Additional technical information:</font></span></i></p> <p class="MsoNormal" style="margin: 0in 0in 10pt"><i><span style="color:"><font color="#ff0000">Correlation ID: 6e4eda78-e520-496e-b897-0a397d46b325</font></span></i></p> <p class="MsoNormal" style="margin: 0in 0in 10pt"><i><span style="color:"><font color="#ff0000">Timestamp: 2016-08-01 14:03:44Z</font></span></i></p> <p class="MsoNormal" style="margin: 0in 0in 10pt"><i><span style="color:"><font color="#ff0000">TESTAPP90093: This application requires application permissions to another application. Consent for application permissions can only be performed by an administrator. Sign out and sign in as an administrator or contact one of your organization's administrators.</font></span></i></p> <p class="MsoNormal" style="margin: 0in 0in 10pt"><span>&nbsp;</span></p> <p class="MsoNormal" style="margin: 0in 0in 10pt"><span>This error message here was more descriptive than the earlier authorization error and gave us a clear idea that we were missing some admin access.</span></p> <p class="MsoNormal" style="margin: 0in 0in 10pt"><span>&nbsp;</span></p> <p class="MsoNormal" style="margin: 0in 0in 10pt"><span>++ We found that the <u>customer was a Co-Admin on the subscription</u> but was still giving us this error</span></p> <p class="MsoNormal" style="margin: 0in 0in 10pt"><span>We figured that - A subscription co-administrator does not automatically make you an Azure AD administrator and You'd need explicit role grant on the target Azure AD.</span></p> <p class="MsoNormal" style="margin: 0in 0in 10pt"><span>Once the customer was granted <b>Global Administrator in the Azure AD domain</b> he was able to generate the token without the error</span></p> <p class="MsoNormal" style="margin: 0in 0in 10pt"><span>&nbsp;</span></p> <p class="MsoNormal" style="margin: 0in 0in 10pt"><span>After this we were able to successfully Pause/Resume the Azure SQL DW using the calls above.</span></p> <p class="MsoNormal" style="margin: 0in 0in 10pt"><span>More info on different AD roles: <a><font color="#0563c1">https://docs.microsoft.com/en-us/azure/active-directory/active-directory-assign-admin-roles</font></a> </span></p> <p class="MsoNormal" style="margin: 0in 0in 10pt"><span>&nbsp;</span></p> <p class="MsoNormal" style="margin: 0in 0in 10pt"><span>Now that we had it working with the Postman Client the customer was able to use the REST API calls above in his automation script in C#: </span></p> <p class="MsoNormal" style="margin: 0in 0in 10pt"><span>OAuth 2.0 is what we need which is explained in below article <a><font color="#0563c1">https://azure.microsoft.com/en-us/documentation/articles/resource-manager-api-authentication/#connect-subscription-to-application</font></a> </span></p> <p class="MsoNormal" style="margin: 0in 0in 10pt"><span>&nbsp;</span></p> <p class="MsoNormal" style="margin: 0in 0in 10pt"><span>Hope this helps! </span><span style="font-family:"><span><font face="Wingdings">J</font></span></span><span> </span></p> <p class="MsoNormal" style="margin: 0in 0in 10pt"><span>&nbsp;</span></p>]]></content:encoded>
    </item>
    <item>
      <title>Automatically Monitor and Change the service tier and performance level (pricing tier) of an Azure SQL database based on the DTU alert using Webhooks, Alerts, Runbooks</title>
      <link>https://docs.microsoft.com/archive/blogs/poojakamath/automatically-monitor-and-change-the-service-tier-and-performance-level-pricing-tier-of-an-azure-sql-database-based-on-the-dtu-alert-using-webhooks-alerts-runbooks</link>
      <pubDate>Sat, 24 Dec 2016 09:06:47 GMT</pubDate>
      <dc:creator><![CDATA[Pooja Kamath]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/poojakamath/?p=655</guid>
      <description><![CDATA[&nbsp;  We all know how easy it is to change the service tier of an Azure SQL database as the needs...]]></description>
      <content:encoded><![CDATA[<p align="left"><font face="Ebrima">&nbsp; </font> <p align="left"><font face="Ebrima"><font size="3">We all know how easy it is to change the service tier of an Azure SQL database as the needs of your application change using the Azure Portal/PowerShell. </font></font> <p align="left"><font size="3" face="Ebrima">But what if you want to automate the upgrade and the downgrade of your database? </font> <p align="left"><font size="3" face="Ebrima">And, what if you have many databases and don’t want to be individually monitoring the DTU usage and then have to manually fire an upgrade? </font> <p align="left"><font size="3" face="Ebrima">You can achieve this using Azure Automation!&nbsp; Recently introduced as a public preview service, Azure Automation brings a powerful, much needed PowerShell Workflow execution service to the Azure platform. </font> <p align="left"><font size="4" face="Ebrima"><font size="3">In this blog, I’ll show you how to leverage the Azure Automation service <b>combined with Alerts and Webhook</b>s to accomplish a customer requested scenario- (To automatically scale up the DTU’s of the database only if there is a resource crunch)</font> </font> <p align="left"><font face="Ebrima"><b><u><font size="5">Step 1: Create your Automation Account:</font></u></b> </font> <p align="left"><font face="Ebrima">To do the Automation you have to create an automation account </font></p> <p align="left"> <table cellspacing="0" cellpadding="0" width="312" border="1"> <tbody> <tr> <td valign="top" width="139"> <p><font size="5"><a href="https://msdnshared.blob.core.windows.net/media/2016/12/clip_image0015.png"><font face="Ebrima"><img title="clip_image001" style="border-left-width: 0px;border-right-width: 0px;border-bottom-width: 0px;padding-top: 0px;padding-left: 0px;padding-right: 0px;border-top-width: 0px" border="0" alt="clip_image001" src="https://msdnshared.blob.core.windows.net/media/2016/12/clip_image001_thumb5.png" width="160" height="427"></font></a></p></font></td> <td valign="top" width="171"> <p><a href="https://msdnshared.blob.core.windows.net/media/2016/12/clip_image0032.jpg"><font face="Ebrima"><img title="clip_image003" style="border-left-width: 0px;border-right-width: 0px;border-bottom-width: 0px;padding-top: 0px;padding-left: 0px;padding-right: 0px;border-top-width: 0px" border="0" alt="clip_image003" src="https://msdnshared.blob.core.windows.net/media/2016/12/clip_image003_thumb1.jpg" width="352" height="526"></font></a></p></td></tr></tbody></table></p></font> <p align="left"><font face="Ebrima">Add the details for your Automation account and proceed </font></p><a href="https://msdnshared.blob.core.windows.net/media/2016/12/clip_image0056.jpg"> <p align="left"><font face="Ebrima"><a href="https://msdnshared.blob.core.windows.net/media/2016/12/clip_image0057.jpg"><img title="clip_image005" style="border-top: 0px;border-right: 0px;border-bottom: 0px;padding-top: 0px;padding-left: 0px;border-left: 0px;padding-right: 0px" border="0" alt="clip_image005" src="https://msdnshared.blob.core.windows.net/media/2016/12/clip_image005_thumb3.jpg" width="236" height="326"></a></font></a><font face="Ebrima"> </font></p> <p align="left"><font face="Ebrima"><b><u>Step 2: Create a Runbook under the Automation account you created</u></b> </font></p><a href="https://msdnshared.blob.core.windows.net/media/2016/12/clip_image0075.jpg"> <p align="left"><font face="Ebrima"><a href="https://msdnshared.blob.core.windows.net/media/2016/12/clip_image0076.jpg"><img title="clip_image007" style="border-top: 0px;border-right: 0px;border-bottom: 0px;padding-top: 0px;padding-left: 0px;border-left: 0px;padding-right: 0px" border="0" alt="clip_image007" src="https://msdnshared.blob.core.windows.net/media/2016/12/clip_image007_thumb2.jpg" width="507" height="432"></a></font></a><font face="Ebrima"> </font></p> <ul> <li> <div align="left"><font face="Ebrima">Click on the Add a runbook button and then Create a new runbook with the Type “Powershell Workflow”</font></div></li></ul><a href="https://msdnshared.blob.core.windows.net/media/2016/12/clip_image0096.jpg"> <p align="left"><font face="Ebrima"><a href="https://msdnshared.blob.core.windows.net/media/2016/12/clip_image0097.jpg"><img title="clip_image009" style="border-top: 0px;border-right: 0px;border-bottom: 0px;padding-top: 0px;padding-left: 0px;border-left: 0px;padding-right: 0px" border="0" alt="clip_image009" src="https://msdnshared.blob.core.windows.net/media/2016/12/clip_image009_thumb3.jpg" width="596" height="271"></a></font></p></a> <p align="left"><a href="https://msdnshared.blob.core.windows.net/media/2016/12/clip_image0101.png"><font face="Ebrima"><img title="clip_image010" style="border-left-width: 0px;border-right-width: 0px;border-bottom-width: 0px;padding-top: 0px;padding-left: 0px;padding-right: 0px;border-top-width: 0px" border="0" hspace="12" alt="clip_image010" src="https://msdnshared.blob.core.windows.net/media/2016/12/clip_image010_thumb.png" width="265" height="377"></font></a><font face="Ebrima"> </font></p> <ul> <li> <div align="left"><font face="Ebrima">Copy the UpdateSLO script from the below link (taken from the Powershell script gallery) to the run book. </font></div> <li> <div align="left"><font face="Ebrima">Save the run book after this.</font></div></li></ul> <p align="left"><a href="https://gallery.technet.microsoft.com/scriptcenter/Azure-SQL-Database-e957354f"><font face="Ebrima">https://gallery.technet.microsoft.com/scriptcenter/Azure-SQL-Database-e957354f</font></a><font face="Ebrima"> </font></p><a href="https://msdnshared.blob.core.windows.net/media/2016/12/clip_image01229.jpg"> <p align="left"><font face="Ebrima"><a href="https://msdnshared.blob.core.windows.net/media/2016/12/clip_image01230.jpg"><img title="clip_image012" style="border-top: 0px;border-right: 0px;border-bottom: 0px;padding-top: 0px;padding-left: 0px;border-left: 0px;padding-right: 0px" border="0" alt="clip_image012" src="https://msdnshared.blob.core.windows.net/media/2016/12/clip_image012_thumb7.jpg" width="664" height="479"></a></font></a><font face="Ebrima"> </font></p> <p align="left"><font face="Ebrima">&nbsp; </font> <ul> <li> <div align="left"><font face="Ebrima"><b><u>Create a credential </u></b>with the server admin user and password like the one mentioned in the below screenshot.<b></b></font></div></li></ul> <p align="left"><a href="https://msdnshared.blob.core.windows.net/media/2016/12/clip_image013.png"><font face="Ebrima"><img title="clip_image013" style="border-left-width: 0px;border-right-width: 0px;border-bottom-width: 0px;padding-top: 0px;padding-left: 0px;padding-right: 0px;border-top-width: 0px" border="0" alt="clip_image013" src="https://msdnshared.blob.core.windows.net/media/2016/12/clip_image013_thumb.png" width="286" height="240"></font></a></p> <p align="left"><a href="https://msdnshared.blob.core.windows.net/media/2016/12/clip_image0151.jpg"><font face="Ebrima"><img title="clip_image015" style="border-left-width: 0px;border-right-width: 0px;border-bottom-width: 0px;padding-top: 0px;padding-left: 0px;padding-right: 0px;border-top-width: 0px" border="0" alt="clip_image015" src="https://msdnshared.blob.core.windows.net/media/2016/12/clip_image015_thumb1.jpg" width="361" height="267"></font></a><font face="Ebrima"> </font></p> <ul> <li> <div align="left"><font face="Ebrima">Add a credential</font></div></li></ul> <p align="left"><a href="https://msdnshared.blob.core.windows.net/media/2016/12/clip_image0161.png"><font face="Ebrima"><img title="clip_image016" style="border-left-width: 0px;border-right-width: 0px;border-bottom-width: 0px;padding-top: 0px;padding-left: 0px;padding-right: 0px;border-top-width: 0px" border="0" alt="clip_image016" src="https://msdnshared.blob.core.windows.net/media/2016/12/clip_image016_thumb1.png" width="457" height="85"></font></a></p> <ul> <li> <div align="left"><font face="Ebrima">Fill in the details/ description for the New Credential</font></div></li></ul> <p align="left"><a href="https://msdnshared.blob.core.windows.net/media/2016/12/clip_image0176.png"><font face="Ebrima"><img title="clip_image017" style="border-left-width: 0px;border-right-width: 0px;border-bottom-width: 0px;padding-top: 0px;padding-left: 0px;padding-right: 0px;border-top-width: 0px" border="0" alt="clip_image017" src="https://msdnshared.blob.core.windows.net/media/2016/12/clip_image017_thumb1.png" width="342" height="431"></font></a></p> <ul> <li> <div align="left"><font face="Ebrima">Publish the Runbook once you have created the credential</font></div></li></ul> <p align="left"><a href="https://msdnshared.blob.core.windows.net/media/2016/12/clip_image0191.jpg"><font face="Ebrima"><img title="clip_image019" style="border-left-width: 0px;border-right-width: 0px;border-bottom-width: 0px;padding-top: 0px;padding-left: 0px;padding-right: 0px;border-top-width: 0px" border="0" alt="clip_image019" src="https://msdnshared.blob.core.windows.net/media/2016/12/clip_image019_thumb1.jpg" width="553" height="150"></font></a></p> <p align="left"><font face="Ebrima">You may receive an error message like the below if you haven’t change the workflow name </font> <p align="left"><a href="https://msdnshared.blob.core.windows.net/media/2016/12/clip_image0201.png"><font face="Ebrima"><img title="clip_image020" style="border-left-width: 0px;border-right-width: 0px;border-bottom-width: 0px;padding-top: 0px;padding-left: 0px;padding-right: 0px;border-top-width: 0px" border="0" alt="clip_image020" src="https://msdnshared.blob.core.windows.net/media/2016/12/clip_image020_thumb1.png" width="364" height="72"></font></a><font face="Ebrima"> </font></p> <p align="left"><font face="Ebrima">Make sure the <u>Workflow name in the script</u> reflects the name of the runbook you created earlier to avoid the above error </font> <p align="left"><a href="https://msdnshared.blob.core.windows.net/media/2016/12/clip_image021.png"><font face="Ebrima"><img title="clip_image021" style="border-left-width: 0px;border-right-width: 0px;border-bottom-width: 0px;padding-top: 0px;padding-left: 0px;padding-right: 0px;border-top-width: 0px" border="0" alt="clip_image021" src="https://msdnshared.blob.core.windows.net/media/2016/12/clip_image021_thumb.png" width="351" height="147"></font></a><font face="Ebrima"> </font></p> <p align="left"><font face="Ebrima"></font>&nbsp;</p> <p align="left"><font face="Ebrima"></font>&nbsp;</p> <p align="left"><b><u><font face="Ebrima"></font></u></b> <p align="left"><font face="Ebrima"><b><u><font size="5">Step 3: Create a new Webhook</font></u></b> </font> <p align="left"><font face="Ebrima">&amp; copy the Webhook URL after the creation (Save it on a notepad for later use) </font> <p align="left"><font face="Ebrima">Webhooks allow you to route an Azure alert notification to other systems for post-processing or custom actions. </font> <p align="left"><a href="https://msdnshared.blob.core.windows.net/media/2016/12/clip_image023.jpg"><font face="Ebrima"><img title="clip_image023" style="border-left-width: 0px;border-right-width: 0px;border-bottom-width: 0px;padding-top: 0px;padding-left: 0px;padding-right: 0px;border-top-width: 0px" border="0" alt="clip_image023" src="https://msdnshared.blob.core.windows.net/media/2016/12/clip_image023_thumb.jpg" width="457" height="368"></font></a><font face="Ebrima"> </font></p> <ul> <li> <div align="left"><font face="Ebrima">Create the new Webhook</font></div></li></ul> <p align="left"><a href="https://msdnshared.blob.core.windows.net/media/2016/12/clip_image0252.jpg"><font face="Ebrima"><img title="clip_image025" style="border-left-width: 0px;border-right-width: 0px;border-bottom-width: 0px;padding-top: 0px;padding-left: 0px;padding-right: 0px;border-top-width: 0px" border="0" alt="clip_image025" src="https://msdnshared.blob.core.windows.net/media/2016/12/clip_image025_thumb2.jpg" width="221" height="559"></font></a></p> <p align="left"><font face="Ebrima">Edit the parameters of the Webhook to reflect <u>the SQL Server name and the Database name</u> we are configuring this for. </font> <p align="left"><font face="Ebrima"><u>Use the Credential</u> we configured earlier in the Credential tab. </font> <p align="left"><font face="Ebrima">&nbsp; </font> <ul> <li> <div align="left"><font face="Ebrima">I have a database that is usually in the Basic Edition and I would like to scale it to S1 when the DTU goes above 70% so I fill in the Edition parameter to Standard and PerfLevel to S0 </font></div> <li> <div align="left"><font face="Ebrima">You can choose from the following based on your requirement</font></div></li></ul> <p align="left"><font color="#0000ff" face="Ebrima">Edition: Basic, Standard, Premium<br>PerfLevel: Basic, S0, S1, S2, P1, P2, P3</font></p> <p align="left"><a href="https://msdnshared.blob.core.windows.net/media/2016/12/clip_image02614.png"><font face="Ebrima"><img title="clip_image026" style="border-left-width: 0px;border-right-width: 0px;border-bottom-width: 0px;padding-top: 0px;padding-left: 0px;padding-right: 0px;border-top-width: 0px" border="0" alt="clip_image026" src="https://msdnshared.blob.core.windows.net/media/2016/12/clip_image026_thumb1.png" width="236" height="467"></font></a><font face="Ebrima"> </font></p> <p align="left"><font face="Ebrima">· You can run a test (Which will not actually scale up the database, but will check if the workflow has any errors) </font> <p align="left"><a href="https://msdnshared.blob.core.windows.net/media/2016/12/clip_image027.png"><font face="Ebrima"><img title="clip_image027" style="border-left-width: 0px;border-right-width: 0px;border-bottom-width: 0px;padding-top: 0px;padding-left: 0px;padding-right: 0px;border-top-width: 0px" border="0" alt="clip_image027" src="https://msdnshared.blob.core.windows.net/media/2016/12/clip_image027_thumb.png" width="651" height="519"></font></a><font face="Ebrima"> </font></p> <p align="left"><font face="Ebrima"><b><u><font size="5">Step 3: Configuring the Alert to call the Webhook we created:</font></u></b> </font> <p align="left"><font face="Ebrima">Now that we have our Webhook configured with the Runbook and we have tested it, we will need to configure an Alert to be able to call the webhook when it triggers due a condition being met. </font> <blockquote> <p align="left"><font face="Ebrima">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; You can configure an alert to do the following when it triggers: </font></p></blockquote> <blockquote> <p align="left"><font face="Ebrima">·<em> send email notifications to the service administrator and co-administrators</em></font></p></blockquote> <blockquote> <p align="left"><em><font face="Ebrima">· send email to additional emails that you specify.</font></em></p></blockquote> <blockquote> <p align="left"><em><font face="Ebrima">· <b>call a webhook </b></font></em></p></blockquote> <blockquote> <p align="left"><em><font face="Ebrima">· start execution of an Azure runbook (only from the Azure portal)</font></em></p></blockquote> <p align="left"><font face="Ebrima">The steps to Configure an alert from the Portal are documented here : </font><a href="https://docs.microsoft.com/en-in/azure/monitoring-and-diagnostics/insights-alerts-portal"><font face="Ebrima">https://docs.microsoft.com/en-in/azure/monitoring-and-diagnostics/insights-alerts-portal</font></a><font face="Ebrima"> </font> <p align="left"><font face="Ebrima">The only <u>difference would be to include the Webhook URL</u> in this alert that we have configured. </font> <p align="left"><font face="Ebrima">You can also edit an already existing alert and add the Web hook URL to it </font> <p align="left"><a href="https://msdnshared.blob.core.windows.net/media/2016/12/clip_image0286.png"><font face="Ebrima"><img title="clip_image028" style="border-left-width: 0px;border-right-width: 0px;border-bottom-width: 0px;padding-top: 0px;padding-left: 0px;padding-right: 0px;border-top-width: 0px" border="0" alt="clip_image028" src="https://msdnshared.blob.core.windows.net/media/2016/12/clip_image028_thumb1.png" width="443" height="596"></font></a><font face="Ebrima"> </font></p> <p align="left"><font face="Ebrima">&nbsp; </font> <ul> <li> <div align="left"><font face="Ebrima">You can check the status of the Runbook Job and will be able to see that it is Queued as we haven’t specified a schedule:</font></div></li></ul> <p align="left"><a href="https://msdnshared.blob.core.windows.net/media/2016/12/clip_image029.png"><font face="Ebrima"><img title="clip_image029" style="border-left-width: 0px;border-right-width: 0px;border-bottom-width: 0px;padding-top: 0px;padding-left: 0px;padding-right: 0px;border-top-width: 0px" border="0" alt="clip_image029" src="https://msdnshared.blob.core.windows.net/media/2016/12/clip_image029_thumb.png" width="391" height="289"></font></a></p> <blockquote> <p align="left"><b><u><font size="5" face="Ebrima">Step 4: Testing the configured Alert, Webhook and Runbook</font></u></b></p></blockquote> <blockquote> <p align="left"><font face="Ebrima">Now let’s test a scenario to check if this works as expected </font> <p align="left"><font face="Ebrima">I run a test workload to increase the resource utilization of my database for which we have configured the DTU alert on</font></p></blockquote> <p align="left"><a href="https://msdnshared.blob.core.windows.net/media/2016/12/clip_image0306.png"><font face="Ebrima"><img title="clip_image030" style="border-left-width: 0px;border-right-width: 0px;border-bottom-width: 0px;padding-top: 0px;padding-left: 0px;padding-right: 0px;border-top-width: 0px" border="0" alt="clip_image030" src="https://msdnshared.blob.core.windows.net/media/2016/12/clip_image030_thumb1.png" width="412" height="360"></font></a><font face="Ebrima"> </font></p> <ul> <li> <div align="left"><font face="Ebrima">Monitoring the alert I see that the DTU usage is steadily increasing, until it triggers the alert once the condition is met</font></div></li></ul> <p align="left"><font face="Ebrima">(DTU threshold greater than 60% for the last 5 minutes) </font> <p align="left"><a href="https://msdnshared.blob.core.windows.net/media/2016/12/clip_image0311.png"><font face="Ebrima"><img title="clip_image031" style="border-left-width: 0px;border-right-width: 0px;border-bottom-width: 0px;padding-top: 0px;padding-left: 0px;padding-right: 0px;border-top-width: 0px" border="0" alt="clip_image031" src="https://msdnshared.blob.core.windows.net/media/2016/12/clip_image031_thumb1.png" width="501" height="147"></font></a><font face="Ebrima"> </font></p> <ul> <li> <div align="left"><font face="Ebrima">Now that the alert has triggered, it should have called the Webhook to start the execution of the Runbook. </font></div> <li> <div align="left"><font face="Ebrima">Let’s check the Database blade in the Azure Portal to see if upgrade has indeed started</font></div></li></ul> <p align="left"><font face="Ebrima"></font>&nbsp;</p> <p align="left"><font face="Ebrima">You can see that the SLO upgrade has automatically kicked in and it has already begun to upgrade the database from Basic to the S0 we had configured </font> <p align="left"><a href="https://msdnshared.blob.core.windows.net/media/2016/12/clip_image0327.png"><font face="Ebrima"><img title="clip_image032" style="border-left-width: 0px;border-right-width: 0px;border-bottom-width: 0px;padding-top: 0px;padding-left: 0px;padding-right: 0px;border-top-width: 0px" border="0" alt="clip_image032" src="https://msdnshared.blob.core.windows.net/media/2016/12/clip_image032_thumb2.png" width="488" height="242"></font></a><font face="Ebrima"> </font></p> <p align="left"><font face="Ebrima">&nbsp; </font> <p align="left"><font face="Ebrima">You can also check the Job status from the Runbook blade </font> <ul> <li> <div align="left"><font face="Ebrima">In the Azure portal, select Automation and then then click the name of your automation account. </font></div> <li> <div align="left"><font face="Ebrima">Select the Runbooks tab. </font></div> <li> <div align="left"><font face="Ebrima">Click your runbook to open its Runbook blade to check if it is running.</font></div></li></ul> <p align="left"><a href="https://msdnshared.blob.core.windows.net/media/2016/12/clip_image034.jpg"><font face="Ebrima"><img title="clip_image034" style="border-left-width: 0px;border-right-width: 0px;border-bottom-width: 0px;padding-top: 0px;padding-left: 0px;padding-right: 0px;border-top-width: 0px" border="0" alt="clip_image034" src="https://msdnshared.blob.core.windows.net/media/2016/12/clip_image034_thumb.jpg" width="490" height="370"></font></a></p> <ul> <li> <div align="left"><font face="Ebrima">Monitor it to completion</font></div></li></ul> <p align="left"><a href="https://msdnshared.blob.core.windows.net/media/2016/12/clip_image035.png"><font face="Ebrima"><img title="clip_image035" style="border-left-width: 0px;border-right-width: 0px;border-bottom-width: 0px;padding-top: 0px;padding-left: 0px;padding-right: 0px;border-top-width: 0px" border="0" alt="clip_image035" src="https://msdnshared.blob.core.windows.net/media/2016/12/clip_image035_thumb.png" width="485" height="303"></font></a></p> <ul> <li> <div align="left"><font face="Ebrima">You can see that the database is now in S0 Standard </font></div></li></ul> <p align="left"><a href="https://msdnshared.blob.core.windows.net/media/2016/12/clip_image036.png"><font face="Ebrima"><img title="clip_image036" style="border-left-width: 0px;border-right-width: 0px;border-bottom-width: 0px;padding-top: 0px;padding-left: 0px;padding-right: 0px;border-top-width: 0px" border="0" alt="clip_image036" src="https://msdnshared.blob.core.windows.net/media/2016/12/clip_image036_thumb.png" width="403" height="486"></font></a></p> <ul> <li> <div align="left"><font face="Ebrima">If you want to keep a track of when you database was upgraded based on the Alert trigger you can check the Activity log from the Database blade in the Azure Portal.</font></div></li></ul> <p align="left"><font face="Ebrima">In this example I have filtered this for activity from the last one hour only. </font> <p align="left"><a href="https://msdnshared.blob.core.windows.net/media/2016/12/clip_image038.jpg"><font face="Ebrima"><img title="clip_image038" style="border-left-width: 0px;border-right-width: 0px;border-bottom-width: 0px;padding-top: 0px;padding-left: 0px;padding-right: 0px;border-top-width: 0px" border="0" alt="clip_image038" src="https://msdnshared.blob.core.windows.net/media/2016/12/clip_image038_thumb.jpg" width="695" height="407"></font></a><font face="Ebrima"> </font></p> <blockquote> <p align="left"><font face="Ebrima">Now you do not have to worry about monitoring your Alert emails and then taking a reactive action of upgrading your database.</font></p></blockquote> <blockquote> <p align="left"><font face="Ebrima">The Webhooks allows you to route the High DTU utilization Azure alert notification to use the Runbook with the configured Powershell script to take action when the condition is triggered even when you are fast asleep or vacationing away!<br>Hope this helps!&nbsp; <img class="wlEmoticon wlEmoticon-smile" style="border-top-style: none;border-bottom-style: none;border-right-style: none;border-left-style: none" alt="Smile" src="https://msdnshared.blob.core.windows.net/media/2016/12/wlEmoticon-smile5.png"></font></p></blockquote> <p align="left"><font face="Ebrima"></font></p>]]></content:encoded>
    </item>
    <item>
      <title>Could not obtain exclusive lock on database 'model'. Retry the operation later. CREATE DATABASE failed</title>
      <link>https://docs.microsoft.com/archive/blogs/poojakamath/could-not-obtain-exclusive-lock-on-database-model-retry-the-operation-later-create-database-failed</link>
      <pubDate>Tue, 23 Dec 2014 23:02:18 GMT</pubDate>
      <dc:creator><![CDATA[Pooja Kamath]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/poojakamath/2014/12/23/could-not-obtain-exclusive-lock-on-database-model-retry-the-operation-later-create-database-failed/</guid>
      <description><![CDATA[After installing a SQL server 2008 R2 instance SQL_SERVER\MSSQLSERVER2008R2 side by side on the Box...]]></description>
      <content:encoded><![CDATA[<p>After installing a SQL server 2008 R2 instance SQL_SERVER\MSSQLSERVER2008R2 side by side on the Box which already has SQL 2005 production instance, we are unable to create a database from the management studio
</p><p>
 </p><p>Receiving the below error
</p><p>
 </p><p><span style="color:#002060"><strong><em>Create failed for Database 'x'.  (Microsoft.SqlServer.Smo)
</em></strong></span></p><p><span style="color:#002060"><strong><em>------------------------------
</em></strong></span></p><p><span style="color:#002060"><strong><em>ADDITIONAL INFORMATION:
</em></strong></span></p><p><span style="color:#002060"><strong><em>An exception occurred while executing a Transact-SQL statement or batch. (Microsoft.SqlServer.ConnectionInfo)
</em></strong></span></p><p><span style="color:#002060"><strong><em>------------------------------
</em></strong></span></p><p><span style="color:#002060"><strong><em>Could not obtain exclusive lock on database 'model'. Retry the operation later.
</em></strong></span></p><p><span style="color:#002060"><strong><em>CREATE DATABASE failed. Some file names listed could not be created. Check related errors. (Microsoft SQL Server, Error: 1807)
</em></strong></span></p><p>
 </p><p><span style="color:black; font-family:Tahoma; font-size:16pt; text-decoration:underline"><strong>Cause:
</strong></span></p><p><span style="color:black; font-family:Tahoma"><span style="font-size:10pt">By design when we create a database we need exclusive lock on model. When SQL Server creates a new database, "The SQL Server uses a copy of the model database to initialize the database and its metadata". Also, users could create, modify, and drop objects in the Model database. As such, it is important to exclusively lock the model database to prevent copying the data in change from the Model database. Otherwise, there is no guarantee that the content copied from the Model database are consistent and valid.</span><span style="font-size:12pt">
			</span></span></p><ul><li><div><span style="color:black; font-family:Tahoma"><span style="font-size:10pt">We need to check what is taking the lock on model database</span><span style="font-size:12pt">
					</span></span></div><p>
 </p></li><li><div><span style="color:black; font-family:Tahoma"><span style="font-size:10pt">We ran sp_who2 and found a couple of spids using model with .Net SQLClient Data Provider" as the application</span><span style="font-size:12pt">
					</span></span></div><p>
 </p></li><li><div><span style="color:black; font-family:Tahoma"><span style="font-size:10pt">According to <a href="http://blog.sqlauthority.com/2010/01/01/sql-server-fix-error-1807-could-not-obtain-exclusive-lock-on-database-model-retry-the-operation-later/"><span style="color:#0d70a9">http://blog.sqlauthority.com/2010/01/01/sql-server-fix-error-1807-could-not-obtain-exclusive-lock-on-database-model-retry-the-operation-later/</span></a>  - we tried to Disconnect and Reconnect your SQL Server Management Studio's session. Your error will go away.<br/>But this wasn't working for us.</span><span style="font-size:12pt">
					</span></span></div><p>
 </p><p>
 </p></li><li><div><span style="color:black"><span style="font-family:Tahoma; font-size:10pt">Checked the other basic things<br/>-SQL startup account was Local System<br/>-We had permissions on the folder<br/>-Same file names were not being used<br/>--They have 6.36TB free in the drive where we create the database.</span><span style="color:red">
					</span></span></div><p>
 </p></li><li><span style="color:black; font-family:Tahoma"><span style="font-size:10pt">We also found that in order to create a database on the SQL 2005 prod instance we need to turn off SQL 2008 instance (Strange!)</span><span style="font-size:12pt">
				</span></span></li></ul><p>
 </p><p><span style="color:black; font-family:Tahoma"><span style="font-size:12pt">#</span><span style="font-size:10pt">---How to identity:
</span></span></p><p><span style="font-family:Consolas; font-size:9pt"><span style="color:blue">Use</span>
			<span style="color:blue">master</span>
		</span></p><p><span style="font-family:Consolas; font-size:9pt">
			<span style="color:blue">GO</span>
		</span></p><p><span style="font-family:Consolas; font-size:9pt">
			<span style="color:blue">IF</span>
			<span style="color:gray">EXISTS(<span style="color:blue">SELECT</span> request_session_id  <span style="color:blue">FROM</span>
				<span style="color:green">sys<span style="color:gray">.<span style="color:green">dm_tran_locks</span>
					</span></span></span></span></p><p><span style="font-family:Consolas; font-size:9pt">
			<span style="color:blue">WHERE</span> resource_database_id <span style="color:gray">=</span>
			<span style="color:fuchsia">DB_ID<span style="color:gray">(<span style="color:red">'Model'<span style="color:gray">))</span>
					</span></span></span></span></p><p><span style="font-family:Consolas; font-size:9pt">
			<span style="color:blue">PRINT</span>
			<span style="color:red">'Model Database being used by some other session'</span>
		</span></p><p><span style="font-family:Consolas; font-size:9pt">
			<span style="color:blue">ELSE</span>
		</span></p><p><span style="font-family:Consolas; font-size:9pt">
			<span style="color:blue">PRINT</span>
			<span style="color:red">'Model Database not used by other session'
</span></span></p><p><span style="color:black; font-family:Tahoma; font-size:10pt">  <br/>-----You can identify what kind of statement being used by the session...using the script given below
</span></p><p>  
 </p><p><span style="font-family:Consolas; font-size:9pt"><span style="color:blue">SELECT</span> request_session_id  <span style="color:blue">FROM</span>
			<span style="color:green">sys<span style="color:gray">.<span style="color:green">dm_tran_locks</span>
				</span></span></span></p><p><span style="font-family:Consolas; font-size:9pt">
			<span style="color:blue">WHERE</span> resource_database_id <span style="color:gray">=</span>
			<span style="color:fuchsia">DB_ID<span style="color:gray">(<span style="color:red">'Model'<span style="color:gray">)
</span></span></span></span></span></p><p><span style="color:black; font-family:Tahoma; font-size:10pt">-------We have to identity what kind of query/activity being performed by this session(52).
</span></p><p><span style="color:black"><span style="font-family:Tahoma; font-size:10pt">  </span><span style="font-family:Consolas; font-size:9pt"><span style="color:blue">DBCC</span> InputBuffer<span style="color:gray">(</span>52<span style="color:gray">)</span>
			</span></span><span style="font-family:Consolas; font-size:9pt">
		</span></p><p>
 </p><p><span style="color:black"><span style="font-family:Tahoma; font-size:10pt">----EventInfo column returns the query performed, Based on that, you have to decide whether the Session ID(52) can be Aborted/ Not. If you want to abort the session (52),<br/>run the command <br/>   </span><span style="font-family:Consolas; font-size:9pt"><span style="color:blue">Kill</span> 52 
</span></span></p><p><span style="color:black; font-family:Tahoma; font-size:10pt">--Now immediately create a database (Before another application takes a lock)  
</span></p><p><span style="color:black; font-family:Tahoma; font-size:13pt; text-decoration:underline"><strong>Resolution
</strong></span></p><p><span style="color:black; font-family:Tahoma"><span style="font-size:10pt">From the sp_who2 output we see that the login XLOGIN\Administrator  is continually querying the model database which in turn is not allowing us to get an exclusive lock on the database                 <br/>    <br/>SPID  Status                         Login                                HostName   BlkBy DBName Command          CPUTime DiskIO LastBatch      ProgramName                                    SPID  REQUESTID<br/>----- ------------------------------ ------------------------------------ ---------- ----- ------ ---------------- ------- ------ -------------- ---------------------------------------------- ----- ---------<br/>   <br/>51    sleeping                       XLOGIN\Administrator                   SQL_SERVER   .   master AWAITING COMMAND 0       0      08/06 11:48:37 .Net SqlClient Data Provider                   51    0    <br/>52    sleeping                       XLOGIN\Administrator                   SQL_SERVER   .   tempdb AWAITING COMMAND 0       0      08/06 11:48:37 .Net SqlClient Data Provider                   52    0    <br/>53    sleeping                       XLOGIN\Administrator                   SQL_SERVER   .   msdb   AWAITING COMMAND 0       0      08/06 11:48:37 .Net SqlClient Data Provider                   53    0    <br/>54    sleeping                       XLOGIN\Administrator                   SQL_SERVER   .   tempdb AWAITING COMMAND 16      0      08/06 11:46:25 .Net SqlClient Data Provider                   54    0    <br/>55    sleeping                       XLOGIN\Administrator                   SQL_SERVER   .   model  AWAITING COMMAND 16      0      08/06 11:47:31 .Net SqlClient Data Provider                   55    0    <br/>56    sleeping                       XLOGIN\Administrator                   SQL_SERVER   .   model  AWAITING COMMAND 0       0      08/06 11:46:25 .Net SqlClient Data Provider                   56    0    <br/>57    sleeping                       XLOGIN\Administrator                   SQL_SERVER   .   model  AWAITING COMMAND 0       0      08/06 11:45:19 .Net SqlClient Data Provider </span><span style="font-size:12pt">
			</span></span></p><ul><li><div><span style="color:black; font-family:Tahoma; font-size:10pt">From the input buffer we see the following every time we checked a spid
</span></div><p><span style="color:#002060; font-family:Tahoma; font-size:10pt"><em>Select cat.name as [Name] FROM sys.fulltext_catalogs AS cat ORDER BY [Name] Asc
</em></span></p><p>
 </p><p>
 </p></li><li><span style="color:black; font-family:Tahoma; font-size:10pt">What was strange was that we did not have Full text Search Service running at all. In fact it isn't installed for SQL 2008R2
</span></li></ul><p><span style="color:black; font-family:Tahoma; font-size:10pt">There are numerous articles one can find online about this issue, that suggest killing the spid that is taking the lock on the model database. This works for us too, however the solution is <span style="text-decoration:underline">temporary</span>.  
</span></p><p><span style="color:black; font-family:Tahoma; font-size:10pt">If I kill the process, in about a minute, it automatically starts up the very same Select statement again ,which was strange!
</span></p><p>
 </p><p><span style="color:black; font-family:Tahoma; font-size:10pt"><strong>So we dropped and recreated the login XLOGIN\Administrator and the issue hasn't occurred after this</strong>. Querying the sp_who2 output doesn't show us the Select statement that was earlier taking the lock.
</span></p><p><span style="color:black; font-size:10pt"><span style="font-family:Tahoma">Hope this simple resolution helps someone who is facing the same issue! </span><span style="font-family:Wingdings">J</span><span style="font-family:Tahoma">              </span></span></p>]]></content:encoded>
    </item>
    <item>
      <title>There is insufficient system memory in resource pool 'internal' to run this query. Error: 701, Severity: 17, State: 123" on SSB Target Server - CACHESTORE_BROKERTO is consuming memory</title>
      <link>https://docs.microsoft.com/archive/blogs/poojakamath/there-is-insufficient-system-memory-in-resource-pool-internal-to-run-this-query-error-701-severity-17-state-123-on-ssb-target-server-cachestore_brokerto-is-consuming-memory</link>
      <pubDate>Tue, 23 Dec 2014 21:58:39 GMT</pubDate>
      <dc:creator><![CDATA[Pooja Kamath]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/poojakamath/2014/12/23/there-is-insufficient-system-memory-in-resource-pool-internal-to-run-this-query-error-701-severity-17-state-123-on-ssb-target-server-cachestore_brokerto-is-consuming-memory/</guid>
      <description><![CDATA[I recently worked with a customer where the Target server for his Service broker application...]]></description>
      <content:encoded><![CDATA[<p>I recently worked with a customer where the Target server for his Service broker application encounters "<strong>There is insufficient system memory in resource pool 'internal' to run this query. Error: 701, Severity: 17, State: 123</strong>" 
</p><p>CACHESTORE_BROKERTO was consuming about 18 GB of RAM and SQL server is running out of memory.
</p><p>
 </p><p>Environment:
</p><p>==================
</p><p><strong>SQL:</strong> Microsoft SQL Server 2012 - 11.0.5556.0 (X64) 
</p><p><strong>OS:</strong> Microsoft Corporation Standard Edition (64-bit) on Windows NT 6.2 &lt;X64&gt; (Build 9200 )
</p><p>Max server memory is capped to 26GB out of 32 GB 
</p><p>SQL server is the Target server for a Service broker application. 
</p><p>This is also the Principal server for mirroring configured on the same database.
</p><p>
 </p><ul style="margin-left: 72pt"><li>From the DBCC memory status we see
</li></ul><div><table style="border-collapse:collapse" border="0"><colgroup><col style="width:623px"/></colgroup><tbody valign="top"><tr><td style="padding-left: 7px; padding-right: 7px; border-top:  solid 0.5pt; border-left:  solid 0.5pt; border-bottom:  solid 0.5pt; border-right:  solid 0.5pt"><p>
 </p><p><em>MEMORYCLERK_SQLBUFFERPOOL (Total)        KB
</em></p><p><em>---------------------------------------- -----------
</em></p><p><em>VM Reserved                              841608
</em></p><p><em>VM Committed                             32768
</em></p><p><em>Locked Pages Allocated                   172488
</em></p><p><em>SM Reserved                              0
</em></p><p><em>SM Committed                             0
</em></p><p><em>Pages Allocated                          1722088
</em></p><p>
 </p><p>
 </p><p><strong><em><span style="background-color:yellow">CACHESTORE_BROKERTO (node 0)             KB</span>
								</em></strong></p><p><em>---------------------------------------- -----------
</em></p><p><em>VM Reserved                              0
</em></p><p><em>VM Committed                             0
</em></p><p><em>Locked Pages Allocated                   0
</em></p><p><em>SM Reserved                              0
</em></p><p><em>SM Committed                             0
</em></p><p><em><span style="background-color:yellow">Pages Allocated                          17685088  ===&gt; Around 17.6 GB</span>
							</em></p></td></tr></tbody></table></div><p>
 </p><ul style="margin-left: 72pt"><li>We checked the count of <span style="color:#0070c0"><strong>sys.conversation_endpoints</strong></span>
		</li></ul><p><strong>5895928</strong>
	</p><p><strong>Five million eight hundred ninety-five thousand nine hundred twenty-eight (almost 6 million)
</strong></p><p>We also checked the <strong>state_desc</strong> and found that we have all the conversations in the <strong>closed </strong>state.
</p><p>
 </p><div><table style="border-collapse:collapse" border="0"><colgroup><col style="width:623px"/></colgroup><tbody valign="top"><tr><td style="padding-left: 7px; padding-right: 7px; border-top:  solid 0.5pt; border-left:  solid 0.5pt; border-bottom:  solid 0.5pt; border-right:  solid 0.5pt"><p>The blog post by Rusanu shows how sys.conversations_endpoints grows out of control with CLOSED conversations that are never cleaned up &amp; how to fix it
</p><p><a href="http://rusanu.com/2014/03/31/how-to-prevent-conversation-endpoint-leaks/">http://rusanu.com/2014/03/31/how-to-prevent-conversation-endpoint-leaks/</a>
						</p><p>
 </p><p>
 </p><p>++Look at the following in our case as well
</p><p><strong><em>select  lifetime, state_desc, security_timestamp 
</em></strong></p><p><strong><em>                from [target].sys.conversation_endpoints;
</em></strong></p><p>
 </p><p>lifetime                state_desc                                                   security_timestamp
</p><p>----------------------- ------------------------------------------------------------ -----------------------
</p><p>2080-10-16 13:25:49.790 CLOSED                                                       1900-01-01 00:00:00.000
</p><p>2081-06-29 07:58:46.440 CLOSED                                                       1900-01-01 00:00:00.000
</p><p>2081-09-18 10:08:05.960 CLOSED                                                       1900-01-01 00:00:00.000
</p><p>2081-08-26 07:26:49.037 CLOSED                                                       1900-01-01 00:00:00.000
</p><p>2082-04-23 10:22:49.263 CLOSED                                                       1900-01-01 00:00:00.000
</p><p>2081-11-20 09:13:52.453 CLOSED                                                       1900-01-01 00:00:00.000
</p><p>2082-12-03 15:23:07.873 CLOSED                                                       1900-01-01 00:00:00.000
</p><p>2081-11-06 08:26:34.610 CLOSED                                                       1900-01-01 00:00:00.000
</p><p>2081-08-05 07:52:59.677 CLOSED                                                       1900-01-01 00:00:00.000
</p><p><span style="background-color:yellow">2082-05-23 08:25:33.107 CLOSED                                                       1900-01-01 00:00:00.000</span>
						</p><p>
 </p><p>
 </p><p>The target conversation endpoint is in CLOSED state<strong>, but the lifetime field indicates that the 
</strong></p><p><strong>This endpoint will be reclaimed on May 23<sup>rd</sup> 2082, because that is the conversation lifetime. 
</strong></p><p>In case you wonder that date comes from adding MAX_INT32 (ie. 2147483647) seconds to the current date.
</p><p>
 </p><p>From an operational point of view this target endpoint is 'leaked'. It will consume DB space and the system will refrain from deleting it for quite some time. Repeat this vicious exchange pattern several thousand times per hour and in a few days your target database will simply run out of space
</p></td></tr></tbody></table></div><p>
 </p><p>
 </p><div><table style="border-collapse:collapse" border="0"><colgroup><col style="width:623px"/></colgroup><tbody valign="top"><tr><td style="padding-left: 7px; padding-right: 7px; border-top:  solid 0.5pt; border-left:  solid 0.5pt; border-bottom:  solid 0.5pt; border-right:  solid 0.5pt"><p>In our case we do not see the Target database running out of space, however we are seeing memory pressure.
</p><p>
 </p><p><strong>Service Broker Transmission Object Cache is taking up to 18GB of RAM even though the conversations are in the CLOSED state.
</strong></p><p>
 </p><p><span style="text-decoration:underline"><strong>Why?
</strong></span></p><p>This could be because the Broker uses transmission objects (TO) to record the state of a
</p><p>Conversation endpoint.
</p><p>
 </p><ul><li>These are in-memory objects about 1KB in size, stored in the DB Engine address space
</li><li>Once a TO is assigned to a conversation, it remains assigned to the conversation until the conversation ends.
</li><li>So long as there is enough memory to hold all the TOs for all existing concurrent conversations, the TOs are all in memory and nothing is cached to tempdb.
</li></ul><p>
 </p><ul><li>So if a system has an application that is never ending conversations, eventually there will be more TOs than can be stored in memory and Broker will start caching them in tempdb
</li></ul><p>
 </p></td></tr></tbody></table></div><p>
 </p><p>The Resolution is as per Rusanu's blog   <a href="http://rusanu.com/2014/03/31/how-to-prevent-conversation-endpoint-leaks/">http://rusanu.com/2014/03/31/how-to-prevent-conversation-endpoint-leaks/</a> . Even though the blog speaks target endpoint 'leak' resulting in the DB space consumption, the same solution can be used in our situation as well.
</p><p>Note: The blog gives 2 detailed long term solutions for controlling the issue of closed conversations not being cleaned up<span style="text-decoration:underline"><strong>
			</strong></span></p><p>If you are already facing a situation in which the conversation endpoints have leaked then <span style="background-color:yellow">you first have to fix the application using one of the proposed solutions above (or both!). Then you can go ahead and cleanup the leaked conversations</span> with the cleanup.sql script presented in Rusanu's blog. 
</p><p>
 </p><p>
 </p><p>References/ Credits: <a href="http://rusanu.com/2014/03/31/how-to-prevent-conversation-endpoint-leaks/">http://rusanu.com/2014/03/31/how-to-prevent-conversation-endpoint-leaks/</a>
	</p><p><a href="http://blogs.msdn.com/b/sqlserverfaq/archive/2010/03/25/sql-server-encounters-memory-pressure-and-generate-701-error-due-to-incorrect-configuration-of-service-broker.aspx">http://blogs.msdn.com/b/sqlserverfaq/archive/2010/03/25/sql-server-encounters-memory-pressure-and-generate-701-error-due-to-incorrect-configuration-of-service-broker.aspx</a>
	</p><p>
 </p><p>
 </p><p>
 </p>]]></content:encoded>
    </item>
    <item>
      <title>Service Pack Setup completes successfully on clustered instance but SQL Server Version is not updated on one node</title>
      <link>https://docs.microsoft.com/archive/blogs/poojakamath/service-pack-setup-completes-successfully-on-clustered-instance-but-sql-server-version-is-not-updated-on-one-node</link>
      <pubDate>Mon, 22 Dec 2014 03:13:44 GMT</pubDate>
      <dc:creator><![CDATA[Pooja Kamath]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/poojakamath/2014/12/22/service-pack-setup-completes-successfully-on-clustered-instance-but-sql-server-version-is-not-updated-on-one-node/</guid>
      <description><![CDATA[I recently worked on an issue where one of my customers had successfully finished patching their SQL...]]></description>
      <content:encoded><![CDATA[<p><strong><font size="2">I recently worked on an issue where one of my customers had successfully finished patching their SQL 2005 instances on a 3 node cluster. However the Build number was not getting updated on one of the nodes (NODE3) even after successfully completing the SP4 installation&#160; </font></strong></p>  <p><font size="2"><strong>SQL version On problem node</strong>: Database Services (INSTANCEX) SP3 <span style="color: #0070c0"><strong>2005.090.4340.00</strong>&#160; </span>x86 ENTERPRISE </font></p>  <p><font size="2"><strong>Expected version</strong>: SQL Server Database Service 2005(INSTANCEX) ENU SP4 <span style="color: #0070c0"><strong>2005.090.5000.00</strong>&#160; </span>x86&#160; ENTERPRISE </font></p>  <p><font size="2"><strong>OS version:</strong> Microsoft Windows Server 2003 family, Enterprise Edition Service Pack 2 (Build 3790) x86 </font></p>  <p><font size="2"><strong>Number of Nodes</strong> : 3 (NODE1, NODE2, NODE3) </font></p>  <p><font size="2">&#160;&#160; </font></p>  <p><font size="2"><strong>Note:</strong> <span style="color: #002060"><em>With SQL Server 2005 unlike the higher versions, the patch is applied to the active node of the cluster and it is the patch that will go off to all passive nodes and will apply the patch files remotely</em> </span></font></p>  <p><span style="color: #002060"><font size="2"><em>Patching of the passive node is achieved by remotely creating a scheduled task</em> </font></span></p>  <p><span style="color: #002060"><font size="2"><em>With SQL 2005 the patch does everything so once it's finished <span style="text-decoration: underline">either all nodes are patched, or none are patched.</span> If there is an issue during the patching phase, then the entire patch needs to be rolled back on all nodes. Therefore if you have 3 node cluster and the last node fails to patch, the patch will be rolled back on all nodes</em>. </font></span></p>  <p><font size="2">&#160;&#160; </font></p>  <ul>   <li><font size="2">However in our case the </font><strong><font size="2">patch was not rolled back on the nodes even though NODE3 wasn't patched correctly because the summary log still reports a success!         <br /></font></strong></li>    <li><font size="2">We collected the setup logs on the NODE3&#160; and also the successfully patched nodes&#160; to make&#160; detailed analysis to check if features to be updated have been skipped for any reason </font></li>    <li><font size="2">.We paused the NODE2 and NODE3 from the Cluster Administrator and ran the SP4 setup on the NODE3 </font></li> </ul>  <p><font size="2">We see that the setup succeeded (but completes in less than 30 seconds) showing us it may not be actually patching in the background </font></p>  <p><font size="2"></font></p>  <div>   <table style="border-collapse: collapse" border="0"><colgroup><font size="2"><col style="width: 927px" /></font></colgroup><tbody valign="top">       <tr style="height: 331px">         <td style="border-top: 0.5pt solid; border-right: 0.5pt solid; border-bottom: 0.5pt solid; padding-left: 7px; border-left: 0.5pt solid; padding-right: 7px">           <ul>             <li><font size="2">If you look at the summary file on the NODE2 AND NODE4 where the build is updated successfully: </font></li>           </ul>            <p><font size="2">Product Installation Status </font></p>            <p><font size="2">Product&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; : SQL Server Database Services 2005 (INSTANCEX) </font></p>            <p><font size="2">Product Version (Previous): 5000 </font></p>            <p><font size="2">Product Version (Final)&#160;&#160; : 5324 </font></p>            <p><font size="2">Status&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; : Reboot Required </font></p>            <p><font size="2">Log File&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; : <strong>C:\Program Files\Microsoft SQL Server\90\Setup Bootstrap\LOG\Hotfix\SQL9_Hotfix_KB2716427_sqlrun_sql.msp.log</strong> </font></p>            <p><font size="2">Error Number&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; : 3010 </font></p>            <p><font size="2">Error Description&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; : </font></p>            <p><font size="2">&#160;&#160; </font></p>            <ul>             <li><span style="text-decoration: underline; color: #0070c0"><strong><font size="2">Comparing this to NODE3 our problem node we do not see the </font></strong></span></li>           </ul>            <p><font size="2">---------------------------------------------------------------------------------- </font></p>            <p><font size="2">Product&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; : Database Services (INSTANCEX) </font></p>            <p><font size="2">Product Version (Previous): 4340 </font></p>            <p><font size="2">Product Version (Final)&#160;&#160; : 5000 </font></p>            <p><span style="color: #c00000"><strong><font size="2"><span style="background-color: yellow">Status&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; : Success</span> </font></strong></span></p>            <p><span style="background-color: yellow"><font size="2">Log File&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; : </font></span></p>            <p><span style="background-color: yellow"><font size="2">Error Number&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; : 0 </font></span></p>            <p><font size="2"><span style="background-color: yellow">Error Description&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; :</span> </font></p>         </td>       </tr>     </tbody></table> </div>  <p><font size="2">&#160;&#160; </font></p>  <p><font size="2">As per </font><a href="http://blogs.msdn.com/b/jorgepc/archive/2009/09/07/sql-server-2005-service-pack-does-not-update-all-the-installed-components.aspx"><font size="2">http://blogs.msdn.com/b/jorgepc/archive/2009/09/07/sql-server-2005-service-pack-does-not-update-all-the-installed-components.aspx</font></a><font size="2"> </font></p>  <p><strong><font size="2">During the very beginning of the Service Pack setup process, the existing SQL Server services are discovered via WMI queries by the means of Wmiprvse.exeprocess; without the proper permissions, the process will fail to discover the installed components </font></strong></p>  <p><font size="2"></font></p>  <ul>   <li><font size="2">That led us to suspect &quot;<strong>Is the Service pack setup even able to enumerate/discover the SQL instances?</strong> </font></li> </ul>  <p><font size="2">Here is how we investigated that: </font></p>  <ul>   <li><font size="2">We know that the SQL Server Configuration Manager tool also uses the same WMI queries to iterate through the services collection </font></li>    <li><font size="2">When these tools generate the WMI queries, the SQL Server Web-Based Enterprise Management (WBEM) provider (Sqlmgmprovider.dll) is loaded into the Wmiprvse.exe process. Then, the SQL Server WBEM provider extracts and processes the information about the services of every instance of SQL Server 2005 </font></li>    <li><font size="2">So we decided to check if the SQL configuration manager on the problem node was able to enlist the services which would give us an idea if these WMI queries are working as expected </font></li> </ul>  <p><font size="2">We open the SQL Server Configuration Manager, the right hand pane had the following error &quot;<strong><span style="background-color: yellow">The server threw an exception. [0x80010105]&quot;.</span> </strong></font></p>  <ul>   <li><font size="2">On the NODE2 and NODE1 we do not see these issues.<strong> </strong></font></li> </ul>  <p><font size="2">&#160;&#160; </font></p>  <ul>   <li><font size="2">We also performed a small test to check WMI connectivity </font></li> </ul>  <div>   <table style="border-collapse: collapse" border="0"><colgroup><font size="2"><col style="width: 623px" /></font></colgroup><tbody valign="top">       <tr>         <td style="border-top: 0.5pt solid; border-right: 0.5pt solid; border-bottom: 0.5pt solid; padding-left: 7px; border-left: 0.5pt solid; padding-right: 7px">           <ol>             <li><font size="2">Open the WMI Control console: Click Start , click Run , type wmimgmt.msc and then click OK. </font></li>              <li><font size="2">In the console tree, right-click WMI Control , and then click Properties. </font></li>              <li><font size="2">Select the Security tab. </font></li>              <li><font size="2">Expand the Root folder and then navigate to Microsoft &gt; SQLServer </font></li>              <li><font size="2">Search for namespace ComputerManagement </font></li>              <li><font size="2">Open the WMI Tester: Click Start , click Run , type wbemtest and then click OK. </font></li>              <li><font size="2">Connect to the namespace ComputerManagement (root\microsoft\sqlserver\ComputerManagement) and click on Query </font></li>           </ol>            <p><span style="color: #002060"><strong><em><font size="2">SELECT * FROM RegServices                     <br />SELECT * FROM SqlService </font></em></strong></span></p>            <ol>             <li><font size="2">Make note if the query produced an error or if it was successful. </font></li>           </ol>            <p><font size="2">We see that in the Problem Node3, even after waiting for a long time<strong> <span style="text-decoration: underline">we do not see any instances enumerated.</span></strong> </font></p>            <p><font size="2"></font></p>            <p><a href="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/63/52/metablogapi/4370.image_02E71982.png" original-url="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-63-52-metablogapi/4370.image_5F00_02E71982.png"><font size="2"><img title="image" style="border-top: 0px; border-right: 0px; background-image: none; border-bottom: 0px; padding-top: 0px; padding-left: 0px; border-left: 0px; display: inline; padding-right: 0px" border="0" alt="image" src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/63/52/metablogapi/1680.image_thumb_407707FC.png" original-url="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-63-52-metablogapi/1680.image_5F00_thumb_5F00_407707FC.png" width="280" height="226" /></font></a></p>            <p><font size="2">When we try the same on the NODE1 and NODE2 for the same namespace <span style="text-decoration: underline"><strong>we see all the instances are being enumerated:<span style="color: #669966"> </span></strong></span></font></p>            <p><a href="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/63/52/metablogapi/2211.image_42475DC3.png" original-url="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-63-52-metablogapi/2211.image_5F00_42475DC3.png"><font size="2"><img title="image" style="border-top: 0px; border-right: 0px; background-image: none; border-bottom: 0px; padding-top: 0px; padding-left: 0px; border-left: 0px; display: inline; padding-right: 0px" border="0" alt="image" src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/63/52/metablogapi/4705.image_thumb_08C6DE7D.png" original-url="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-63-52-metablogapi/4705.image_5F00_thumb_5F00_08C6DE7D.png" width="317" height="209" /></font></a></p>            <p><font size="2"></font></p>            <p><font size="2">Connected to other namespace (e.g. root\cimv2, SELECT * FROM Win32_Service), it is all working fine </font></p>            <p><font size="2">It appears that only the SQL namespace is having issue. </font></p>            <p><font size="2">&#160;&#160; </font></p>            <p><font size="2">&#160;&#160; </font></p>            <ul>             <li><font size="2">With this we confirmed that there a WMI connectivity issue on the Server for the SQL Namespace </font></li>           </ul>         </td>       </tr>     </tbody></table> </div>  <ul>   <li><font size="2">However we had check the Setup logs to confirm if the <strong>Service pack setup has actually succeeded for the Database Engine Services, or if it was skipped due to any possible WMI issues</strong>? </font></li> </ul>  <p><font size="2">&#160;&#160; </font></p>  <div>   <table style="border-collapse: collapse" border="0"><colgroup><font size="2"><col style="width: 952px" /></font></colgroup><tbody valign="top">       <tr style="height: 193px">         <td style="border-top: 0.5pt solid; border-right: 0.5pt solid; border-bottom: 0.5pt solid; padding-left: 7px; border-left: 0.5pt solid; padding-right: 7px">           <p><font size="2">We can see that setup able to enumerate all the details but weren't sure why it completes in ten seconds (Below is a snippet of setup log generated on NODE3 when the other two nodes were paused): </font></p>            <p><em><font size="2">12/06/2014 13:10:24.272&#160;&#160; Instance Details: INSTANCEX                  <br />12/06/2014 13:10:24.272&#160;&#160;&#160;&#160; agentservicename = SQLAgent$INSTANCEX                   <br />12/06/2014 13:10:24.272&#160;&#160;&#160;&#160; associatedhotfixbuild = 1520                   <br />12/06/2014 13:10:24.272&#160;&#160;&#160;&#160; clustername = S02S702DR-CL6                   <br />12/06/2014 13:10:24.272&#160;&#160;&#160;&#160; ftsservicename = MSFTESQL$INSTANCEX                   <br />12/06/2014 13:10:24.272&#160;&#160;&#160;&#160; fullversion = 2005.090.4340.00                   <br />12/06/2014 13:10:24.272&#160;&#160;&#160;&#160; hiveregpath = Software\Microsoft\Microsoft SQL Server\MSSQL.5                   <br />12/06/2014 13:10:24.272&#160;&#160;&#160;&#160; id = MSSQL.5                   <br />12/06/2014 13:10:24.272&#160;&#160;&#160;&#160; installsqldatadir = N:\MSSQL.5\MSSQL                   <br />12/06/2014 13:10:24.272&#160;&#160;&#160;&#160; installsqldir = C:\Program Files\Microsoft SQL Server\MSSQL.5\MSSQL                   <br />12/06/2014 13:10:24.272&#160;&#160;&#160;&#160; lcid = 1033                   <br />12/06/2014 13:10:24.272&#160;&#160;&#160;&#160; name = INSTANCEX                   <br />12/06/2014 13:10:24.272&#160;&#160;&#160;&#160; productcode = {A2E15F7E-A973-493A-AC36-B1841F8EE431}                   <br />12/06/2014 13:10:24.272&#160;&#160;&#160;&#160; qfelevel = 4340                   <br />12/06/2014 13:10:24.272&#160;&#160;&#160;&#160; servicename = MSSQL$INSTANCEX                   <br />12/06/2014 13:10:24.272&#160;&#160;&#160;&#160; sku = ENTERPRISE                   <br />12/06/2014 13:10:24.272&#160;&#160;&#160;&#160; sp = 3                   <br />12/06/2014 13:10:24.272&#160;&#160;&#160;&#160; type = SQL Server Standalone Product                   <br />12/06/2014 13:10:24.272&#160;&#160;&#160;&#160; vermajbld = 4035                   <br />12/06/2014 13:10:24.272&#160;&#160;&#160;&#160; version = 9 </font></em></p>            <p><em>               <br /><font size="2">&quot;12/06/2014 13:10:44.133 Installing instance: INSTANCEX                  <br />12/06/2014 13:10:44.149 Enumerating passive cluster nodes                   <br />12/06/2014 13:10:44.149 No available passive nodes were found                   <br />12/06/2014 13:10:44.149 Finalizing cluster instance: INSTANCEX                   <br />12/06/2014 13:10:44.149 Waiting for all running passive nodes to complete their patch                   <br />12/06/2014 13:10:44.149 All running passive nodes have completed their patch                   <br />12/06/2014 13:10:44.149 Finalized cluster instance: INSTANCEX </font></em></p>            <p><em><font size="2">12/06/2014 13:10:44.149 Enumerating passive cluster nodes                  <br />12/06/2014 13:10:44.149 No available passive nodes were found                   <br />12/06/2014 13:10:44.149 Finalizing cluster instance: INSTANCEX                   <br />12/06/2014 13:10:44.149 Waiting for all running passive nodes to complete their patch                   <br />12/06/2014 13:10:44.149 All running passive nodes have completed their patch </font></em></p>            <p><em><font size="2"><span style="background-color: yellow">12/06/2014 13:10:44.149 Hotfix package completed                    <br />12/06/2014 13:10:44.149 Attempting to continue the 32 bit ngen queue                     <br />12/06/2014 13:10:53.431 Hotfix package closed&quot;</span> </font></em></p>            <p><font size="2"></font></p>            <p><strong><font size="2">We do not see it installing any files or creating a Log file! </font></strong></p>            <p><font size="2"></font></p>            <p><font size="2">****************************************                <br /></font><span style="color: #002060"><font size="2"><strong>Compared to the good run on NODE2 pasted below we can see it creating a log file and installing msp files</strong>                  <br /></font></span></p>            <p><font size="2">++12/06/2014 06:56:02.818 Installing target: NODE2                <br /></font><font size="2"><span style="background-color: yellow">12/06/2014 06:56:08.927 Installing file: sqlrun_sql.msp                  <br />12/06/2014 06:56:08.927 Copy Engine: Creating MSP install log file at: C:\Program Files\Microsoft SQL Server\90\Setup Bootstrap\LOG\Hotfix\SQL9_Hotfix_KB2463332_sqlrun_sql.msp.log</span>                 <br /></font></p>            <p><font size="2">*************************************** </font></p>         </td>       </tr>     </tbody></table> </div>  <p><font size="2"></font></p>  <ul>   <li><font size="2">So now we had a fair idea that the Service Pack setup is completing without actually patching the instance, because we possibly have issues discovering the installed components by the WMI queries </font></li> </ul>  <p><font size="2"></font></p>  <ul>   <li><font size="2">We now had to fix the SQL Server Configuration Manager, issue which was throwing the error &quot;<strong>The server threw an exception. [0x80010105]&quot;. </strong></font></li> </ul>  <div>   <table style="border-collapse: collapse" border="0"><colgroup><font size="2"><col style="width: 883px" /></font></colgroup><tbody valign="top">       <tr style="height: 217px">         <td style="border-top: 0.5pt solid; border-right: 0.5pt solid; border-bottom: 0.5pt solid; padding-left: 7px; border-left: 0.5pt solid; padding-right: 7px">           <p><font size="2">We have a Public KB article that fixes the SQL configuration manager issue we are seeing: </font></p>            <p><font size="2"></font></p>            <p><font size="2">As per: </font><a href="http://support.microsoft.com/kb/956013"><font size="2">http://support.microsoft.com/kb/956013</font></a><font size="2">                <br /></font></p>            <p><font size="2">To work around this problem, open a command prompt, type the following command, and then press ENTER:                <br /><em>mofcomp &quot;%programfiles(x86)%\Microsoft SQL Server\number\Shared\sqlmgmproviderxpsp2up.mof&quot; </em></font></p>            <ul>             <li><font size="2"><em>We tried the above and it is reporting a success of parsing</em> the .mof file. <strong>However it is stalled at &quot;Storing data in repository&quot; (it normally reports a &quot;Done!&quot; and comes out of the loop) Here it is just stalled.. </strong></font></li>              <li><font size="2">Trying to restart the <strong>WMI service gets hung</strong> if we do it after parsing the .mof file. </font></li>              <li><font size="2">We involved our Windows Platforms team to help us rebuild the WMI files, but we still received the same error when we try to open the SQL Configuration Manager.</font></li>           </ul>         </td>       </tr>     </tbody></table> </div>  <p><font size="2"></font></p>  <p><span style="text-decoration: underline"><strong><font size="2">What finally resolved it for us! </font></strong></span></p>  <ul>   <li><font size="2">We came across </font><a href="http://support.microsoft.com/kb/2849344"><span style="color: #0070c0"><font size="2">http://support.microsoft.com/kb/2849344</font></span></a><font size="2"> , which speaks of the same &quot;<span style="background-color: whitesmoke">The server threw an exception [0x80010105]&quot; error when the configuration manager is started. </span></font></li>    <li><font size="2">However the <span style="text-decoration: underline"><strong>KB article is applicable to Windows Server 2012 &amp; SQL server 2008 R2</strong></span> where the problem occurs because SQL Server 2008 R2 internally uses a deprecated 32-bit Windows .dll file (Msclus.dll). When Configuration Manager is started after the Cluster Automation feature is added, the system discovers that the necessary .dll file is missing, and this triggers the error<span style="background-color: whitesmoke"> </span></font></li> </ul>  <p><span style="background-color: whitesmoke"><font size="2">The work around provided by the KB is as follows </font></span></p>  <ol>   <li>     <div style="background: white"><font size="2"><strong>Note </strong>The 32-bit version of the MSClus.dll can be found in the &quot;%windir%\syswow64&quot; directory. </font></div>   </li>    <li>     <div style="background: white"><font size="2">Register this .dll file by running the regsvr32 command from an elevated command prompt: </font></div>      <ol>       <li>         <div style="background: white"><font size="2">Click <strong>Start</strong>, type <strong>command prompt</strong>in the <strong>Search programs and files </strong>box. </font></div>       </li>        <li>         <div style="background: white"><font size="2">Under<strong>Programs</strong>, right-click <strong>Command Prompt</strong>, and then click<strong>Run as administrator</strong>. </font></div>       </li>        <li>         <div style="background: white"><span style="background-color: yellow"><font size="2">At the command prompt, type the following command, and then press ENTER:               <br /></font></span></div>          <p style="background: white"><strong><font size="2"><span style="background-color: yellow">Regsvr32 MSClus.dll</span> </font></strong></p>       </li>     </ol>   </li> </ol>  <p style="background: white"><font size="2"></font></p>  <p style="background: white"><font size="2"></font></p>  <p style="background: white"><font size="2"></font></p>  <p style="background: white"><font size="2">The current customer's environment is Windows 2003. However we decided to give the above workaround a shot as we were also in a clustered environment. </font></p>  <p style="background: white"><font size="2"></font></p>  <p style="background: white"><font size="2">After registering the above <strong>MSClus.dll ! </strong>Voila…the configuration manager no longer throws the exception </font></p>  <p style="background: white"><font size="2"></font></p>  <ul>   <li>     <div style="background: white"><span style="color: #333333"><font size="2">We patched the NODE3 once again, which took slightly longer this time. </font></span></div>   </li>    <li>     <div style="background: white"><span style="color: #333333"><font size="2">Rebooted the node and checked the SQL Server build which now reports <span style="color: #0070c0"><strong>090.5000.00</strong>&#160;<span style="color: #333333">correctly </span><span style="font-family: wingdings">J</span><span style="color: #333333"> </span></span></font></span></div>   </li> </ul>  <p><font size="2"></font></p>  <p><font size="2"></font></p>  <p><font size="2"></font></p>]]></content:encoded>
    </item>
    <item>
      <title>SQL Server 2008 Add node setup hangs for hours at                                       “Install SQL_DTS_VSTAConfiguration_install_Cpu64: RollbackCleanup: Removing backup files”</title>
      <link>https://docs.microsoft.com/archive/blogs/poojakamath/sql-server-2008-add-node-setup-hangs-for-hours-at-install-sql_dts_vstaconfiguration_install_cpu64-rollbackcleanup-removing-backup-files</link>
      <pubDate>Mon, 17 Mar 2014 22:13:07 GMT</pubDate>
      <dc:creator><![CDATA[Pooja Kamath]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/poojakamath/2014/03/17/sql-server-2008-add-node-setup-hangs-for-hours-at-install-sql_dts_vstaconfiguration_install_cpu64-rollbackcleanup-removing-backup-files/</guid>
      <description><![CDATA[We recently encountered a situation while trying to ‘Add a node’ to the SQL 2008 Cluster   The...]]></description>
      <content:encoded><![CDATA[<p>We recently encountered a situation while trying to ‘Add a node’ to the SQL 2008 Cluster </p>  <p>The installation hung for hours at <strong><font style="background-color: rgb(255, 255, 0);">Install SQL_DTS_VSTAConfiguration_install_Cpu64: RollbackCleanup: Removing backup files</font></strong></p>  <p>It may also hang at <strong><font style="background-color: rgb(255, 255, 0);">Install_VS_Shell_Cpu32_Action: RollbackCleanup: Removing backup files</font></strong></p>  <p><strong><font style="background-color: rgb(255, 255, 0);"></font></strong></p>  <p><font style="style"></font>We do not see any error messages from the SQL setup, however the setup just hangs and does not proceed<font style="style"></font></p>  <p>   <br />• From the System logs we should see the VS template warning and the particular msi which is not letting the SQL setup go through</p>  <p>&#160;&#160; <table cellspacing="0" cellpadding="2" width="800" border="1"><tbody>       <tr>         <td valign="top" width="800"><strong>Log Name:&#160;&#160;&#160;&#160;&#160; Application</strong>            <br />&#160;&#160;&#160; Source:&#160;&#160;&#160;&#160;&#160;&#160;&#160; Visual Studio - VsTemplate            <br />&#160;&#160;&#160; Date:&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; 2/7/2014 7:55:01 PM            <br />&#160;&#160;&#160; Event ID:&#160;&#160;&#160;&#160;&#160; 1            <br />&#160;&#160;&#160; Task Category: None            <br />&#160;&#160;&#160; Level:&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; Warning            <br />&#160;&#160;&#160; Keywords:&#160;&#160;&#160;&#160;&#160; Classic            <br />&#160;&#160;&#160; User:&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; N/A            <br />&#160;&#160;&#160; Computer:&#160;&#160;&#160;&#160;&#160; ABC.XYZ.LOCAL            <br />&#160;&#160;&#160; Description:            <br />&#160;&#160;&#160; <strong>Error in Template (C:\Program Files (x86)\Microsoft Visual Studio 9.0\Common7\IDE\ItemTemplates\CSharp\Code\1033\Class.zip), file</strong> (Class.vstemplate).&#160; Unregistered ProjectType (CSharp).&#160; This can be caused by an incorrect ProjectType or because the project type package is not installed.             <br />&#160;&#160;&#160; Event Xml:            <br />&#160;&#160;&#160; &lt;Event xmlns=&quot;<a href="http://schemas.microsoft.com/win/2004/08/events/event%22">http://schemas.microsoft.com/win/2004/08/events/event&quot;</a>&gt;            <br />&#160;&#160;&#160;&#160;&#160; &lt;System&gt;            <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; &lt;Provider Name=&quot;Visual Studio - VsTemplate&quot; /&gt;            <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; &lt;EventID Qualifiers=&quot;49152&quot;&gt;1&lt;/EventID&gt;            <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; &lt;Level&gt;3&lt;/Level&gt;            <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; &lt;Task&gt;0&lt;/Task&gt;            <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; &lt;Keywords&gt;0x80000000000000&lt;/Keywords&gt;            <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; &lt;TimeCreated SystemTime=&quot;2014-02-07T18:55:01.000Z&quot; /&gt;            <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; &lt;EventRecordID&gt;1046&lt;/EventRecordID&gt;            <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; &lt;Channel&gt;Application&lt;/Channel&gt;            <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; &lt;Computer&gt;ABC.XYZ.LOCAL&lt;/Computer&gt;            <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; &lt;Security /&gt;            <br />&#160;&#160;&#160;&#160;&#160; &lt;/System&gt;            <br />&#160;&#160;&#160;&#160;&#160; &lt;EventData&gt;            <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; &lt;Data&gt;Error in Template (C:\Program Files (x86)\Microsoft Visual Studio 9.0\Common7\IDE\ItemTemplates\CSharp\Code\1033\Class.zip), file (Class.vstemplate).&#160; Unregistered ProjectType (CSharp).&#160; This can be caused by an incorrect ProjectType or because the project type package is not installed.&lt;/Data&gt;            <br />&#160;&#160;&#160;&#160;&#160; &lt;/EventData&gt;            <br />&#160;&#160;&#160; &lt;/Event&gt;</td>       </tr>     </tbody></table>    <br />&#160;&#160; <br />&#160;&#160; <table cellspacing="0" cellpadding="2" width="800" border="1"><tbody>       <tr>         <td valign="top" width="800">Log Name:&#160;&#160;&#160;&#160;&#160; Application           <br />&#160;&#160;&#160; Source:&#160;&#160;&#160;&#160;&#160;&#160;&#160; MsiInstaller            <br />&#160;&#160;&#160; Date:&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; 2/7/2014 7:52:49 PM            <br />&#160;&#160;&#160; Event ID:&#160;&#160;&#160;&#160;&#160; 1040            <br />&#160;&#160;&#160; Task Category: None            <br />&#160;&#160;&#160; Level:&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; Information            <br />&#160;&#160;&#160; Keywords:&#160;&#160;&#160;&#160;&#160; Classic            <br />&#160;&#160;&#160; User:&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; TESTUSER\XYZSQLSVC            <br />&#160;&#160;&#160; Computer:&#160;&#160;&#160;&#160;&#160; ABC.XYZ.LOCAL            <br />&#160;&#160;&#160; Description:            <br />&#160;&#160;&#160; <font style="background-color: rgb(255, 255, 0);">Beginning a Windows Installer transaction: C:\SQL2008\x64\setup\vs_shell.msi. Client Process Id: 7512.</font>            <br />&#160;&#160;&#160; Event Xml:            <br />&#160;&#160;&#160; &lt;Event xmlns=&quot;<a href="http://schemas.microsoft.com/win/2004/08/events/event%22">http://schemas.microsoft.com/win/2004/08/events/event&quot;</a>&gt;            <br />&#160;&#160;&#160;&#160;&#160; &lt;System&gt;            <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; &lt;Provider Name=&quot;MsiInstaller&quot; /&gt;            <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; &lt;EventID Qualifiers=&quot;0&quot;&gt;1040&lt;/EventID&gt;            <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; &lt;Level&gt;4&lt;/Level&gt;            <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; &lt;Task&gt;0&lt;/Task&gt;            <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; &lt;Keywords&gt;0x80000000000000&lt;/Keywords&gt;            <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; &lt;TimeCreated SystemTime=&quot;2014-02-07T18:52:49.000Z&quot; /&gt;            <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; &lt;EventRecordID&gt;1043&lt;/EventRecordID&gt;            <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; &lt;Channel&gt;Application&lt;/Channel&gt;            <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; &lt;Computer&gt;ABC.XYZ.LOCAL&lt;/Computer&gt;            <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; &lt;Security UserID=&quot;S-1-5-21-2648667412-578919172-3512332051-3665&quot; /&gt;            <br />&#160;&#160;&#160;&#160;&#160; &lt;/System&gt;            <br />&#160;&#160;&#160;&#160;&#160; &lt;EventData&gt;            <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; &lt;Data&gt;<strong>C:\SQL2008\x64\setup\vs_shell.msi</strong>&lt;/Data&gt;            <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; &lt;Data&gt;7512&lt;/Data&gt;            <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; &lt;Data&gt;(NULL)&lt;/Data&gt;            <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; &lt;Data&gt;(NULL)&lt;/Data&gt;            <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; &lt;Data&gt;(NULL)&lt;/Data&gt;            <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; &lt;Data&gt;            <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; &lt;/Data&gt;            <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; &lt;Data&gt;            <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; &lt;/Data&gt;            <br />&#160;&#160;&#160;&#160;&#160; &lt;/EventData&gt;            <br />&lt; /Event&gt;</td>       </tr>     </tbody></table>    <br /></p>  <p>If you look at the detail.txt you may find it is stalled at the below point</p>  <p>SSIS: Running: C:\Program Files (x86)\Microsoft Visual Studio 9.0\Common7\IDE\vsta.exe /hostid SSIS_ScriptTask /setup   <br /></p>  <p>It does not indicate a&#160; failed execution of the script. Infact running this from the Command prompt manually would work, but it still didn’t let us proceed with the setup</p>  <table cellspacing="0" cellpadding="2" width="800" border="1"><tbody>     <tr>       <td valign="top" width="800">         <p>Here’s how the Detail.txt would look like</p>                    <p>14-02-08 04:39:57 Slp: Sco: Attempting to open registry subkey SOFTWARE\Microsoft\Microsoft SQL Server\100\SSIS           <br /> 2014-02-08 04:39:57 Slp: Sco: Attempting to set value LogPackageExecutionToEventLog            <br /> 2014-02-08 04:39:57 Slp: SetValue: HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Microsoft SQL Server\100\SSIS, Name = LogPackageExecutionToEventLog            <br /> 2014-02-08 04:39:57 Slp: Sco: Attempting to create base registry key HKEY_LOCAL_MACHINE, machine             <br /> 2014-02-08 04:39:57 Slp: Sco: Attempting to open registry subkey             <br /> 2014-02-08 04:39:57 Slp: Sco: Attempting to open registry subkey SOFTWARE\Microsoft\Microsoft SQL Server\100\SSIS            <br /> 2014-02-08 04:39:57 Slp: Sco: Attempting to set value LogPackageExecutionToEventLog            <br /> 2014-02-08 04:39:57 Slp: SetValue: HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Microsoft SQL Server\100\SSIS, Name = LogPackageExecutionToEventLog            <br /> 2014-02-08 04:39:57 SSIS: SetRegistryValues() done            <br /> 2014-02-08 04:39:57 SSIS: STATUS: Install_ConfigNonRC completed            <br /> 2014-02-08 04:39:57 SSIS: SSIS_Config: Install Timing: ConfigNonRC completed            <br /> 2014-02-08 04:39:57 Slp: SlpConfigAction.ExecuteAction(actionId: SSISConfigAction_install_postmsi_Cpu64) completed            <br /> 2014-02-08 04:39:57 Slp: Checkpoint: INSTALL:CONFIGNONRC:SQL_DTS_FULL            <br /> 2014-02-08 04:39:57 Slp: Completed Action: SSISConfigAction_install_postmsi_Cpu64, returned True            <br /> 2014-02-08 04:39:57 Slp: ---- Flush datastore cache before calling configuration action 'SQL_DTS_VSTAConfiguration_install_Cpu64'            <br /> 2014-02-08 04:39:57 Slp: ---- Flush datastore cache before calling configuration action 'SQL_DTS_VSTAConfiguration_install_Cpu64'            <br /> 2014-02-08 04:39:57 Slp: ----------------------------------------------------------------------            <br /> 2014-02-08 04:39:57 Slp: Running Action: SQL_DTS_VSTAConfiguration_install_Cpu64            <br /> 2014-02-08 04:39:57 Slp: Action Data:            <br /> 2014-02-08 04:39:57 Slp:&#160;&#160; Feature = SQL_DTS_Full_sql_is_Cpu64            <br /> 2014-02-08 04:39:57 Slp:&#160;&#160; Scenario = install            <br /> 2014-02-08 04:39:57 Slp:&#160;&#160; Timing = ConfigNonRC            <br /> 2014-02-08 04:39:57 Slp:&#160;&#160; ConfigObjectType = Microsoft.SqlServer.Configuration.SSIS.VSTAConfigurationPrivate            <br /> 2014-02-08 04:39:57 Slp:&#160;&#160; FeatureName = SQL_DTS_Full            <br /> 2014-02-08 04:39:57 Slp:&#160;&#160; FeatureCpuType = Cpu64            <br /> 2014-02-08 04:39:57 Slp:&#160;&#160; FeaturePackageId = sql_is            <br /> 2014-02-08 04:39:58 Slp: Sco: Attempting to create base registry key HKEY_LOCAL_MACHINE, machine             <br /> 2014-02-08 04:39:58 Slp: Sco: Attempting to open registry subkey             <br /> 2014-02-08 04:39:58 Slp: Sco: Attempting to open registry subkey SOFTWARE\Microsoft\NET Framework Setup\NDP\v3.5            <br /> 2014-02-08 04:39:58 Slp: Sco: Attempting to get registry value InstallPath            <br /> 2014-02-08 04:39:58 SSIS: Running: c:\Windows\Microsoft.NET\Framework\v3.5\AddInUtil.exe -PipelineRoot:&quot;C:\Program Files (x86)\Common Files\microsoft shared\VSTA\Pipeline&quot; -Rebuild            <br /> 2014-02-08 04:39:58 SSIS: Application succeded: c:\Windows\Microsoft.NET\Framework\v3.5\AddInUtil.exe -PipelineRoot:&quot;C:\Program Files (x86)\Common Files\microsoft shared\VSTA\Pipeline&quot; -Rebuild            <br /> 2014-02-08 04:39:58 Slp: Sco: Attempting to create base registry key HKEY_LOCAL_MACHINE, machine             <br /> 2014-02-08 04:39:58 Slp: Sco: Attempting to open registry subkey             <br /> 2014-02-08 04:39:58 Slp: Sco: Attempting to open registry subkey SOFTWARE\Microsoft\VSTA\9.0            <br /> 2014-02-08 04:39:58 Slp: Sco: Attempting to get registry value InstallDir            <br /> 2014-02-08 04:39:58 <strong><font color="#ff0000">SSIS: Running: C:\Program Files (x86)\Microsoft Visual Studio 9.0\Common7\IDE\vsta.exe /hostid SSIS_ScriptTask /setup</font></strong></p>       </td>     </tr>   </tbody></table>        <p>We found that the the following Visual studio components were previously installed on the server before installing SQL Server</p>  <ul>   <li><strong>Visual Studio Tools for Applications 2.0 </strong></li>    <li><strong>Visual Studio 2008 Shell (integrated mode)</strong> </li> </ul>  <p>The above issue happens to be due to the incompatibility of SQL Server with either a Visual Studio or .NET framework component</p>  <p>The incompatibility is explained in detail the blog :<a title="http://blogs.msdn.com/b/psssql/archive/2008/08/11/sql-server-2008-visual-studio-2008-sp1-and-net-framework-3-5-sp1-explained.aspx" href="http://blogs.msdn.com/b/psssql/archive/2008/08/11/sql-server-2008-visual-studio-2008-sp1-and-net-framework-3-5-sp1-explained.aspx">http://blogs.msdn.com/b/psssql/archive/2008/08/11/sql-server-2008-visual-studio-2008-sp1-and-net-framework-3-5-sp1-explained.aspx</a></p>    <p>We see these Stalls in the setup when it is trying to install the below components only</p>  <ul>   <li><strong>Business Intelligence Development Studio</strong></li>    <li><strong>Integration Services</strong></li>    <li><strong>Management Tools (Either Basic or Full)</strong></li> </ul>    <p>Since this was a new server which was going to be a dedicated SQL server we <u>Uninstalled the following components from the control panel</u> </p>  <p><strong>Visual Studio Tools for Applications 2.0      <br /> Visual Studio 2008 Shell (integrated mode)       <br /> SQL server Compact Edition </strong></p>  <p><strong>Repaired the .NET Framework 3.5 SP1 and then re-run the SQL setup</strong></p>    <p><font size="2">In most cases the issue is very clear with the Setup giving us a failed rule      <br /></font><font size="2">Rule &quot;<strong>Previous releases of Microsoft Visual Studio 2008&quot; failed</strong></font></p>  <p><a href="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/63/52/metablogapi/1830.image_7D4A40DA.png" original-url="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-63-52-metablogapi/1830.image_5F00_7D4A40DA.png"><img title="image" style="display: inline; background-image: none;" border="0" alt="image" src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/63/52/metablogapi/7484.image_thumb_18630FE9.png" original-url="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-63-52-metablogapi/7484.image_5F00_thumb_5F00_18630FE9.png" width="298" height="130" /></a></p>  <p><font size="2">But in our case, the setup <strong>only hung with No error messages or failed rule</strong> except for the&#160; the warning for VS template in the System log .</font></p>  <p>   <br /></p>      <table cellspacing="0" cellpadding="2" width="800" border="1"><tbody>     <tr>       <td valign="top" width="800">         <p>As summarized in the blog : <a title="http://blogs.msdn.com/b/psssql/archive/2008/08/11/sql-server-2008-visual-studio-2008-sp1-and-net-framework-3-5-sp1-explained.aspx" href="http://blogs.msdn.com/b/psssql/archive/2008/08/11/sql-server-2008-visual-studio-2008-sp1-and-net-framework-3-5-sp1-explained.aspx">http://blogs.msdn.com/b/psssql/archive/2008/08/11/sql-server-2008-visual-studio-2008-sp1-and-net-framework-3-5-sp1-explained.aspx</a> we could follow the below steps based on environment (However If this dedicated Database server the easiest option would be uninstall the VS components before installing SQL server and reinstall them after the SQL setup is complete)</p>          <p>1) If you don't have Visual Studio 2008 installed and have never installed a SQL Server 2008 CTP build, SQL Server 2008 RTM comes with everything you need and you should not encounter this problem.</p>          <p>2) If have Visual Studio 2008 installed, you must install VS 2008 SP1 before you install SQL Server 2008 RTM (or don't pick features that require it -BIDS, Management Studio, SSIS)</p>          <p>3) If you do not have VS 2008 installed but are encountering this problem, do not attempt to install VS 2008 SP1. Rather, uninstall Visual Studio 2008 Shell (integrated mode) and Visual Studio Tools for Applications 2.0. You should then be allowed to proceed with the installation.</p>          <p>4) SQL Server 2008 RTM comes with the .Net Framework 3.5 SP1 final release. This requirement is independent of the binaries we need from VS 2008 SP1. There is no need for you to run any update to the .Net Framework after installing SQL Server 2008.</p>          <p>5) If you install Visual Studio 2008 RTM after installing SQL Server 2008 RTM, you must install VS 2008 SP1 to be supported if you are using the features in SQL Server that depend on VS 2008 SP1 (BIDS, Integration Services, or Management Tools           <br /></p>       </td>     </tr>   </tbody></table>    <p>Related Blogs : <a title="http://blogs.msdn.com/b/guil/archive/2008/12/14/sql-server-2008-installation-dependency-problems-with-visual-studio-2008-sp1.aspx" href="http://blogs.msdn.com/b/guil/archive/2008/12/14/sql-server-2008-installation-dependency-problems-with-visual-studio-2008-sp1.aspx">http://blogs.msdn.com/b/guil/archive/2008/12/14/sql-server-2008-installation-dependency-problems-with-visual-studio-2008-sp1.aspx</a></p>  <p><a title="http://blogs.msdn.com/b/psssql/archive/2008/08/11/sql-server-2008-visual-studio-2008-sp1-and-net-framework-3-5-sp1-explained.aspx" href="http://blogs.msdn.com/b/psssql/archive/2008/08/11/sql-server-2008-visual-studio-2008-sp1-and-net-framework-3-5-sp1-explained.aspx">http://blogs.msdn.com/b/psssql/archive/2008/08/11/sql-server-2008-visual-studio-2008-sp1-and-net-framework-3-5-sp1-explained.aspx</a></p>]]></content:encoded>
    </item>
  </channel>
</rss>