<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:content="http://purl.org/rss/1.0/modules/content/">
  <channel>
    <title>Sql-Managed-Instance on Mark Allison</title>
    <link>https://markallison.co.uk/tags/sql-managed-instance/</link>
    <description>Recent content in Sql-Managed-Instance on Mark Allison</description>
    <image>
      <title>Mark Allison</title>
      <url>https://markallison.co.uk/%3Clink%20or%20path%20of%20image%20for%20opengraph,%20twitter-cards%3E</url>
      <link>https://markallison.co.uk/%3Clink%20or%20path%20of%20image%20for%20opengraph,%20twitter-cards%3E</link>
    </image>
    <generator>Hugo -- 0.151.2</generator>
    <language>en</language>
    <lastBuildDate>Tue, 08 Aug 2023 11:24:22 +0100</lastBuildDate>
    <atom:link href="https://markallison.co.uk/tags/sql-managed-instance/index.xml" rel="self" type="application/rss+xml" />
    <item>
      <title>SQLMI Restore Blob Storage Access Denied</title>
      <link>https://markallison.co.uk/blog/sqlmi-restore-blob-storage-access-denied/</link>
      <pubDate>Tue, 08 Aug 2023 11:24:22 +0100</pubDate>
      <guid>https://markallison.co.uk/blog/sqlmi-restore-blob-storage-access-denied/</guid>
      <description>&lt;p&gt;If you are using Azure SQL Managed Instance and encounter an error like this when restoring a database from an Azure Blob Storage container:&lt;/p&gt;
&lt;div class=&#34;admonition admonition-failure&#34;&gt;
  &lt;p class=&#34;admonition-title&#34;&gt;
      Msg 3201, Level 16, State 2, Line 1 
  &lt;/p&gt;
  &lt;div class=&#34;admonition-content&#34;&gt;
    
Cannot open backup device &#39;https://{storage-account}.blob.core.windows.net/my-container/mydb/FULL/mydb-backup.bak&#39;. Operating system error 5(Access is denied.).

  &lt;/div&gt;
&lt;/div&gt;

&lt;p&gt;You can try the following steps to fix it:&lt;/p&gt;
&lt;h2 id=&#34;1-check-the-sas-token-and-generate-a-new-one-if-needed&#34;&gt;1. Check the SAS token and generate a new one if needed.&lt;/h2&gt;
&lt;p&gt;The most common cause of this error is that the SAS token used to access the Azure Blob Storage container has expired or is invalid. A SAS token is a shared access signature that grants limited access to a resource in Azure. You can generate a SAS token for your Azure Blob Storage container using the Azure portal, PowerShell, CLI, or SDK.&lt;/p&gt;</description>
    </item>
    <item>
      <title>Sql Server SPID -5</title>
      <link>https://markallison.co.uk/blog/sql-spid-5/</link>
      <pubDate>Wed, 23 Feb 2022 10:39:18 +0000</pubDate>
      <guid>https://markallison.co.uk/blog/sql-spid-5/</guid>
      <description>&lt;p&gt;I had an interesting issue today when a colleague was running a long running IO intensive query. I ran &lt;code&gt;sp_who2&lt;/code&gt; to view the activity and saw that the query was running multi-threaded, but was blocked by a SPID of -5.&lt;/p&gt;
&lt;p&gt;Yes, that&amp;rsquo;s SPID minus five, or negative five. (putting this here so that google searches maybe work?).&lt;/p&gt;
&lt;figure&gt;
    &lt;img src=&#34;2022-02-21_15-28-35.jpg&#34; alt=&#34;&#34; /&gt;
    
      &lt;figcaption&gt;blocking SPID -5&lt;/figcaption&gt;
    
&lt;/figure&gt;
  
&lt;h2 id=&#34;google-not-working&#34;&gt;Google not working&lt;/h2&gt;
&lt;p&gt;I tried to use Google to get information on this but it seems that Google doesn&amp;rsquo;t allow you to search for negative numbers. So searching for &lt;code&gt;SPID -5&lt;/code&gt; doesn&amp;rsquo;t show any decent information to understand what&amp;rsquo;s going on.&lt;/p&gt;</description>
    </item>
    <item>
      <title>Run DBCC CHECKDB?</title>
      <link>https://markallison.co.uk/blog/sqlmi-checkdb/</link>
      <pubDate>Wed, 16 Feb 2022 09:20:58 +0000</pubDate>
      <guid>https://markallison.co.uk/blog/sqlmi-checkdb/</guid>
      <description>&lt;p&gt;As a standard practise for IaaS and on-premises SQL Servers, I usually like to install &lt;a href=&#34;https://ola.hallengren.com/sql-server-integrity-check.html&#34;&gt;Ola Hallengren&amp;rsquo;s maintenance scripts&lt;/a&gt;. Why invent the wheel when we already have a super-shiny one? These scripts include integrity checks, which run DBCC CHECKDB.&lt;/p&gt;
&lt;h2 id=&#34;is-dbcc-checkdb-needed-anymore&#34;&gt;Is DBCC CHECKDB needed anymore?&lt;/h2&gt;
&lt;p&gt;It depends. 😉&lt;/p&gt;
&lt;p&gt;It comes down to a cost/benefit analysis.&lt;/p&gt;
&lt;p&gt;I have been working with Sql Managed Instances quite closely over the past couple of years and wondered whether DBCC CHECKDB needs to be run on these. The whole point of CHECKDB is to notify us that something is wrong but also to &lt;em&gt;do something&lt;/em&gt; if the database becomes corrupt in some way. They are very IO intensive operations which can impact user queries on the server.&lt;/p&gt;</description>
    </item>
    <item>
      <title>Connect to SQLMI with Managed Identity</title>
      <link>https://markallison.co.uk/blog/connect-mi-with-managedidentity/</link>
      <pubDate>Wed, 11 Aug 2021 15:42:06 +0100</pubDate>
      <guid>https://markallison.co.uk/blog/connect-mi-with-managedidentity/</guid>
      <description>&lt;p&gt;Consider the scenario where some PowerShell scripts need to be scheduled on an Azure virtual machine, which connects to an Azure SQL Managed Instance.&lt;/p&gt;
&lt;p&gt;The PowerShell script needs to run on a schedule and must be able to connect to the managed instance securely. You would rather not have to manage passwords.&lt;/p&gt;
&lt;p&gt;What&amp;rsquo;s the best way to do this? You guessed it, &lt;strong&gt;Managed Identity&lt;/strong&gt;. This post will describe two ways of doing it, one using Azure AD with a Managed Identity and one using SQL Authentication and Azure Key Vault using a &lt;strong&gt;Service Principal&lt;/strong&gt;.&lt;/p&gt;</description>
    </item>
    <item>
      <title>SQL Managed Instance Server Audit Fails</title>
      <link>https://markallison.co.uk/blog/mi-server-audit-fails/</link>
      <pubDate>Thu, 05 Aug 2021 08:56:42 +0100</pubDate>
      <guid>https://markallison.co.uk/blog/mi-server-audit-fails/</guid>
      <description>&lt;p&gt;I have set up server auditing for some managed instances in the same virtual cluster to record login success and failed events and write them to blob storage.&lt;/p&gt;
&lt;p&gt;Downstream, an ADF pipeline reads the events asynchronously and inserts them into a database for further analysis and reporting.&lt;/p&gt;
&lt;h2 id=&#34;server-audit-stops-writing&#34;&gt;Server audit stops writing&lt;/h2&gt;
&lt;p&gt;Recently the server audit stopped writing to blob storage, even though the server audit status was still running and enabled. I have seen failures before where the server audit failed because of an expiring SAS token, but in this case the SAS token has a long expiry date, so know it&amp;rsquo;s not that.&lt;/p&gt;</description>
    </item>
    <item>
      <title>Minimum data file size on MI is 128 GB!</title>
      <link>https://markallison.co.uk/blog/mi-exceeds-storage-account-size/</link>
      <pubDate>Mon, 10 May 2021 17:15:11 +0100</pubDate>
      <guid>https://markallison.co.uk/blog/mi-exceeds-storage-account-size/</guid>
      <description>&lt;h2 id=&#34;storage-underlying-a-managed-instance&#34;&gt;Storage underlying a Managed Instance&lt;/h2&gt;
&lt;p&gt;Microsoft Azure should not require you to have deep understanding of the underlying technologies used to provide the service, after all the whole point of PaaS is to abstract you away from implementation details. One of these details is storage of data files in the file system.&lt;/p&gt;
&lt;p&gt;When provisioning a General Tier Sql Managed Instance, the maximum storage size for the instance is capped at 8 TB. However this is not the whole story and it&amp;rsquo;s important to understand some of what is happening under the covers, especially if you are migrating an on-premises SQL Server instance to the cloud that contains a lot of databases or uses partitioning.&lt;/p&gt;</description>
    </item>
    <item>
      <title>⚠ Careful with Maintenance Window</title>
      <link>https://markallison.co.uk/blog/managedinstance-maintenancewindow/</link>
      <pubDate>Fri, 19 Mar 2021 13:41:54 +0000</pubDate>
      <guid>https://markallison.co.uk/blog/managedinstance-maintenancewindow/</guid>
      <description>&lt;h2 id=&#34;maintenance-window-now-in-preview&#34;&gt;Maintenance Window now in Preview&lt;/h2&gt;
&lt;p&gt;(at the time of writing)&lt;/p&gt;
&lt;p&gt;On 2nd March 2021, &lt;a href=&#34;https://techcommunity.microsoft.com/t5/azure-sql/maintenance-window-for-azure-sql-database-and-managed-instance/ba-p/2174835&#34;&gt;Microsoft announced&lt;/a&gt; a long-awaited feature, at least by me, to give choice over when OS and SQL patching occurs behind-the-scenes in Azure SQL Managed Instance. Before this feature, Microsoft would patch the Virtual Cluster supporting Managed Instances outside of regular business hours in the region your Managed Instance is located.&lt;/p&gt;
&lt;p&gt;You now get &lt;strong&gt;two&lt;/strong&gt; additional options:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Weekday window, 10PM to 6AM local time Monday – Thursday&lt;/li&gt;
&lt;li&gt;Weekend window, 10PM to 6AM local time Friday - Sunday&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;System default:&lt;/p&gt;</description>
    </item>
    <item>
      <title>EXECUTE denied on Managed Instance</title>
      <link>https://markallison.co.uk/blog/regread-failure-on-mi/</link>
      <pubDate>Wed, 17 Mar 2021 12:20:04 +0000</pubDate>
      <guid>https://markallison.co.uk/blog/regread-failure-on-mi/</guid>
      <description>&lt;h2 id=&#34;the-problem&#34;&gt;The problem&lt;/h2&gt;
&lt;p&gt;I came across an interesting (!) issue with an Azure Sql Managed Instance today. One of our users came across this error when trying to &lt;code&gt;SELECT&lt;/code&gt; from a view in a database where they are not a member of the &lt;code&gt;db_owner&lt;/code&gt; database role or any elevated server-level permission by right clicking the view in SSMS 18.8 and choosing &lt;strong&gt;Select Top 1000 Rows&lt;/strong&gt;.&lt;/p&gt;
&lt;figure&gt;
    &lt;img src=&#34;2021-03-17_11-40-04.png&#34; alt=&#34;&#34; /&gt;
    
      &lt;figcaption&gt;Select Top 1000 Rows in SSMS&lt;/figcaption&gt;
    
&lt;/figure&gt;
  
&lt;figure&gt;
    &lt;img src=&#34;2021-03-17_11-40-44.png&#34; alt=&#34;&#34; /&gt;
    
      &lt;figcaption&gt;EXECUTE denied on xp_instance_reg_read in mssqlsystemresource&lt;/figcaption&gt;
    
&lt;/figure&gt;
  
&lt;p&gt;The full text of the error is &lt;code&gt;The EXECUTE permission was denied on the object &#39;xp_instance_regread&#39;, database &#39;mssqlsystemresource&#39;, schema &#39;sys&#39;.&lt;/code&gt;
I verified that this was indeed the case with:&lt;/p&gt;</description>
    </item>
    <item>
      <title>Az.Sql Module won&#39;t load</title>
      <link>https://markallison.co.uk/blog/az-sql-module/</link>
      <pubDate>Tue, 16 Mar 2021 18:17:22 +0000</pubDate>
      <guid>https://markallison.co.uk/blog/az-sql-module/</guid>
      <description>&lt;p&gt;Today, the &lt;code&gt;Az.Sql&lt;/code&gt; module would not load on my machine when attempting to manually fail over a SQL Managed Instance with this error:&lt;/p&gt;
&lt;figure&gt;
    &lt;img src=&#34;2021-03-16_18-19-15.png&#34; alt=&#34;&#34; /&gt;
    
      &lt;figcaption&gt;module could not be loaded&lt;/figcaption&gt;
    
&lt;/figure&gt;
  
&lt;p&gt;I followed the advice of the error message and tried to import the module to get further information.&lt;/p&gt;
&lt;figure&gt;
    &lt;img src=&#34;2021-03-16_18-19-54.png&#34; alt=&#34;&#34; /&gt;
    
      &lt;figcaption&gt;module is already loaded&lt;/figcaption&gt;
    
&lt;/figure&gt;
  
&lt;p&gt;Hmmm :thinking:&lt;/p&gt;
&lt;p&gt;I decided to uninstall the Azure PowerShell from my machine using the Windows 10 Settings App. Looks like an old version.&lt;/p&gt;</description>
    </item>
  </channel>
</rss>
