<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>TempDB Archives - The SERO Group</title>
	<atom:link href="https://theserogroup.com/tag/tempdb/feed/" rel="self" type="application/rss+xml" />
	<link>https://theserogroup.com/tag/tempdb/</link>
	<description>SQL Servers Healthy, Secure, And Reliable</description>
	<lastBuildDate>Tue, 16 Dec 2025 18:34:56 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=6.9</generator>

<image>
	<url>https://theserogroup.com/wp-content/uploads/2024/07/cropped-Canister-only-1-32x32.png</url>
	<title>TempDB Archives - The SERO Group</title>
	<link>https://theserogroup.com/tag/tempdb/</link>
	<width>32</width>
	<height>32</height>
</image> 
<site xmlns="com-wordpress:feed-additions:1">121220030</site>	<item>
		<title>Why Quiet Reflection Leads to Better IT Strategy Decisions</title>
		<link>https://theserogroup.com/azure/why-quiet-reflection-leads-to-better-it-strategy-decisions/</link>
		
		<dc:creator><![CDATA[Joe Webb]]></dc:creator>
		<pubDate>Wed, 17 Dec 2025 13:00:04 +0000</pubDate>
				<category><![CDATA[Azure]]></category>
		<category><![CDATA[Data Security]]></category>
		<category><![CDATA[DBA]]></category>
		<category><![CDATA[Events]]></category>
		<category><![CDATA[Professional Development]]></category>
		<category><![CDATA[SQL Community]]></category>
		<category><![CDATA[SQL Server]]></category>
		<category><![CDATA[SQL Server Consulting]]></category>
		<category><![CDATA[The Sero Group]]></category>
		<category><![CDATA[Clustering]]></category>
		<category><![CDATA[Clusters]]></category>
		<category><![CDATA[Database]]></category>
		<category><![CDATA[Database Administration]]></category>
		<category><![CDATA[Database Development]]></category>
		<category><![CDATA[IT Manager]]></category>
		<category><![CDATA[Microsoft Azure]]></category>
		<category><![CDATA[Public Speaking]]></category>
		<category><![CDATA[Script Library]]></category>
		<category><![CDATA[Sero]]></category>
		<category><![CDATA[Sero Group]]></category>
		<category><![CDATA[Serogroup]]></category>
		<category><![CDATA[Shared Disks]]></category>
		<category><![CDATA[SQL]]></category>
		<category><![CDATA[SQL Assessment]]></category>
		<category><![CDATA[SQL Audit]]></category>
		<category><![CDATA[SQL Conference]]></category>
		<category><![CDATA[SQL Consultant]]></category>
		<category><![CDATA[SQL Events]]></category>
		<category><![CDATA[SQL Security]]></category>
		<category><![CDATA[SQL Server Consultant]]></category>
		<category><![CDATA[SQL Server Management]]></category>
		<category><![CDATA[SQL Training]]></category>
		<category><![CDATA[TempDB]]></category>
		<guid isPermaLink="false">https://theserogroup.com/?p=7691</guid>

					<description><![CDATA[<p>Last Saturday, I woke up before dawn to a quiet house. My family was still asleep, as I’m the only morning person in our household. The Christmas tree lights cast a warm glow across the room, and I was alone with my thoughts and a hot cup of coffee. No urgent emails, no fire drills,&#8230; <br /> <a class="read-more" href="https://theserogroup.com/azure/why-quiet-reflection-leads-to-better-it-strategy-decisions/">Read more</a></p>
<p>The post <a href="https://theserogroup.com/azure/why-quiet-reflection-leads-to-better-it-strategy-decisions/">Why Quiet Reflection Leads to Better IT Strategy Decisions</a> appeared first on <a href="https://theserogroup.com">The SERO Group</a>.</p>
]]></description>
										<content:encoded><![CDATA[
<p>Last Saturday, I woke up before dawn to a quiet house. My family was still asleep, as I’m the only morning person in our household. The Christmas tree lights cast a warm glow across the room, and I was alone with my thoughts and a hot cup of coffee. No urgent emails, no fire drills, no meetings starting in five minutes. Just space to think.</p>



<p>As I sat there, I ended up reflecting back on 2025. I found myself gravitating to these three questions:</p>



<ul class="wp-block-list">
<li>What went well this year?</li>



<li>What did I learn?</li>



<li>What should I focus on next year?</li>
</ul>



<p>If you’re a leader, I’m guessing you rarely get this kind of thinking time during your workday. I know I don’t. Our calendars are packed with calls, team meetings, and those &#8220;quick questions” that turn into two-hour troubleshooting sessions.</p>



<p>But here&#8217;s what I&#8217;ve learned: <strong>the quality of your strategic decisions is directly tied to the quality of your thinking time.</strong></p>



<p>And thinking time doesn&#8217;t happen by accident. You have to protect it.</p>



<h3 class="wp-block-heading" id="h-what-went-well-this-year">What Went Well This Year?</h3>



<p>When I asked myself this question, I didn&#8217;t think about our biggest projects or flashiest achievements. I didn&#8217;t think about when we migrated almost 2,000 databases as part of an upgrade project. Or the performance tuning we did that resulted in a $36,000 reduction in annual Azure spend for a client. </p>



<p>Instead, I thought about the relationships we strengthened. The trust we built with clients. The problems we solved before they became crises.</p>



<p>For you, this might look like:</p>



<ul class="wp-block-list">
<li>The audit that went smoothly because your security documentation was solid</li>



<li>The successful disaster recovery test that was possible because you kept refining the process</li>



<li>The team member you mentored who&#8217;s now ready for more responsibility</li>



<li>The support resources you provided your team through a trusted partner</li>
</ul>



<p>These aren&#8217;t always the things that make it into board reports. But they&#8217;re the foundation that everything else is built on.</p>



<h3 class="wp-block-heading" id="h-what-did-i-learn">What Did I Learn?</h3>



<p>This year reminded me of something Eisenhower once said: <strong>&#8220;Plans are worthless, but planning is everything.&#8221;</strong></p>



<p>The need for planning cannot be overstated. It&#8217;s critical. Even if the plan doesn&#8217;t always work out the way you intended. </p>



<p><strong>The plan itself wasn&#8217;t the point. The thinking I did while creating the plan was the point.</strong></p>



<p>Because I’d thought through our capacity, our ideal client profile, and our service delivery model, I could adjust quickly when reality didn’t match my spreadsheet. I knew which opportunities were a good fit for us and which ones to let go. Because we’ve intentionally built a small but incredibly talented team that genuinely wants to see our clients succeed, we were able to identify and create ways to help them.</p>



<p>I watched the same dynamic play out with clients. The institutions that had documented their SQL Server environments, tested their disaster recovery plans, and mapped their compliance requirements adapted quickly when needed. They were positioned for success even when the unexpected happened.</p>



<p>Planning isn&#8217;t about predicting the future. It&#8217;s about <strong>building the muscle memory to respond when the future surprises you.</strong></p>



<p>What did you learn this year about planning and adapting? Maybe it was:</p>



<ul class="wp-block-list">
<li>That your three-year technology roadmap needs quarterly reviews, not just annual ones</li>



<li>That the disaster recovery plan sitting in a SharePoint folder isn&#8217;t the same as a tested DR plan</li>



<li>That &#8220;we&#8217;ll address that next quarter&#8221; eventually becomes &#8220;why didn&#8217;t we address this sooner?&#8221;</li>



<li>That having an expert on call beats having a plan to find an expert when something breaks</li>
</ul>



<p>These lessons matter. Write them down. They&#8217;re not just hindsight—they&#8217;re your blueprint for better decisions ahead.</p>



<h3 class="wp-block-heading" id="h-what-should-i-focus-on-next-year">What Should I Focus On Next Year?</h3>



<p>For me, the answer was clear: <strong>I need to help more financial institutions and healthcare organizations understand that they have options.</strong> Most CIOs think they have two choices for database management: hire a full-time DBA (expensive and hard to find) or make do with whoever can &#8220;figure it out&#8221; (risky and unsustainable).</p>



<p>There&#8217;s a third option: fractional DBA services that give you expert oversight without the full-time price tag. </p>



<p>For you, your focus might be different. Maybe it&#8217;s:</p>



<ul class="wp-block-list">
<li>Finally getting your SQL Server environment documented and audit-ready</li>



<li>Building a disaster recovery plan that you&#8217;ve actually tested</li>



<li>Move a little further along the <a href="https://theserogroup.com/data-strategy/sql-server-maturity-curve-how-banks-move-from-reactive-risk-to-strategic-advantage/">SQL Server Maturity Curve</a></li>



<li>Finding a partner who understands banking compliance, not just databases</li>
</ul>



<p>Whatever it is, the key is to actually choose something. Not everything. Something. And move toward it. Make progress.</p>



<h3 class="wp-block-heading" id="h-the-power-of-quiet-reflection">The Power of Quiet Reflection</h3>



<p>Here&#8217;s the thing about those early Saturday morning moments: they&#8217;re rare. And precious. </p>



<p>During the week, we’re in execution mode. We’re responding, reacting, solving, and fixing. That’s necessary work. But it’s not strategic work.</p>



<p>Strategic work requires space. It requires stepping back from the urgent to focus on the important.</p>



<p>So, here&#8217;s my challenge to you as we wind down 2025 and usher in the new year:</p>



<h3 class="wp-block-heading" id="h-block-off-time-just-to-think-then-protect-it">Block Off Time Just to Think, Then Protect It</h3>



<p>Maybe it&#8217;s Saturday mornings before your family wakes up. Maybe it&#8217;s a long walk at lunch. Maybe it&#8217;s 90 minutes with your calendar blocked and your office door closed. </p>



<p>Whatever it is, protect it. The decisions you make during that quiet time about where to focus, what risks to address, and which partnerships to invest in will help shape your entire year.</p>



<h3 class="wp-block-heading" id="h-your-turn">Your Turn</h3>



<p>As you think about the year ahead, I&#8217;d encourage you to ask yourself those three questions:</p>



<ol class="wp-block-list">
<li>What went well this year? Celebrate it. Learn from it.</li>



<li>What did I learn? Write it down. It&#8217;s wisdom you paid for.</li>



<li>What should I focus on next year? Pick one or two things. Not everything.</li>
</ol>



<p>And if one of those focus areas is &#8220;finally get our SQL Server environment to a place where I&#8217;m confident, not just hopeful,&#8221; let&#8217;s talk. That&#8217;s exactly what we help institutions do.</p>



<p>If you&#8217;re a CIO wondering whether your SQL Server environment is as healthy and secure as it should be, I&#8217;d be happy to have a conversation. No sales pitch. Just two people talking candidly about database management. <a href="https://theserogroup.com/contact-us/" target="_blank" rel="noreferrer noopener">Schedule a time here</a>.</p>
<p>The post <a href="https://theserogroup.com/azure/why-quiet-reflection-leads-to-better-it-strategy-decisions/">Why Quiet Reflection Leads to Better IT Strategy Decisions</a> appeared first on <a href="https://theserogroup.com">The SERO Group</a>.</p>
]]></content:encoded>
					
		
		
		<post-id xmlns="com-wordpress:feed-additions:1">7691</post-id>	</item>
		<item>
		<title>Is your SQL Server Code Ready for Azure?</title>
		<link>https://theserogroup.com/azure/azure-sql-migration-code/</link>
		
		<dc:creator><![CDATA[Natasha Collins]]></dc:creator>
		<pubDate>Wed, 26 Jun 2024 12:00:00 +0000</pubDate>
				<category><![CDATA[Azure]]></category>
		<category><![CDATA[Database]]></category>
		<category><![CDATA[Database Administration]]></category>
		<category><![CDATA[Database Development]]></category>
		<category><![CDATA[IT Manager]]></category>
		<category><![CDATA[Microsoft Azure]]></category>
		<category><![CDATA[Sero]]></category>
		<category><![CDATA[Sero Group]]></category>
		<category><![CDATA[Serogroup]]></category>
		<category><![CDATA[Shared Disks]]></category>
		<category><![CDATA[SQL]]></category>
		<category><![CDATA[SQL Consultant]]></category>
		<category><![CDATA[SQL Security]]></category>
		<category><![CDATA[SQL Server]]></category>
		<category><![CDATA[SQL Server Consultant]]></category>
		<category><![CDATA[SQL Server Management]]></category>
		<category><![CDATA[TempDB]]></category>
		<category><![CDATA[The Sero Group]]></category>
		<guid isPermaLink="false">https://theserogroup.com/?p=6078</guid>

					<description><![CDATA[<p>I recently had a discussion with a client that turned to the question of SQL Server code compatibility with Azure SQL Database. We were designing a new pipeline for their on-premises SQL environment, and they mentioned their abandoned cloud migration effort from a few years earlier. The business ended up pausing this effort because of&#8230; <br /> <a class="read-more" href="https://theserogroup.com/azure/azure-sql-migration-code/">Read more</a></p>
<p>The post <a href="https://theserogroup.com/azure/azure-sql-migration-code/">Is your SQL Server Code Ready for Azure?</a> appeared first on <a href="https://theserogroup.com">The SERO Group</a>.</p>
]]></description>
										<content:encoded><![CDATA[
<p>I recently had a discussion with a client that turned to the question of SQL Server code compatibility with Azure SQL Database. We were designing a new pipeline for their on-premises SQL environment, and they mentioned their abandoned cloud migration effort from a few years earlier. The business ended up pausing this effort because of code incompatibilities that would have required an unexpected amount of re-engineering. After that experience, they wanted to ensure that any new pipeline development was done while being mindful of a possible future migration.</p>



<h2 class="wp-block-heading" id="h-the-risks-of-delaying-code-analysis">The risks of delaying code analysis</h2>



<p>Delaying an analysis of code compatibility is surprisingly common for businesses undertaking a migration to the cloud. Early cost-benefit analyses often address the hardware and infrastructure changes involved but can sometimes neglect to consider the impact of required code changes.</p>



<p>Infrastructure concerns are critical considerations when evaluating a move to the cloud. However, limiting our analysis to these considerations may hide the costs and risks associated with any necessary re-engineering.&nbsp;Unfortunately, it is very possible for these hidden risks and costs to turn out to be deal-breakers. To avoid a sticky situation, learn about these factors up front before investing time and energy into migration preparations.</p>



<h2 class="wp-block-heading" id="h-azure-options-sql-vm-vs-managed-instance-vs-sql-database">Azure options: SQL VM vs. Managed Instance vs. SQL Database</h2>



<p>It is important to note that a “move to the cloud” can come in many forms. Some examples are migrations to a hybrid environment, “lift and shift” moves to Azure-hosted VMs or SQL Managed Instances (SQL MI), or full or partial migrations to multi-tenant Azure SQL Databases (SQL DB). You will need to know what type of migration is being considered before evaluating code changes since the different options have different levels of compatibility with SQL Server.<br><br>Here&#8217;s a quick breakdown of the options in Azure with SQL Server compatibility.</p>



<h3 class="wp-block-heading">IaaS Option</h3>



<p><a href="https://learn.microsoft.com/en-us/azure/azure-sql/virtual-machines/windows/sql-server-on-azure-vm-iaas-what-is-overview?view=azuresql">SQL Server on an Azure VM</a><br>Since this option constitutes a full installation of SQL Server on a dedicated Azure-hosted virtual machine, there are no code or feature incompatibilities to be concerned about. Azure SQL VMs achieve complete feature parity with on-premises SQL environments. With this option, the primary difference between the Azure implementation and an on-premises installation is the management of the underlying server.</p>



<h3 class="wp-block-heading">PaaS Options</h3>



<p><a href="https://learn.microsoft.com/en-us/azure/azure-sql/managed-instance/sql-managed-instance-paas-overview?view=azuresql">Azure SQL Managed Instance</a><br>SQL MI boasts “near 100% compatibility” with the latest Enterprise Edition of the SQL Server database engine, while still including automated backups, patching, and high availability of the SQL environment. This option uses a single-tenant database engine intended to enable the least disruptive migration from an on-premises or Azure-hosted SQL Server instance to a full PaaS environment. This means that many of the incompatibilities that exist with Azure SQL Database are minimized or eliminated with Azure SQL MI. However, functionality that requires access to the file system or OS is still impacted.</p>



<p><a href="https://learn.microsoft.com/en-us/azure/azure-sql/managed-instance/sql-managed-instance-paas-overview?view=azuresql">Azure SQL Database</a><br>Azure SQL DB is another fully managed PaaS option consisting of a multi-tenant database engine that is optimized for cloud-native applications. While this option is generally less expensive than Azure SQL MI, there is less overlap with SQL Server and greater potential for code or data flow incompatibilities.</p>



<h2 class="wp-block-heading">10 Common Incompatibilities</h2>



<p>There are several very helpful tools (see the &#8220;Resources and tools&#8221; section below) that can help you identify data flow issues prior to migration. As you go through your analysis, keep in mind that Microsoft has established workarounds for a good number of these incompatibilities, so their presence in your code does not necessarily mean they are a barrier to migration.</p>



<p>For a high-level overview, here are some of the most common sticking points we see for migrating SQL code. The differences between SQL MI and SQL DB are included where applicable, as well as some potential workarounds.</p>



<h3 class="wp-block-heading" id="h-1-uses-linked-servers">1. Uses linked servers</h3>



<p>Linked servers can be used in <a href="https://learn.microsoft.com/en-us/azure/azure-sql/managed-instance/transact-sql-tsql-differences-sql-server?view=azuresql#linked-servers">SQL MI</a> to access SQL Server and Azure SQL Databases without distributed transactions. SQL DB requires the use of <a href="https://learn.microsoft.com/en-us/azure/azure-sql/database/elastic-query-horizontal-partitioning?view=azuresql">elastic queries</a> instead.</p>



<h3 class="wp-block-heading" id="h-2-performs-cross-database-queries-or-transactions">2. Performs cross-database queries or transactions</h3>



<p>These are supported with SQL MI, but not with SQL DB. In SQL DB, cross-database queries may be able to be converted to <a href="https://learn.microsoft.com/en-us/azure/azure-sql/database/elastic-query-horizontal-partitioning?view=azuresql">elastic queries</a>.</p>



<h3 class="wp-block-heading" id="h-3-uses-database-mail">3. Uses Database Mail</h3>



<p>This is available for SQL MI but not SQL DB. There are <a href="https://www.mssqltips.com/sqlservertip/7049/send-emails-azure-sql-database-azure-logic-apps/">workarounds</a> available for sending email in the Azure platform, but they will require some re-engineering.</p>



<h3 class="wp-block-heading" id="h-4-uses-system-tables-views-functions-or-stored-procedures">4. Uses system tables, views, functions, or stored procedures</h3>



<p>Some system objects are available in both SQL MI and SQL DB but not all. Consult Microsoft&#8217;s <a href="https://learn.microsoft.com/en-us/azure/azure-sql/managed-instance/transact-sql-tsql-differences-sql-server?view=azuresql">documentation</a> for a full comparison of what is available.</p>



<p>One important note is that the amount of space available to <strong>tempdb </strong>is provisioned in both SQL MI and SQL DB based on the number of cores available and the service tier licensed. Consult the documentation of each for details.</p>



<h3 class="wp-block-heading" id="h-5-accesses-windows-command-line-or-file-system">5. Accesses Windows command line or file system</h3>



<p>Neither SQL MI nor SQL DB supports direct access to the file system or the Windows command line. </p>



<p>One workaround is to migrate files to <a href="https://learn.microsoft.com/en-us/azure/storage/blobs/storage-blobs-introduction">Azure Blob Storage</a> or <a href="https://learn.microsoft.com/en-us/azure/storage/files/storage-files-introduction">Azure Files</a>. For SQL MI, with the appropriate security and firewall configurations, it is also possible to <a href="https://learn.microsoft.com/en-us/azure/azure-sql/managed-instance/point-to-site-p2s-configure?view=azuresql">establish connectivity</a> between your Managed Instance&#8217;s VNet and the location of an on-premises file share.</p>



<p>SQL MI also supports SSISDB configuration and the <a href="https://learn.microsoft.com/en-us/azure/data-factory/how-to-invoke-ssis-package-managed-instance-agent">Integration Services Catalog</a>, allowing SSIS packages to be used for file manipulation. Azure Data Factory can also be leveraged to load and transform files for both SQL MI and SQL DB. An <a href="https://learn.microsoft.com/en-us/azure/data-factory/create-azure-ssis-integration-runtime">Azure-SSIS Integration Runtime (IR)</a> can be installed and configured, and SSIS packages can be run directly from <a href="https://www.mssqltips.com/sqlservertip/6025/using-files-stored-in-azure-file-services-with-integration-services-part-1/">Azure Data Factory</a>.</p>



<h3 class="wp-block-heading" id="h-6-uses-change-data-capture-cdc">6. Uses change data capture (CDC)</h3>



<p>Change data capture is supported for SQL MI. It is also supported for <a href="https://learn.microsoft.com/en-us/azure/azure-sql/database/change-data-capture-overview?view=azuresql">SQL DB</a>, but only in the S3 service tier and above.</p>



<h3 class="wp-block-heading" id="h-7-uses-bulk-insert-or-openrowset">7. Uses BULK INSERT or OPENROWSET</h3>



<p><a href="https://learn.microsoft.com/en-us/azure/azure-sql/managed-instance/transact-sql-tsql-differences-sql-server?view=azuresql#bulk-insert--openrowset">BULK INSERT and OPENROWSET</a> are only supported from a supported Azure file source (e.g.: Azure Blob Storage or Azure Files).</p>



<h3 class="wp-block-heading" id="h-8-uses-net-framework-common-language-runtime-clr">8. Uses .NET Framework: common language runtime (CLR)</h3>



<p>CLR support is not available for SQL DB, but it is available in SQL MI with some <a href="https://learn.microsoft.com/en-us/azure/azure-sql/managed-instance/transact-sql-tsql-differences-sql-server?view=azuresql#clr">important differences</a>.</p>



<h3 class="wp-block-heading" id="h-9-sql-server-agent">9. SQL Server Agent</h3>



<p>SQL Server Agent is not available in SQL DB, and <a href="https://learn.microsoft.com/en-us/azure/azure-sql/database/elastic-jobs-overview?view=azuresql">elastic jobs</a> should be used instead. In SQL MI, SQL Server Agent is supported with <a href="https://learn.microsoft.com/en-us/azure/azure-sql/database/elastic-jobs-overview?view=azuresql">important differences</a>.</p>



<h3 class="wp-block-heading" id="h-10-uses-semantic-search">10. Uses semantic search</h3>



<p>Full-text semantic search is not available in either SQL MI or SQL DB.</p>



<h2 class="wp-block-heading" id="h-other-important-things-to-remember-when-migrating-to-a-paas-environment">Other important things to remember when migrating to a PaaS environment</h2>



<ul class="wp-block-list">
<li><strong>High availability</strong>: Since high availability is included in the PaaS offerings, SQL Server functionality and syntax connected with Always On Availability Groups is not supported.</li>



<li><strong>Maintenance</strong>: Updates, patches, backups, and restores are likewise managed automatically in the PaaS offerings. Therefore, associated T-SQL syntax will not work in SQL DB and will be different for SQL MI.</li>



<li><strong>Credential management</strong>: Windows authentication is not supported in SQL DB, and is replaced by <a href="https://learn.microsoft.com/en-us/azure/azure-sql/managed-instance/winauth-azuread-overview?view=azuresql">Windows Authentication for Microsoft Entra</a> in SQL MI.</li>



<li><strong>Collation</strong>: Catalog collation is set when an instance (SQL MI) or a database (SQL DB) is created, and it cannot be changed afterwards.</li>
</ul>



<h2 class="wp-block-heading" id="h-resources-and-tools">Resources and tools</h2>



<p>I hope this provided you with a jump-start for thinking about whether your SQL Server code is Azure-ready.</p>



<p>Here are a few more resources and tools that can help you take the next steps toward a full compatibility analysis:</p>



<ul class="wp-block-list">
<li><a href="https://learn.microsoft.com/en-us/sql/dma/dma-overview?view=sql-server-ver16">Data Migration Assistant</a> – Microsoft’s robust tool for enabling database compatibility assessments, recommendations, and migration assistance.</li>



<li><a href="https://learn.microsoft.com/en-us/azure/migrate/migrate-services-overview">Azure Migrate</a> – this service can be used as a start-to-finish hub for planning and facilitating a cloud migration.</li>



<li><em><a href="https://www.amazon.com/Pro-Database-Migration-Azure-Modernization/dp/1484282299">Pro Database Migration to Azure</a> </em>– An excellent and comprehensive book covering the best practices for successful on-premises migrations to the Azure cloud platform.</li>
</ul>



<h2 class="wp-block-heading" id="h-want-to-learn-more">Want to learn more?</h2>



<p>Want to learn more about how The SERO Group helps organizations prepare for a SQL Server cloud migration? <a href="https://theserogroup.com/contact-us/">Schedule a call</a> and let&#8217;s talk.</p>
<p>The post <a href="https://theserogroup.com/azure/azure-sql-migration-code/">Is your SQL Server Code Ready for Azure?</a> appeared first on <a href="https://theserogroup.com">The SERO Group</a>.</p>
]]></content:encoded>
					
		
		
		<post-id xmlns="com-wordpress:feed-additions:1">6078</post-id>	</item>
		<item>
		<title>Analyzing Disk Latency in Azure Virtual Machines &#8211; Part 2</title>
		<link>https://theserogroup.com/azure/analyzing-disk-latency-in-azure-virtual-machines-part-2/</link>
					<comments>https://theserogroup.com/azure/analyzing-disk-latency-in-azure-virtual-machines-part-2/#comments</comments>
		
		<dc:creator><![CDATA[Luke Campbell]]></dc:creator>
		<pubDate>Wed, 14 Feb 2024 13:00:00 +0000</pubDate>
				<category><![CDATA[Azure]]></category>
		<category><![CDATA[Database Administration]]></category>
		<category><![CDATA[Database Development]]></category>
		<category><![CDATA[IT Manager]]></category>
		<category><![CDATA[Microsoft Azure]]></category>
		<category><![CDATA[Sero]]></category>
		<category><![CDATA[Sero Group]]></category>
		<category><![CDATA[Serogroup]]></category>
		<category><![CDATA[Shared Disks]]></category>
		<category><![CDATA[SQL]]></category>
		<category><![CDATA[SQL Assessment]]></category>
		<category><![CDATA[SQL Events]]></category>
		<category><![CDATA[SQL Server]]></category>
		<category><![CDATA[SQL Server Consultant]]></category>
		<category><![CDATA[SQL Server Management]]></category>
		<category><![CDATA[SQL Training]]></category>
		<category><![CDATA[TempDB]]></category>
		<category><![CDATA[The Sero Group]]></category>
		<guid isPermaLink="false">https://theserogroup.com/?p=5701</guid>

					<description><![CDATA[<p>&#8220;I thought the cloud was supposed to be fast. Why are things moving like a sloth?&#8221; Have you heard someone complain about the speed of an application after moving it to the Microsoft Azure? Azure is a good environment, but things are not always fast in the cloud. To illustrate, in this post, we&#8217;ll review&#8230; <br /> <a class="read-more" href="https://theserogroup.com/azure/analyzing-disk-latency-in-azure-virtual-machines-part-2/">Read more</a></p>
<p>The post <a href="https://theserogroup.com/azure/analyzing-disk-latency-in-azure-virtual-machines-part-2/">Analyzing Disk Latency in Azure Virtual Machines &#8211; Part 2</a> appeared first on <a href="https://theserogroup.com">The SERO Group</a>.</p>
]]></description>
										<content:encoded><![CDATA[
<p>&#8220;I thought the cloud was supposed to be fast. Why are things moving like a sloth?&#8221; Have you heard someone complain about the speed of an application after moving it to the Microsoft Azure? Azure is a good environment, but things are not always fast in the cloud. To illustrate, in this post, we&#8217;ll review an Azure VM experiencing high disk latency and determine if the bottleneck is due to the VM size or the disk size. This is part 2 of <a href="https://theserogroup.com/azure/analyzing-disk-latency-in-azure-virtual-machines-part-1/">Analyzing Disk Latency in Azure Virtual Machines</a>. </p>



<p>The specs for the VM we&#8217;re using are:</p>



<ul class="wp-block-list">
<li>Standard B4ms (4 vcpus, 16 GiB memory) &#8211; Supports up to <strong>2880 IOPs</strong> or <strong>35 MBps.</strong></li>



<li>Target disk &#8211; Standard SSD E10 &#8211; <strong>500 IOPs</strong> or <strong>60 MBps</strong>.  This drive is capable of bursting to <strong>600</strong> <strong>IOPs</strong> or <strong>150</strong> <strong>MBps</strong>.</li>
</ul>



<p>We&#8217;ll use Microsoft&#8217;s <a href="https://learn.microsoft.com/en-us/azure-stack/hci/manage/diskspd-overview">diskspd</a> utility to generate the load using the 8kb block size.</p>



<h2 class="wp-block-heading" id="h-azure-vm-metrics-reviewing-disk-related-counters">Azure VM Metrics &#8211; Reviewing disk-related counters</h2>



<p>Using Azure VM Metrics, you can review numerous counters related to the VM and create alerts based on a set threshold.  We&#8217;re focused on the following counters within the Virtual Machine Host namespace.  Three separate charts are used.  FYI, filters can be added if you&#8217;re only interested in a specific disk.  Identify the disk LUN and then add the LUN filter to the chart.  </p>



<h3 class="wp-block-heading" id="h-disk-throughput-sec-write-and-read">Disk Throughput / Sec &#8211; Write and Read</h3>



<ul class="wp-block-list">
<li>Data Disk Write Bytes/sec</li>



<li>Data Disk Read Bytes/sec</li>
</ul>



<h3 class="wp-block-heading" id="h-disk-operations-sec-iops-write-and-read">Disk Operations / Sec (IOPs) &#8211; Write and Read</h3>



<ul class="wp-block-list">
<li>Data Disk Write Operations/sec</li>



<li>Data Disk Read Operations/sec</li>
</ul>



<h3 class="wp-block-heading" id="h-disk-latency">Disk Latency </h3>



<ul class="wp-block-list">
<li>Data Disk Latency (Preview)</li>
</ul>



<p>The screenshot below shows each one of the counters.  The time range has been set to the last 30 minutes, which refreshes every 5 minutes.</p>



<figure class="wp-block-image size-large"><a href="https://theserogroup.com/wp-content/uploads/2024/02/image-4.png"><img fetchpriority="high" decoding="async" width="1024" height="507" src="https://theserogroup.com/wp-content/uploads/2024/02/image-4-1024x507.png" alt="" class="wp-image-5731" srcset="https://theserogroup.com/wp-content/uploads/2024/02/image-4-1024x507.png 1024w, https://theserogroup.com/wp-content/uploads/2024/02/image-4-300x149.png 300w, https://theserogroup.com/wp-content/uploads/2024/02/image-4-768x381.png 768w, https://theserogroup.com/wp-content/uploads/2024/02/image-4-1536x761.png 1536w, https://theserogroup.com/wp-content/uploads/2024/02/image-4-2048x1015.png 2048w, https://theserogroup.com/wp-content/uploads/2024/02/image-4-1920x951.png 1920w" sizes="(max-width: 1024px) 100vw, 1024px" /></a></figure>



<p>In the example above, we&#8217;ve maxed out on read IOPs, leading to severe latency (above 1 second). By maxing out on IOPs, we&#8217;re also limiting in how much data can be read from the disk. At 8kb blocks * 524 IOPs, the disk maxes out at 4.1 MB/s.  It&#8217;s important to note that if your application reads or writes in larger block sizes it is possible to increase throughput at the cost of lowering IOPs.  </p>



<h2 class="wp-block-heading" id="h-conclusion">Conclusion</h2>



<p>The example above represents a bottleneck encountered at the disk vs. the VM size.  We&#8217;re nowhere near the VM&#8217;s limit of 2,880 IOPs or 35 MBps.  Azure VM Metrics is a fantastic way to review performance counters directly from within the Azure portal.</p>



<h2 class="wp-block-heading" id="h-for-more-information">For more information</h2>



<p>If you’d like some assistance assessing your SQL Server workload on an Azure Virtual Machine,&nbsp;<a href="https://theserogroup.com/#contact">reach out</a>. We’re happy to help.</p>



<p>In the meantime, here are some other posts you may find interesting.</p>



<ul class="wp-block-list">
<li><a href="https://theserogroup.com/dba/identifying-sql-server-disk-latency/">Identifying SQL Server Disk Latency</a></li>



<li><a href="https://theserogroup.com/sql-server-consulting/identify-disk-i-o-performance-issues-for-your-sql-server-using-diskspd/">Identify Disk I/O Performance Issues for Your SQL Server Using DiskSpd</a></li>



<li><a href="https://theserogroup.com/sql-server/azure-shared-disks-failover-clustered-instances/">Azure shared disks &#8211; Failover Clustered Instances</a></li>



<li><a href="https://theserogroup.com/sql-server/how-to-create-sql-server-2019-failover-clustered-instances-in-azure/">How to Create SQL Server 2019 Failover Clustered Instances in Azure</a></li>



<li><a href="https://theserogroup.com/sql-server/why-is-my-sql-server-slow-14-common-reasons/">Why is My SQL Server Slow? 14 Common Reasons</a></li>



<li><a href="https://theserogroup.com/data-strategy/10-data-storage-considerations-for-growing-companies/">10 Data Storage Considerations for Growing Companies</a></li>
</ul>
<p>The post <a href="https://theserogroup.com/azure/analyzing-disk-latency-in-azure-virtual-machines-part-2/">Analyzing Disk Latency in Azure Virtual Machines &#8211; Part 2</a> appeared first on <a href="https://theserogroup.com">The SERO Group</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://theserogroup.com/azure/analyzing-disk-latency-in-azure-virtual-machines-part-2/feed/</wfw:commentRss>
			<slash:comments>10</slash:comments>
		
		
		<post-id xmlns="com-wordpress:feed-additions:1">5701</post-id>	</item>
		<item>
		<title>Analyzing Disk Latency in Azure Virtual Machines &#8211; Part 1</title>
		<link>https://theserogroup.com/azure/analyzing-disk-latency-in-azure-virtual-machines-part-1/</link>
		
		<dc:creator><![CDATA[Luke Campbell]]></dc:creator>
		<pubDate>Wed, 17 Jan 2024 13:00:00 +0000</pubDate>
				<category><![CDATA[Azure]]></category>
		<category><![CDATA[Database Administration]]></category>
		<category><![CDATA[Database Development]]></category>
		<category><![CDATA[IT Manager]]></category>
		<category><![CDATA[Microsoft Azure]]></category>
		<category><![CDATA[Sero]]></category>
		<category><![CDATA[Sero Group]]></category>
		<category><![CDATA[Serogroup]]></category>
		<category><![CDATA[Shared Disks]]></category>
		<category><![CDATA[SQL]]></category>
		<category><![CDATA[SQL Assessment]]></category>
		<category><![CDATA[SQL Events]]></category>
		<category><![CDATA[SQL Server]]></category>
		<category><![CDATA[SQL Server Consultant]]></category>
		<category><![CDATA[SQL Server Management]]></category>
		<category><![CDATA[SQL Training]]></category>
		<category><![CDATA[TempDB]]></category>
		<category><![CDATA[The Sero Group]]></category>
		<guid isPermaLink="false">https://theserogroup.com/?p=5664</guid>

					<description><![CDATA[<p>If you&#8217;ve moved your SQL Server workload to Azure Virtual Machines, you&#8217;ve noticed there&#8217;s no shortage in the number of options available. Virtual machine sizes, disk types, caching vs no caching, support for bursting, etc. When hosting SQL Server on Azure Virtual Machines, choosing the right combination of VM size and disk types is essential&#8230; <br /> <a class="read-more" href="https://theserogroup.com/azure/analyzing-disk-latency-in-azure-virtual-machines-part-1/">Read more</a></p>
<p>The post <a href="https://theserogroup.com/azure/analyzing-disk-latency-in-azure-virtual-machines-part-1/">Analyzing Disk Latency in Azure Virtual Machines &#8211; Part 1</a> appeared first on <a href="https://theserogroup.com">The SERO Group</a>.</p>
]]></description>
										<content:encoded><![CDATA[
<p>If you&#8217;ve moved your SQL Server workload to Azure Virtual Machines, you&#8217;ve noticed there&#8217;s no shortage in the number of options available.  Virtual machine sizes, disk types, caching vs no caching, support for bursting, etc.  </p>



<p>When hosting SQL Server on Azure Virtual Machines, choosing the right combination of VM size and disk types is essential from both a cost and performance perspective.  </p>



<p>However, workloads change over time and may require resizing the Azure VM or disks.  For example, perhaps you deployed a new application that utilizes SQL Server on an Azure Virtual Machine.  At first, usage was low, but now the application has become critical to the organization, and usage has increased significantly.  You&#8217;ve noticed disk-related waits in SQL Server have increased, and you are wondering how to address the latency and end users have started to complain.</p>



<p>Tracking down disk performance issues can be tricky.  There are multiple layers to consider.  Is it the virtual machine or the disk(s) causing the bottleneck?  </p>



<p>In Azure, disks and VMs have a cap on how much throughput and IOPs can be performed.  When looking into disk performance issues, it&#8217;s essential to account for the following at both the VM level and Disk level, as each has different levels of performance:</p>



<ul class="wp-block-list">
<li>VM &#8211; Max cached and temp storage throughput (IOPs/MBps).  Not all VMs support premium storage caching.</li>



<li>VM &#8211; Max uncached disk throughput (IOPs/MBps)</li>



<li>VM &#8211; Max data disks</li>



<li>Disk &#8211; Max disk size</li>



<li>Disk &#8211; Max throughput (MB/s)</li>



<li>Disk &#8211; Max IOPs</li>
</ul>



<p>To understand the VM level caps mentioned above, let&#8217;s review the three paths an IO can take: Cached, Uncached, Local/Temp disk.</p>



<h2 class="wp-block-heading" id="h-azure-virtual-machine-disk-io-paths">Azure Virtual Machine Disk IO Paths</h2>



<h3 class="wp-block-heading" id="h-cached">Cached</h3>



<p><strong>Purpose</strong>: Host caching in Azure is designed to improve performance by storing frequently accessed data closer to the VM.  This caching mechanism enhances read operations and can significantly reduce latency.  </p>



<p><strong>Types of Operations</strong>: It&#8217;s typically used for read-heavy workloads.  You can configure host caching to be read-only or read/write (not recommended for disks hosting transaction log files).  Read-only caching is ideal for workloads that predominantly involve read operations, while read/write caching is suitable for a balance of read and write operations.</p>



<p><strong>Performance</strong>: Cached I/O allows for higher IOPS and throughput as it utilizes the VM&#8217;s cache, which is faster than accessing data directly from the disk.  </p>



<p><strong>Limitations</strong>: The amount of storage available for host caching is limited and specified in the VM&#8217;s documentation.  Also, cached I/O counts towards the VM&#8217;s cached limits.</p>



<p><strong>Data Integrity</strong>: For read/write caching, writes are initially written to the cache and later written to the disk, which can be a concern for workloads requiring immediate persistence on disk.</p>



<h3 class="wp-block-heading" id="h-uncached">Uncached</h3>



<p><strong>Purpose</strong>: Uncached disk I/O involves direct interaction with the disk without the intermediate caching layer.  It is used for less frequently accessed data or when the latest data is required.</p>



<p><strong>Types of Operations</strong>: Suitable for workloads that involve a significant amount of write operations or where data integrity and immediate persistence are crucial.</p>



<p><strong>Performance</strong>: Generally, uncached disk I/O has lower performance compared to cached I/O due to the absence of the caching layer.  The IOPS and throughput are limited by the disk&#8217;s and VM&#8217;s capabilities.</p>



<p><strong>Limitations</strong>: The performance is constrained by the disk type and size and VM size.  For example, a P30 disk can handle up to 5,000 IOPs.</p>



<p><strong>Data Integrity</strong>: Since all operations are directly on the disk, there is immediate persistence of data, which is critical for certain applications and data security protocols.</p>



<h3 class="wp-block-heading" id="h-local-temp-disk">Local/Temp disk</h3>



<p><strong>Purpose</strong>: Temporary disks provide short-term storage for applications and processes running on the VM.  They are primarily used to store data that doesn&#8217;t need to be persistent, such as swap files, system caches, page files, or temporary data files (tempdb for example).</p>



<p><strong>Performance</strong>: Temporary disks are typically faster than standard storage disks because they are located on the same physical machine as the VM.  The performance of the temporary disk is tied to the VM size and offers high I/O throughput and low latency, making them ideal for temporary workloads and caching.</p>



<p><strong>Data Persistence and Reliability</strong>: Data on the temporary disk is volatile.  This means it persists only during the lifetime of the VM instance.  If the VM is stopped or de-allocated (not just restarted), data on the temporary disk is likely to be lost.  During some maintenance events or when the VM is moved to a different host hardware, the data on the temporary disk can also be lost. </p>



<p class="has-vivid-red-color has-text-color has-link-color wp-elements-ac08b9dc6ea8015a12bb3591da2e2cb2"><strong>Therefore, temporary disks should not be used for any data you need to keep.</strong></p>



<p>To learn more on how Azure High-Scale VMs utilize disk caching, see <a href="https://learn.microsoft.com/en-us/azure/virtual-machines/premium-storage-performance#disk-caching" target="_blank" rel="noreferrer noopener">here</a>.</p>



<h2 class="wp-block-heading" id="h-azure-vm-size-limitations">Azure VM Size Limitations</h2>



<p>Each Azure Virtual Machine size has the following properties defined (some VM sizes include additional properties such as burstable credits and cached throughput):</p>



<ul class="wp-block-list">
<li>vCPU &#8211; Number of virtual CPUs</li>



<li>Memory GiB </li>



<li>Temp Storage </li>



<li>Max Data Disks &#8211; Number of data disks that can be attached.</li>



<li>Max Network Bandwidth (Gbps)</li>



<li>Max NICs &#8211; Max number of network interface cards.</li>



<li>Max uncached disk throughput IOPS/MBps &#8211; Combined total of all disks.  For example, the remaining disks will encounter latency if one disk uses all available IOPs.</li>
</ul>



<p>We&#8217;ll focus on the disk-related properties throughout this series.</p>



<h2 class="wp-block-heading" id="h-conclusion">Conclusion</h2>



<p>In part 2, we&#8217;ll review an Azure VM experiencing high disk latency.  We&#8217;ll use Azure VM Metrics to help identify where the bottleneck may be and how to alleviate the issue.</p>



<p>In the meantime, here are a few other articles that may be helpful.</p>



<ul class="wp-block-list">
<li><a href="https://theserogroup.com/azure/azure-shared-disks-failover-clustered-instance-sql-server-2016/">Azure shared disks &#8211; Failover Clustered Instance &#8211; SQL Server 2016</a></li>



<li><a href="https://theserogroup.com/sql-server/azure-shared-disks-failover-clustered-instances/">Azure shared disks &#8211; Failover Clustered Instances</a></li>



<li><a href="https://theserogroup.com/sql-server/how-to-create-sql-server-2019-failover-clustered-instances-in-azure/">How to Create SQL Server 2019 Failover Clustered Instances in Azure</a></li>



<li><a href="https://theserogroup.com/dba/identifying-sql-server-disk-latency/">Identifying SQL Server Disk Latency</a></li>



<li><a href="https://theserogroup.com/data-strategy/10-data-storage-considerations-for-growing-companies/">10 Data Storage Considerations for Growing Companies</a></li>
</ul>



<p>If you’d like some assistance assessing your SQL Server workload on an Azure Virtual Machine, <a href="https://theserogroup.com/#contact">reach out</a>. We’re happy to help.</p>
<p>The post <a href="https://theserogroup.com/azure/analyzing-disk-latency-in-azure-virtual-machines-part-1/">Analyzing Disk Latency in Azure Virtual Machines &#8211; Part 1</a> appeared first on <a href="https://theserogroup.com">The SERO Group</a>.</p>
]]></content:encoded>
					
		
		
		<post-id xmlns="com-wordpress:feed-additions:1">5664</post-id>	</item>
		<item>
		<title>Use a Docker Container to Explore SQL Server 2022&#8217;s New Features</title>
		<link>https://theserogroup.com/sql-server/use-a-docker-container-to-explore-sql-server-2022s-new-features/</link>
					<comments>https://theserogroup.com/sql-server/use-a-docker-container-to-explore-sql-server-2022s-new-features/#comments</comments>
		
		<dc:creator><![CDATA[Joe Webb]]></dc:creator>
		<pubDate>Thu, 23 Jun 2022 20:43:27 +0000</pubDate>
				<category><![CDATA[SQL Server]]></category>
		<category><![CDATA[Containers]]></category>
		<category><![CDATA[Database]]></category>
		<category><![CDATA[Database Administration]]></category>
		<category><![CDATA[Database Development]]></category>
		<category><![CDATA[IT Manager]]></category>
		<category><![CDATA[Microsoft Azure]]></category>
		<category><![CDATA[Script Library]]></category>
		<category><![CDATA[Sero]]></category>
		<category><![CDATA[Sero Group]]></category>
		<category><![CDATA[Serogroup]]></category>
		<category><![CDATA[SQL]]></category>
		<category><![CDATA[SQL Consultant]]></category>
		<category><![CDATA[SQL Events]]></category>
		<category><![CDATA[SQL Security]]></category>
		<category><![CDATA[SQL Server Consultant]]></category>
		<category><![CDATA[SQL Server Management]]></category>
		<category><![CDATA[SQL Training]]></category>
		<category><![CDATA[TempDB]]></category>
		<category><![CDATA[The Sero Group]]></category>
		<guid isPermaLink="false">https://theserogroup.com/?p=4496</guid>

					<description><![CDATA[<p>There&#8217;s a lot of hype surrounding the next version of SQL Server. And for good reason. SQL Server 2022 is packed with some long awaited niceties, improvements, and enhancements. Here are a few of the SQL Server 2022&#8217;s new features we are excited about. Contained Availability Groups Enhancements to Availability Groups and Distributed Availability Groups&#8230; <br /> <a class="read-more" href="https://theserogroup.com/sql-server/use-a-docker-container-to-explore-sql-server-2022s-new-features/">Read more</a></p>
<p>The post <a href="https://theserogroup.com/sql-server/use-a-docker-container-to-explore-sql-server-2022s-new-features/">Use a Docker Container to Explore SQL Server 2022&#8217;s New Features</a> appeared first on <a href="https://theserogroup.com">The SERO Group</a>.</p>
]]></description>
										<content:encoded><![CDATA[
<p>There&#8217;s a lot of hype surrounding the next version of SQL Server. And for good reason. SQL Server 2022 is packed with some long awaited niceties, improvements, and enhancements. Here are a few of the SQL Server 2022&#8217;s new features we are excited about.</p>



<ul class="wp-block-list"><li>Contained Availability Groups</li><li>Enhancements to Availability Groups and Distributed Availability Groups</li><li>Query Store enhancements, including being available on secondary replicas</li><li>Parameter Sensitive Plan (PSP) optimization</li><li>Ledger to help assure data hasn&#8217;t been tampered with</li></ul>



<p>You can learn more about SQL Server 2022 on the <a href="https://docs.microsoft.com/en-us/sql/sql-server/what-s-new-in-sql-server-2022?view=sql-server-ver16" target="_blank" rel="noreferrer noopener">What&#8217;s new in SQL Server 2022 &#8211; SQL Server | Microsoft Docs</a> site.</p>



<p>Now, how can you explore SQL Server 2022&#8217;s new features? </p>



<h2 class="wp-block-heading">Test Driving SQL Server 2022</h2>



<p>Containers are a great way to explore new versions of a product like SQL Server without having to actually install bits on your computer that you&#8217;ll later want to remove. Containers are lightweight, standalone, and have everything required to run SQL Server. There&#8217;s nothing to install directly on your host machine. And nothing to remove later, except, of course, the container and image file. But those won&#8217;t leave remnants of SQL Server in your registry or file system.</p>



<h3 class="wp-block-heading">Prerequisites </h3>



<p>To use SQL Server in a Docker container, you&#8217;ll need the <a href="https://www.docker.com/products/docker-desktop" target="_blank" rel="noreferrer noopener">Docker Desktop</a>. There are versions for most every desktop platform, including Windows, Mac, and Linux. In <a href="https://theserogroup.com/sql-server/getting-started-with-sql-server-in-a-docker-container/">Getting Started with SQL Server in a Docker Container &#8211; The SERO Group</a>, I walk through the process of configuring Docker Desktop for a Windows 10 client. If you don&#8217;t already have the Docker Desktop installed, do that first. </p>



<h3 class="wp-block-heading">Pulling the SQL Server 2022 container image</h3>



<p>Once you have Docker Desktop in place, you can pull (download) the SQL Server 2022 image using the following command in the Windows command prompt.</p>



<pre class="wp-block-code"><code>docker pull mcr.microsoft.com/mssql/server:2022-latest</code></pre>



<figure class="wp-block-image size-full"><a href="https://theserogroup.com/wp-content/uploads/2022/06/pullsql2022.png"><img decoding="async" width="690" height="335" src="https://theserogroup.com/wp-content/uploads/2022/06/pullsql2022.png" alt="pull sql server 2022 docker container" class="wp-image-4500" srcset="https://theserogroup.com/wp-content/uploads/2022/06/pullsql2022.png 690w, https://theserogroup.com/wp-content/uploads/2022/06/pullsql2022-300x146.png 300w" sizes="(max-width: 690px) 100vw, 690px" /></a></figure>



<h3 class="wp-block-heading">Starting the SQL Server 2022 container</h3>



<p>Once the pull has completed, you can create the container from the image using the following command.</p>



<pre class="wp-block-code"><code>docker run -e "ACCEPT_EULA=Y" -e "SA_PASSWORD=iO1$6sJ&amp;64YRCJAx" -p 1433:1433 --name sql2022ctp1 -d mcr.microsoft.com/mssql/server:2022-latest</code></pre>



<p>The ACCEPT_EULA parameter indicates that you agree to Microsoft’s End User Licensing Agreement. SA_PASSWORD parameter is where you set the sa password for this instance. You&#8217;ll want to replace iO1$6sJ&amp;64YRCJAx in the example above with a complex password of your choosing.</p>



<p>The -p parameter allows you to map a TCP port on the host environment to a port in the container. In this example, I’m mapping the default host environment port of 1433 to the container port of 1433.</p>



<p>Set the name for your container using the –name parameter. I’m naming this one sql2022ctp1.</p>



<p>And finally, the -d parameter is the name of the container image your want to run.</p>



<h3 class="wp-block-heading">Listing your containers</h3>



<p>You can use the following command to list all containers in your Docker environment.</p>



<pre class="wp-block-code"><code>docker ps -a</code></pre>



<p>You can see that this Docker environment has two SQL Server 2019 containers, sql2019 and sql2019a, along with our newly created container, sql2022ctp1. The sql2022ctp1 container is running. The other two are not.</p>



<figure class="wp-block-image size-full"><a href="https://theserogroup.com/wp-content/uploads/2022/06/dockerpsa.png"><img decoding="async" width="690" height="333" src="https://theserogroup.com/wp-content/uploads/2022/06/dockerpsa.png" alt="docker list sql server containers" class="wp-image-4503" srcset="https://theserogroup.com/wp-content/uploads/2022/06/dockerpsa.png 690w, https://theserogroup.com/wp-content/uploads/2022/06/dockerpsa-300x145.png 300w" sizes="(max-width: 690px) 100vw, 690px" /></a></figure>



<p>You can also see your containers in the Docker Desktop as shown below.</p>



<figure class="wp-block-image size-full"><a href="https://theserogroup.com/wp-content/uploads/2022/06/Screen-Shot-2022-06-23-at-10.44.18-AM.png"><img loading="lazy" decoding="async" width="956" height="602" src="https://theserogroup.com/wp-content/uploads/2022/06/Screen-Shot-2022-06-23-at-10.44.18-AM.png" alt="docker desktop sqlserver 2022 ctp 1" class="wp-image-4501" srcset="https://theserogroup.com/wp-content/uploads/2022/06/Screen-Shot-2022-06-23-at-10.44.18-AM.png 956w, https://theserogroup.com/wp-content/uploads/2022/06/Screen-Shot-2022-06-23-at-10.44.18-AM-300x189.png 300w, https://theserogroup.com/wp-content/uploads/2022/06/Screen-Shot-2022-06-23-at-10.44.18-AM-768x484.png 768w" sizes="auto, (max-width: 956px) 100vw, 956px" /></a></figure>



<h3 class="wp-block-heading">Querying the SQL Server 2022 instance</h3>



<p>Using Azure Data Studio or SQL Server Management Studio, you can connect to your new SQL Server 2022 instance and query as normal from your host operating system. For example, running the following query in Azure Data Studio will return the SQL Server Edition, Version, and Product Level.</p>



<pre class="wp-block-code"><code>SELECT  SERVERPROPERTY('Edition') AS SQLEdition,
        SERVERPROPERTY('ProductVersion') AS ProductVersion,
        SERVERPROPERTY('ProductLevel') AS ProductLevel;</code></pre>



<figure class="wp-block-image size-full"><a href="https://theserogroup.com/wp-content/uploads/2022/06/sql2022info1.png"><img loading="lazy" decoding="async" width="512" height="102" src="https://theserogroup.com/wp-content/uploads/2022/06/sql2022info1.png" alt="sql server 2022 info" class="wp-image-4504" srcset="https://theserogroup.com/wp-content/uploads/2022/06/sql2022info1.png 512w, https://theserogroup.com/wp-content/uploads/2022/06/sql2022info1-300x60.png 300w" sizes="auto, (max-width: 512px) 100vw, 512px" /></a></figure>



<p>You can use the following query to review information about the host operating system. </p>



<pre class="wp-block-code"><code>SELECT  host_platform, 
        host_distribution, 
        host_release
FROM    sys.dm_os_host_info;</code></pre>



<figure class="wp-block-image size-full"><a href="https://theserogroup.com/wp-content/uploads/2022/06/sqlserver2022hostinfo.png"><img loading="lazy" decoding="async" width="473" height="110" src="https://theserogroup.com/wp-content/uploads/2022/06/sqlserver2022hostinfo.png" alt="sql server container host information" class="wp-image-4505" srcset="https://theserogroup.com/wp-content/uploads/2022/06/sqlserver2022hostinfo.png 473w, https://theserogroup.com/wp-content/uploads/2022/06/sqlserver2022hostinfo-300x70.png 300w" sizes="auto, (max-width: 473px) 100vw, 473px" /></a></figure>



<h2 class="wp-block-heading">Exploring SQL Server 2022&#8217;s new features</h2>



<p>Now that you have a working SQL Server 2022 instance, you can begin exploring its new features. </p>



<p>For example, I&#8217;d like to better understand the new Parameter Sensitivity Plan (PSP) optimization enhancements. So, I restored a copy of the <a href="https://theserogroup.com/career-development/data-getcha-data-here/">BaseballData</a> database that I sometimes use for testing and demos. See <a href="https://theserogroup.com/sql-server/getting-started-with-sql-server-in-a-docker-container/">Getting Started with SQL Server in a Docker Container &#8211; The SERO Group</a> for how to restore a backup to your container. </p>



<p>Next, I set the compatibility level of the BaseballData database to 160 and enable Query Store using the following t-sql commands.</p>



<pre class="wp-block-code"><code>ALTER DATABASE BaseballData  
SET COMPATIBILITY_LEVEL = 160;  

ALTER DATABASE BaseballData 
SET QUERY_STORE (QUERY_CAPTURE_MODE = auto);</code></pre>



<p>To verify that setting the compatibility level to 160 enabled  PSP optimization, I can run the following query.</p>



<pre class="wp-block-code"><code>SELECT name, value, is_value_default
FROM sys.database_scoped_configurations
WHERE name = 'PARAMETER_SENSITIVE_PLAN_OPTIMIZATION'</code></pre>



<figure class="wp-block-image size-full"><a href="https://theserogroup.com/wp-content/uploads/2022/06/pspoptimization.png"><img loading="lazy" decoding="async" width="499" height="107" src="https://theserogroup.com/wp-content/uploads/2022/06/pspoptimization.png" alt="sql server 2022 psp optimization" class="wp-image-4513" srcset="https://theserogroup.com/wp-content/uploads/2022/06/pspoptimization.png 499w, https://theserogroup.com/wp-content/uploads/2022/06/pspoptimization-300x64.png 300w" sizes="auto, (max-width: 499px) 100vw, 499px" /></a></figure>



<p>Now I can begin experimenting how PSP optimization affects my queries. For more information about PSP optimization, see <a href="https://docs.microsoft.com/en-us/sql/relational-databases/performance/parameter-sensitivity-plan-optimization?view=sql-server-ver16">Parameter Sensitivity Plan optimization &#8211; SQL Server | Microsoft Docs</a>. </p>



<h2 class="wp-block-heading">Stopping and starting your Docker container</h2>



<p>You can leave your container running all the time if you wish. However, if you like to stop it and start it again later, you can with the following command, where sql2022ctp1 is the name you gave to your container.</p>



<pre class="wp-block-code"><code>docker stop sql2022ctp1</code></pre>



<p>To start the container later, use the following.</p>



<pre class="wp-block-code"><code>docker start sql2022ctp1</code></pre>



<h2 class="wp-block-heading">Want to work with The SERO Group?</h2>



<p>Want to learn more about how SERO Group helps organizations take the guesswork out of managing their SQL Servers? It’s easy and there is no obligation.&nbsp;</p>



<p>Schedule a&nbsp;<a href="https://theserogroup.com/meet-with-joe-webb/">free 30-minute call</a>&nbsp;to see if our&nbsp;<a href="https://theserogroup.com/sql-health-check/">SQL Server Health Check</a>&nbsp;or one of our&nbsp;<a href="https://theserogroup.com/seroshield/">SEROShield</a>&nbsp;plans is right for you.</p>



<p><a href="https://theserogroup.com/meet-with-joe-webb" target="_blank" rel="noreferrer noopener">Schedule a call</a>&nbsp;with us to get started.</p>
<p>The post <a href="https://theserogroup.com/sql-server/use-a-docker-container-to-explore-sql-server-2022s-new-features/">Use a Docker Container to Explore SQL Server 2022&#8217;s New Features</a> appeared first on <a href="https://theserogroup.com">The SERO Group</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://theserogroup.com/sql-server/use-a-docker-container-to-explore-sql-server-2022s-new-features/feed/</wfw:commentRss>
			<slash:comments>3</slash:comments>
		
		
		<post-id xmlns="com-wordpress:feed-additions:1">4496</post-id>	</item>
		<item>
		<title>Infographic: 5 Commonly Overlooked SQL Server Settings</title>
		<link>https://theserogroup.com/sql-server/infographic-5-commonly-overlooked-sql-server-settings/</link>
		
		<dc:creator><![CDATA[Joe Webb]]></dc:creator>
		<pubDate>Wed, 04 May 2022 16:58:00 +0000</pubDate>
				<category><![CDATA[SQL Server]]></category>
		<category><![CDATA[Database Administration]]></category>
		<category><![CDATA[Database Development]]></category>
		<category><![CDATA[IT Manager]]></category>
		<category><![CDATA[Sero]]></category>
		<category><![CDATA[Sero Group]]></category>
		<category><![CDATA[Serogroup]]></category>
		<category><![CDATA[SQL]]></category>
		<category><![CDATA[SQL Assessment]]></category>
		<category><![CDATA[SQL Server Consultant]]></category>
		<category><![CDATA[SQL Server Management]]></category>
		<category><![CDATA[TempDB]]></category>
		<category><![CDATA[The Sero Group]]></category>
		<guid isPermaLink="false">https://theserogroup.com/?p=4442</guid>

					<description><![CDATA[<p>When we examine SQL Servers as part of our SEROShield SQL Server Health Check, we find five commonly overlooked SQL Server settings that can put performance, reliability, and even data at risk. Why are SQL Servers often misconfigured? SQL Server is robust. Microsoft has put a lot of effort into creating a database platform that&#8230; <br /> <a class="read-more" href="https://theserogroup.com/sql-server/infographic-5-commonly-overlooked-sql-server-settings/">Read more</a></p>
<p>The post <a href="https://theserogroup.com/sql-server/infographic-5-commonly-overlooked-sql-server-settings/">Infographic: 5 Commonly Overlooked SQL Server Settings</a> appeared first on <a href="https://theserogroup.com">The SERO Group</a>.</p>
]]></description>
										<content:encoded><![CDATA[
<p>When we examine SQL Servers as part of our <a href="https://theserogroup.com/sql-health-check/">SEROShield SQL Server Health Check</a>, we find five commonly overlooked SQL Server settings that can put performance, reliability, and even data at risk.</p>



<h2 class="wp-block-heading">Why are SQL Servers often misconfigured?</h2>



<p>SQL Server is robust. Microsoft has put a lot of effort into creating a database platform that works well even when not configured optimally. </p>



<p>Unfortunately, SQL Server&#8217;s robustness and its dependability is sometimes taken for granted. In larger organizations with hundreds of SQL instances, the DBA team often doesn&#8217;t have the time or tools to get to know each instance. They sometimes have to manage by exception, tackling problems as they arise. </p>



<p>In smaller companies without the need or budget for a full-time DBA, another IT professional is tasked with SQL Server duties. They split time between their primary job and managing the SQL Server. </p>



<p>In <a href="https://theserogroup.com/sql-server/why-9-out-of-10-sql-servers-arent-configured-with-best-practices/">Why 9 Out of 10 SQL Servers Aren’t Configured with Best Practices</a>, we share 5 reasons why many SQL Servers aren&#8217;t configured with industry best practices. Here&#8217;s a summary. I encourage you to go read the full post. </p>



<ol class="wp-block-list"><li>SQL Server is so easy to setup</li><li>SQL Server just works</li><li>Introducing the Accidental DBA</li><li>Duct-taping with hardware</li><li>Everyone has their own standards</li></ol>



<h2 class="wp-block-heading">A free infographic: SQL Server settings commonly overlooked</h2>



<p>We work with SQL Servers of all shapes and sizes. Some have high transactional volumes while others are used only for reporting purposes. Some measure their storage requirements in TB while others are a faction of that size. They are in the cloud, in colocation data centers, and in the server room. </p>



<p>We support SQL Servers used in healthcare, legal, banking, government, import/export, construction, manufacturing, and retail distribution. </p>



<p>We&#8217;ve found that there are five commonly overlooked issues that can cause performance or reliability issues for the SQL Server. Here they are in a short infographic. </p>



<div class="wp-block-image"><figure class="aligncenter size-large"><a href="https://theserogroup.com/wp-content/uploads/2022/04/5_Common_SQL_Configuration_Issues.png"><img loading="lazy" decoding="async" width="410" height="1024" src="https://theserogroup.com/wp-content/uploads/2022/04/5_Common_SQL_Configuration_Issues-410x1024.png" alt="5 Commonly Overlooked SQL Server Settings" class="wp-image-4445" srcset="https://theserogroup.com/wp-content/uploads/2022/04/5_Common_SQL_Configuration_Issues-410x1024.png 410w, https://theserogroup.com/wp-content/uploads/2022/04/5_Common_SQL_Configuration_Issues-120x300.png 120w, https://theserogroup.com/wp-content/uploads/2022/04/5_Common_SQL_Configuration_Issues-432x1080.png 432w, https://theserogroup.com/wp-content/uploads/2022/04/5_Common_SQL_Configuration_Issues.png 500w" sizes="auto, (max-width: 410px) 100vw, 410px" /></a></figure></div>



<p>Fortunately, these are not difficult to resolve. </p>



<p>If you&#8217;d like more detail about each of these, download our <a href="https://theserogroup.com/sql-server-configuration-download/">5 Risks to SQL Security &amp; SQL Server Performance | Download | SERO (theserogroup.com)</a> pdf. </p>



<h2 class="wp-block-heading">How is your SQL Server?</h2>



<p>Have some uncertainty around your SQL Server backups? Schedule a&nbsp;<a href="https://theserogroup.com/meet-with-joe-webb/">free 30-minute call</a>&nbsp;to see if our&nbsp;<a href="https://theserogroup.com/sql-health-check/">SQL Server Health Check</a>&nbsp;or one of our&nbsp;<a href="https://theserogroup.com/seroshield/">SEROShield</a>&nbsp;plans is right for you.</p>
<p>The post <a href="https://theserogroup.com/sql-server/infographic-5-commonly-overlooked-sql-server-settings/">Infographic: 5 Commonly Overlooked SQL Server Settings</a> appeared first on <a href="https://theserogroup.com">The SERO Group</a>.</p>
]]></content:encoded>
					
		
		
		<post-id xmlns="com-wordpress:feed-additions:1">4442</post-id>	</item>
		<item>
		<title>How to Configure SQL Server tempdb?</title>
		<link>https://theserogroup.com/dba/how-to-configure-sql-server-tempdb/</link>
					<comments>https://theserogroup.com/dba/how-to-configure-sql-server-tempdb/#comments</comments>
		
		<dc:creator><![CDATA[Joe Webb]]></dc:creator>
		<pubDate>Tue, 05 Oct 2021 14:11:55 +0000</pubDate>
				<category><![CDATA[DBA]]></category>
		<category><![CDATA[Database]]></category>
		<category><![CDATA[Database Administration]]></category>
		<category><![CDATA[Database Development]]></category>
		<category><![CDATA[IT Manager]]></category>
		<category><![CDATA[Script Library]]></category>
		<category><![CDATA[Sero]]></category>
		<category><![CDATA[Sero Group]]></category>
		<category><![CDATA[Serogroup]]></category>
		<category><![CDATA[SQL]]></category>
		<category><![CDATA[SQL Assessment]]></category>
		<category><![CDATA[SQL Audit]]></category>
		<category><![CDATA[SQL Consultant]]></category>
		<category><![CDATA[SQL Server]]></category>
		<category><![CDATA[SQL Server Consultant]]></category>
		<category><![CDATA[SQL Server Management]]></category>
		<category><![CDATA[TempDB]]></category>
		<category><![CDATA[The Sero Group]]></category>
		<guid isPermaLink="false">https://theserogroup.com/?p=3970</guid>

					<description><![CDATA[<p>How many tempdb data files should a SQL Server have? And where should they live? What about their growth settings? Should it be by percent? Or, should they grow by a certain size each time? Are there other tempdb configuration settings I should be concerned with? In short: how should I configure my SQL Server&#8230; <br /> <a class="read-more" href="https://theserogroup.com/dba/how-to-configure-sql-server-tempdb/">Read more</a></p>
<p>The post <a href="https://theserogroup.com/dba/how-to-configure-sql-server-tempdb/">How to Configure SQL Server tempdb?</a> appeared first on <a href="https://theserogroup.com">The SERO Group</a>.</p>
]]></description>
										<content:encoded><![CDATA[
<p>How many tempdb data files should a SQL Server have? And where should they live? What about their growth settings? Should it be by percent? Or, should they grow by a certain size each time? Are there other tempdb configuration settings I should be concerned with? </p>



<p>In short: how should I configure my SQL Server tempdb so that it performs well and doesn&#8217;t become a bottleneck? And is there an easy way to tell if my SQL Server tempdb is configured properly?</p>



<p>Let&#8217;s start with how should your tempdb be configured.</p>



<h2 class="wp-block-heading">How should the SQL Server tempdb be configured?</h2>



<p>Configuring SQL Server tempdb is a bit of a balancing act. Settings appropriate for one instance may not be right for another instance. And since tempdb can have dramatic implications for the performance for all databases on the SQL instance, it&#8217;s important to get it right. </p>



<p>Microsoft has good information on the <a href="https://docs.microsoft.com/en-us/sql/relational-databases/databases/tempdb-database?view=sql-server-ver15#optimizing-tempdb-performance-in-sql-server" target="_blank" rel="noreferrer noopener">SQL Docs</a> page to help you optimize the tempdb system for performance. I&#8217;ll summarize here, but you should really go read it yourself in SQL Docs.</p>



<ul class="wp-block-list"><li>Number: This will depend on several factors, including the number logical processors available to the instance. A good starting point is:<ul><li>1 to 8 processors &#8211; create one tempdb file for each logical processor.</li><li>More than 8 processors &#8211; start with 8 tempdb files and monitor. If contention in tempdb becomes a bottleneck, increase the number of data files in increments of 4 and continue to monitor. </li></ul></li><li>Size: All tempdb data files should be the same size. </li><li>Growth: Set growth increments to a reasonable size, and make sure it&#8217;s the same for all tempdb data files. Don&#8217;t grow by percentage.</li><li>Location: Place your tempdb files somewhere other than on the operating system drive.  </li></ul>



<h2 class="wp-block-heading"> Is my SQL Server tempdb configured properly? </h2>



<p>Okay, now that we know a good starting point for our tempdb configuration, are we there? Or do we need to make some changes? </p>



<p>Let&#8217;s check.</p>



<p>You can, of course, open SQL Server Management Studio and drill down into the tempdb setting to have a look. Or, you can write some T-SQL queries to return the configuration information. There&#8217;s a <a href="https://docs.microsoft.com/en-us/sql/relational-databases/databases/tempdb-database?view=sql-server-ver15#optimizing-tempdb-performance-in-sql-server" target="_blank" rel="noreferrer noopener">nice little query on SQL Docs</a> for this.</p>



<p>My favorite way for a quick check, however, is to use the Test-<a href="https://docs.dbatools.io/#Test-DbaTempDbConfig" target="_blank" rel="noreferrer noopener">DbaTempDbConfig </a>command in <a href="https://docs.dbatools.io/" target="_blank" rel="noreferrer noopener">dbatools</a>. Use the command below, replacing the name of the instance with the instance name you&#8217;re interested in. </p>



<pre class="wp-block-code"><code>Test-DbaTempDbConfig -SqlInstance sql2019 | format-table -Wrap</code></pre>



<p>Here&#8217;s the output from a test system.</p>



<figure class="wp-block-image size-large"><a href="https://theserogroup.com/wp-content/uploads/2021/09/configuretempdb.png"><img loading="lazy" decoding="async" width="1024" height="160" src="https://theserogroup.com/wp-content/uploads/2021/09/configuretempdb-1024x160.png" alt="SQL Server tempdb file configuration" class="wp-image-3975" srcset="https://theserogroup.com/wp-content/uploads/2021/09/configuretempdb-1024x160.png 1024w, https://theserogroup.com/wp-content/uploads/2021/09/configuretempdb-300x47.png 300w, https://theserogroup.com/wp-content/uploads/2021/09/configuretempdb-768x120.png 768w, https://theserogroup.com/wp-content/uploads/2021/09/configuretempdb.png 1306w" sizes="auto, (max-width: 1024px) 100vw, 1024px" /></a></figure>



<p>The command returns six lines of output. These roughly correspond to the settings mentioned above &#8211; file size, location, growth settings, and max size.</p>



<p>The command also checks for Trace Flag 1118. Read more about this Trace Flag in <a href="https://support.microsoft.com/en-us/topic/kb328551-concurrency-enhancements-for-the-tempdb-database-ca601d44-4b95-70c7-2afe-df0bf7ba716c" target="_blank" rel="noreferrer noopener">KB328551</a>.</p>



<h2 class="wp-block-heading">Review your tempdb settings and refine, if needed</h2>



<p>Regardless of whether you used the database properties in SSMS, ran a T-SQL query to return the settings, or used the dbatools powershell script above, review the current configuration for your tempdb. Determine if a change is warranted and update the settings, if needed. Add some additional files, resize the existing files, adjust the growth settings, etc. </p>



<p>As a general rule, these changes will require a restart to take effect. (Depending on the specific change, that&#8217;s not always the case, but it&#8217;s generally better to make the changes during a maintenance window and restart the SQL Server service.)</p>



<h2 class="wp-block-heading">For more information on configuring your SQL Server tempdb</h2>



<p>Want to know more about SQL Server tempdb and how it should be configured? See the following pages. </p>



<ul class="wp-block-list"><li><a href="https://docs.microsoft.com/en-us/sql/relational-databases/databases/tempdb-database?view=sql-server-ver15" target="_blank" rel="noreferrer noopener">tempdb database &#8211; SQL Server | Microsoft Docs</a></li><li><a href="https://theserogroup.com/sql-server/3-ways-to-find-your-sql-server-tempdb-data-files/">3 Ways to Find Your SQL Server tempdb Data Files</a></li><li><a href="https://theserogroup.com/sql-server/how-many-tempdb-data-files-should-my-sql-server-have/">How Many tempdb Data Files Should My SQL Server Have?</a></li><li><a href="https://www.sentryone.com/tempdb-in-sql-server">TempDB in SQL Server: Temporary Data with Long Term Problems (sentryone.com)</a></li></ul>



<h2 class="wp-block-heading">Want to work with The SERO Group?</h2>



<p>Want to learn more about how SERO Group helps organizations take the guesswork out of managing their SQL Servers? It’s easy and there is no obligation.&nbsp;</p>



<p><a href="https://calendly.com/joe_webb" target="_blank" rel="noreferrer noopener">Schedule a call</a>&nbsp;with us to get started.</p>
<p>The post <a href="https://theserogroup.com/dba/how-to-configure-sql-server-tempdb/">How to Configure SQL Server tempdb?</a> appeared first on <a href="https://theserogroup.com">The SERO Group</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://theserogroup.com/dba/how-to-configure-sql-server-tempdb/feed/</wfw:commentRss>
			<slash:comments>4</slash:comments>
		
		
		<post-id xmlns="com-wordpress:feed-additions:1">3970</post-id>	</item>
		<item>
		<title>Webinar: Is Your SQL Server Healthy?</title>
		<link>https://theserogroup.com/professional-development/webinar-is-your-sql-server-healthy/</link>
		
		<dc:creator><![CDATA[Joe Webb]]></dc:creator>
		<pubDate>Fri, 11 Jun 2021 14:59:30 +0000</pubDate>
				<category><![CDATA[Professional Development]]></category>
		<category><![CDATA[Clustering]]></category>
		<category><![CDATA[Clusters]]></category>
		<category><![CDATA[Database]]></category>
		<category><![CDATA[Database Administration]]></category>
		<category><![CDATA[Database Development]]></category>
		<category><![CDATA[IT Manager]]></category>
		<category><![CDATA[Script Library]]></category>
		<category><![CDATA[Sero]]></category>
		<category><![CDATA[Sero Group]]></category>
		<category><![CDATA[Serogroup]]></category>
		<category><![CDATA[SQL]]></category>
		<category><![CDATA[SQL Assessment]]></category>
		<category><![CDATA[SQL Audit]]></category>
		<category><![CDATA[SQL Consultant]]></category>
		<category><![CDATA[SQL Events]]></category>
		<category><![CDATA[SQL Security]]></category>
		<category><![CDATA[SQL Server]]></category>
		<category><![CDATA[SQL Server Consultant]]></category>
		<category><![CDATA[SQL Server Management]]></category>
		<category><![CDATA[SQL Training]]></category>
		<category><![CDATA[TempDB]]></category>
		<category><![CDATA[The Sero Group]]></category>
		<guid isPermaLink="false">https://theserogroup.com/?p=3784</guid>

					<description><![CDATA[<p>SQL Server. Many business depend on it. But how can you tell if your SQL Server is healthy? It&#8217;s not always obvious. SQL Server can be pretty forgiving in many ways, until it&#8217;s not. And that can put your performance and even your data at risk. The right configuration settings are critical. Unfortunately, it&#8217;s easy&#8230; <br /> <a class="read-more" href="https://theserogroup.com/professional-development/webinar-is-your-sql-server-healthy/">Read more</a></p>
<p>The post <a href="https://theserogroup.com/professional-development/webinar-is-your-sql-server-healthy/">Webinar: Is Your SQL Server Healthy?</a> appeared first on <a href="https://theserogroup.com">The SERO Group</a>.</p>
]]></description>
										<content:encoded><![CDATA[
<p>SQL Server. Many business depend on it. But how can you tell if your SQL Server is healthy? It&#8217;s not always obvious. SQL Server can be pretty forgiving in many ways, until it&#8217;s not. And that can put your performance and even your data at risk.</p>



<p>The right configuration settings are critical. Unfortunately, it&#8217;s easy to overlook many SQL Server settings and best practices. The defaults are not always the best.  </p>



<p>A proper maintenance schedule for your databases and servers is important. So is regular monitoring. And a sound HADR plan that meets the needs of the business is critical. </p>



<h2 class="wp-block-heading" id="h-is-your-sql-server-healthy-a-free-webinar">Is your SQL Server healthy? A free webinar</h2>



<p>In an upcoming webinar, we’ll discuss some commonly overlooked SQL Server settings and practices we uncover during our <a href="https://theserogroup.com/sql-configuration-assessment/">SQL Server Assessments</a>. These can have dramatic effects on your database server’s performance and reliability. And we&#8217;ll share what you can do to fix them and help to keep your SQL Server healthy. </p>



<p><a href="https://seroprotech3.eventbrite.com" target="_blank" rel="noreferrer noopener">Register here</a> for the free webinar on June 23, 2021.</p>



<p>In the meantime, check out these posts.</p>



<ul class="wp-block-list">
<li><a href="https://theserogroup.com/dba/identifying-sql-server-disk-latency/">Identifying SQL Server Disk Latency</a></li>



<li><a href="https://theserogroup.com/professional-development/scary-and-dangerous-things-in-sql-server/">Scary and Dangerous Things in SQL Server</a></li>



<li><a href="https://theserogroup.com/sql-server/securing-your-sql-servers-what-should-you-audit/">Securing Your SQL Servers, What Should You Audit?</a></li>



<li><a href="https://theserogroup.com/sql-server/when-was-the-last-known-good-dbcc-checkdb-integrity-check/">When Was the Last Known Good DBCC CHECKDB Integrity Check?</a></li>



<li><a href="https://theserogroup.com/sql-server-consulting/identify-disk-i-o-performance-issues-for-your-sql-server-using-diskspd/">Identify Disk I/O Performance Issues for Your SQL Server Using DiskSpd</a></li>



<li><a href="https://theserogroup.com/sql-server/is-my-sql-server-configured-properly/">Is My SQL Server Configured Properly?</a></li>



<li><a href="https://theserogroup.com/sql-server/how-many-tempdb-data-files-should-my-sql-server-have/">How Many tempdb Data Files Should My SQL Server Have?</a></li>
</ul>


<div id="eventbrite-widget-1" class="wp-block-jetpack-eventbrite wp-block-jetpack-eventbrite--embed"><a href="https://www.eventbrite.com/e/is-your-sql-server-healthy-common-issues-that-may-be-putting-data-at-risk-tickets-158608011833" rel="noopener noreferrer" target="_blank" class="eventbrite__direct-link" >Register on Eventbrite</a></div>


<h2 class="wp-block-heading" id="h-want-to-work-with-the-sero-group">Want to work with The SERO Group?</h2>



<p>Want to learn more about how SERO Group helps organizations take the guesswork out of managing their SQL Servers? It’s easy and there is no obligation.&nbsp;</p>



<p><a href="https://theserogroup.com/#contact" target="_blank" rel="noreferrer noopener">Schedule a call</a> with us to get started.</p>
<p>The post <a href="https://theserogroup.com/professional-development/webinar-is-your-sql-server-healthy/">Webinar: Is Your SQL Server Healthy?</a> appeared first on <a href="https://theserogroup.com">The SERO Group</a>.</p>
]]></content:encoded>
					
		
		
		<post-id xmlns="com-wordpress:feed-additions:1">3784</post-id>	</item>
		<item>
		<title>Identifying SQL Server Disk Latency</title>
		<link>https://theserogroup.com/dba/identifying-sql-server-disk-latency/</link>
					<comments>https://theserogroup.com/dba/identifying-sql-server-disk-latency/#comments</comments>
		
		<dc:creator><![CDATA[Joe Webb]]></dc:creator>
		<pubDate>Wed, 12 May 2021 14:00:00 +0000</pubDate>
				<category><![CDATA[DBA]]></category>
		<category><![CDATA[Clustering]]></category>
		<category><![CDATA[Clusters]]></category>
		<category><![CDATA[Database]]></category>
		<category><![CDATA[Database Administration]]></category>
		<category><![CDATA[Database Development]]></category>
		<category><![CDATA[IT Manager]]></category>
		<category><![CDATA[Script Library]]></category>
		<category><![CDATA[Sero]]></category>
		<category><![CDATA[Sero Group]]></category>
		<category><![CDATA[Serogroup]]></category>
		<category><![CDATA[Shared Disks]]></category>
		<category><![CDATA[SQL]]></category>
		<category><![CDATA[SQL Assessment]]></category>
		<category><![CDATA[SQL Consultant]]></category>
		<category><![CDATA[SQL Server]]></category>
		<category><![CDATA[SQL Server Consultant]]></category>
		<category><![CDATA[SQL Server Management]]></category>
		<category><![CDATA[TempDB]]></category>
		<category><![CDATA[The Sero Group]]></category>
		<guid isPermaLink="false">https://theserogroup.com/?p=3721</guid>

					<description><![CDATA[<p>When SQL Server is not as fast as users think it ought to be, how can you tell where the slowdown is? Where&#8217;s the performance bottleneck? Where&#8217;s the traffic jam? Is it waiting on CPU? Does it needs memory? What about the disks? Could SQL Server be slow because of disk latency? Could be. But&#8230; <br /> <a class="read-more" href="https://theserogroup.com/dba/identifying-sql-server-disk-latency/">Read more</a></p>
<p>The post <a href="https://theserogroup.com/dba/identifying-sql-server-disk-latency/">Identifying SQL Server Disk Latency</a> appeared first on <a href="https://theserogroup.com">The SERO Group</a>.</p>
]]></description>
										<content:encoded><![CDATA[
<p>When SQL Server is not as fast as users think it ought to be, how can you tell where the slowdown is? Where&#8217;s the performance bottleneck? Where&#8217;s the traffic jam? Is it waiting on CPU? Does it needs memory? What about the disks? Could SQL Server be slow because of disk latency? Could be. But how can we know for sure? Fortunately, we can ask SQL Server what it&#8217;s waiting on when it&#8217;s waiting for a resource.</p>



<p>There are a couple of easy ways to check for disk latency issues in SQL Server: using the sys.dm_io_virtual_file_stats DMV and using the dbatools.io Test-DbaDiskSpeed command. Let&#8217;s look at each.</p>



<h2 class="wp-block-heading">Check disk latency using DMVs</h2>



<p>Way back in SQL Server 2005, Microsoft introduced the <a href="https://docs.microsoft.com/en-us/sql/relational-databases/system-dynamic-management-views/sys-dm-io-virtual-file-stats-transact-sql?view=sql-server-ver15" target="_blank" rel="noreferrer noopener">sys.dm_io_virtual_file_stats</a> Dynamic Management View (DMV). This DMV reports disk read and write activities for data and log files.  </p>



<p>For many years, I&#8217;ve used a query <a href="https://www.sqlskills.com/blogs/paul/how-to-examine-io-subsystem-latencies-from-within-sql-server/" target="_blank" rel="noreferrer noopener">based on one from SQLSkills&#8217; Paul Randal</a>. I&#8217;ve simply added a column to help quickly categorize/interpret the latency values. This query can be very helpful when troubleshooting what you suspect to be a disk I/O bottleneck.</p>



<pre class="wp-block-code"><code>SELECT
   &#91;ReadLatency] =
        CASE WHEN &#91;num_of_reads] = 0
            THEN 0 ELSE (&#91;io_stall_read_ms] / &#91;num_of_reads]) END,
   &#91;WriteLatency] =
        CASE WHEN &#91;num_of_writes] = 0
            THEN 0 ELSE (&#91;io_stall_write_ms] / &#91;num_of_writes]) END,
   &#91;Latency] =
        CASE WHEN (&#91;num_of_reads] = 0 AND &#91;num_of_writes] = 0)
            THEN 0 ELSE (&#91;io_stall] / (&#91;num_of_reads] + &#91;num_of_writes])) END,
   &#91;Latency Desc] = 
         CASE 
            WHEN (&#91;num_of_reads] = 0 AND &#91;num_of_writes] = 0) THEN 'N/A' 
            ELSE 
               CASE WHEN (&#91;io_stall] / (&#91;num_of_reads] + &#91;num_of_writes])) &lt; 2 THEN 'Excellent'
                    WHEN (&#91;io_stall] / (&#91;num_of_reads] + &#91;num_of_writes])) &lt; 6 THEN 'Very good'
                    WHEN (&#91;io_stall] / (&#91;num_of_reads] + &#91;num_of_writes])) &lt; 11 THEN 'Good'
                    WHEN (&#91;io_stall] / (&#91;num_of_reads] + &#91;num_of_writes])) &lt; 21 THEN 'Poor'
                    WHEN (&#91;io_stall] / (&#91;num_of_reads] + &#91;num_of_writes])) &lt; 101 THEN 'Bad'
                    WHEN (&#91;io_stall] / (&#91;num_of_reads] + &#91;num_of_writes])) &lt; 501 THEN 'Yikes!'
               ELSE 'YIKES!!'
               END 
         END, 
   &#91;AvgBPerRead] =
        CASE WHEN &#91;num_of_reads] = 0
            THEN 0 ELSE (&#91;num_of_bytes_read] / &#91;num_of_reads]) END,
   &#91;AvgBPerWrite] =
        CASE WHEN &#91;num_of_writes] = 0
            THEN 0 ELSE (&#91;num_of_bytes_written] / &#91;num_of_writes]) END,
   &#91;AvgBPerTransfer] =
        CASE WHEN (&#91;num_of_reads] = 0 AND &#91;num_of_writes] = 0)
            THEN 0 ELSE
                ((&#91;num_of_bytes_read] + &#91;num_of_bytes_written]) /
                (&#91;num_of_reads] + &#91;num_of_writes])) END,
   LEFT (&#91;mf].&#91;physical_name], 2) AS &#91;Drive],
   DB_NAME (&#91;vfs].&#91;database_id]) AS &#91;DB],
   &#91;mf].&#91;physical_name]
FROM
   sys.dm_io_virtual_file_stats (NULL,NULL) AS &#91;vfs]
   JOIN sys.master_files AS &#91;mf]
   ON &#91;vfs].&#91;database_id] = &#91;mf].&#91;database_id]
      AND &#91;vfs].&#91;file_id] = &#91;mf].&#91;file_id]
-- WHERE &#91;vfs].&#91;file_id] = 2 -- log files
ORDER BY &#91;Latency] DESC
-- ORDER BY &#91;ReadLatency] DESC
-- ORDER BY &#91;WriteLatency] DESC;
GO</code></pre>



<p>When I run this query against a docker-based SQL Server 2017 instance, I receive the following results. </p>



<figure class="wp-block-image size-large"><a href="https://theserogroup.com/wp-content/uploads/2021/05/sqlserverdisklatencystats-dmv.png"><img loading="lazy" decoding="async" width="1024" height="419" src="https://theserogroup.com/wp-content/uploads/2021/05/sqlserverdisklatencystats-dmv-1024x419.png" alt="SQL Server disk latency stats from dmv" class="wp-image-3727" srcset="https://theserogroup.com/wp-content/uploads/2021/05/sqlserverdisklatencystats-dmv-1024x419.png 1024w, https://theserogroup.com/wp-content/uploads/2021/05/sqlserverdisklatencystats-dmv-300x123.png 300w, https://theserogroup.com/wp-content/uploads/2021/05/sqlserverdisklatencystats-dmv-768x314.png 768w, https://theserogroup.com/wp-content/uploads/2021/05/sqlserverdisklatencystats-dmv-1536x628.png 1536w, https://theserogroup.com/wp-content/uploads/2021/05/sqlserverdisklatencystats-dmv-2048x837.png 2048w, https://theserogroup.com/wp-content/uploads/2021/05/sqlserverdisklatencystats-dmv-1920x785.png 1920w" sizes="auto, (max-width: 1024px) 100vw, 1024px" /></a></figure>



<p>The Latency Desc column helps to interpret the results. Latency can be classified as shown in the following table. Of course, this is a rule of thumb and your needs may vary. </p>



<figure class="wp-block-table is-style-stripes"><table><tbody><tr><td>0 to 1 ms</td><td>Excellent</td></tr><tr><td>2 to 5 ms</td><td>Very good</td></tr><tr><td>6 to 10 ms</td><td>Good</td></tr><tr><td>11 to 20 ms</td><td>Poor</td></tr><tr><td>21 to 100 ms</td><td>Bad</td></tr><tr><td>101 to 500 ms</td><td>Yikes!</td></tr><tr><td>more than 500 ms</td><td>YIKES!!!</td></tr></tbody></table></figure>



<h2 class="wp-block-heading">Check disk latency using dbatools</h2>



<p>Fans of <a href="https://dbatools.io/" target="_blank" rel="noreferrer noopener">dbatools.io</a> may already know that something similar to the query above is included as part of the <a href="https://docs.dbatools.io/#Test-DbaDiskSpeed" target="_blank" rel="noreferrer noopener">Test-DbaDiskSpeed</a> command. </p>



<p>You can run the command as-is, only providing the instance and credentials to use. I typically add a few other options to format the output into a table and send it to a file that I can easily examine. </p>



<pre class="wp-block-code"><code>Test-DbaDiskSpeed -SqlInstance localhost -SqlCredential sa | Format-Table -Property Database, SizeGB, FileName, FileID, FileType, DiskLocation, Reads, AverageReadStall, ReadPerformance, Writes, AverageWriteStall, WritePerformance, 'Avg Overall Latency' | Out-String -Width 4096 |out-file c:\temp\DbaDiskSpeed.txt</code></pre>



<p>Running the PowerShell script on my docker-based SQL Server 2017 instance provides the following output file. </p>



<figure class="wp-block-image size-large"><a href="https://theserogroup.com/wp-content/uploads/2021/05/diskspeedoutputsqlserverdbatools.png"><img loading="lazy" decoding="async" width="1024" height="354" src="https://theserogroup.com/wp-content/uploads/2021/05/diskspeedoutputsqlserverdbatools-1024x354.png" alt="SQL Server disk latency identified dbatools" class="wp-image-3731" srcset="https://theserogroup.com/wp-content/uploads/2021/05/diskspeedoutputsqlserverdbatools-1024x354.png 1024w, https://theserogroup.com/wp-content/uploads/2021/05/diskspeedoutputsqlserverdbatools-300x104.png 300w, https://theserogroup.com/wp-content/uploads/2021/05/diskspeedoutputsqlserverdbatools-768x265.png 768w, https://theserogroup.com/wp-content/uploads/2021/05/diskspeedoutputsqlserverdbatools-1536x531.png 1536w, https://theserogroup.com/wp-content/uploads/2021/05/diskspeedoutputsqlserverdbatools.png 1598w" sizes="auto, (max-width: 1024px) 100vw, 1024px" /></a></figure>



<h2 class="wp-block-heading">Let&#8217;s not ask SQL Server about disk latency</h2>



<p>Of course, there will be those who mistrust the results from either of these methods, because, well, of course SQL Server wouldn&#8217;t fess up to being the bottleneck. It&#8217;s obviously going to point the finger elsewhere. </p>



<p>To address those claims, check out <a href="https://theserogroup.com/sql-server-consulting/identify-disk-i-o-performance-issues-for-your-sql-server-using-diskspd/">Identify Disk I/O Performance Issues for Your SQL Server Using DiskSpd</a>. That tool completely removes SQL Server from the discussion and objectively tests the disk I/O. </p>



<p>But for a quick sanity check, you can&#8217;t beat the sys.dm_io_virtual_file_stats DMV and the Test-DbaDiskSpeed command.</p>



<p>Looking for other ways to diagnose or improve performance? Here are a few other posts that may help. </p>



<ul class="wp-block-list"><li><a href="https://theserogroup.com/sql-server/should-i-add-hardware-resources-to-my-sql-server-do-this-first/">Should I Add Hardware Resources to My SQL Server? Do This First.</a> </li><li><a href="https://theserogroup.com/dba/sql-server-performance-and-windows-power-plan/">SQL Server Performance and Windows Power Plan</a></li><li><a href="https://theserogroup.com/dba/how-do-views-affect-sql-server-performance/">How do Views Affect SQL Server Performance?</a></li><li><a href="https://theserogroup.com/sql-server/is-my-sql-server-configured-properly/">Is My SQL Server Configured Properly?</a></li></ul>



<h2 class="wp-block-heading">Want to work with The SERO Group?</h2>



<p>Want to learn more about how SERO Group helps organizations take the guesswork out of managing their SQL Servers? It’s easy and there is no obligation.&nbsp;</p>



<p><a href="https://calendly.com/joe_webb" target="_blank" rel="noreferrer noopener">Schedule a call</a>&nbsp;with us to get started.</p>
<p>The post <a href="https://theserogroup.com/dba/identifying-sql-server-disk-latency/">Identifying SQL Server Disk Latency</a> appeared first on <a href="https://theserogroup.com">The SERO Group</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://theserogroup.com/dba/identifying-sql-server-disk-latency/feed/</wfw:commentRss>
			<slash:comments>1</slash:comments>
		
		
		<post-id xmlns="com-wordpress:feed-additions:1">3721</post-id>	</item>
		<item>
		<title>What Takes Precedent db_datareader (GRANT) or db_denydatareader (DENY)?</title>
		<link>https://theserogroup.com/data-security/what-takes-precedent-db_datareader-grant-or-db_denydatareader-deny/</link>
					<comments>https://theserogroup.com/data-security/what-takes-precedent-db_datareader-grant-or-db_denydatareader-deny/#comments</comments>
		
		<dc:creator><![CDATA[Joe Webb]]></dc:creator>
		<pubDate>Thu, 22 Apr 2021 12:46:24 +0000</pubDate>
				<category><![CDATA[Data Security]]></category>
		<category><![CDATA[Database]]></category>
		<category><![CDATA[Database Administration]]></category>
		<category><![CDATA[Database Development]]></category>
		<category><![CDATA[IT Manager]]></category>
		<category><![CDATA[Microsoft Azure]]></category>
		<category><![CDATA[Script Library]]></category>
		<category><![CDATA[Sero]]></category>
		<category><![CDATA[Sero Group]]></category>
		<category><![CDATA[Serogroup]]></category>
		<category><![CDATA[SQL]]></category>
		<category><![CDATA[SQL Assessment]]></category>
		<category><![CDATA[SQL Audit]]></category>
		<category><![CDATA[SQL Consultant]]></category>
		<category><![CDATA[SQL Events]]></category>
		<category><![CDATA[SQL Security]]></category>
		<category><![CDATA[SQL Server]]></category>
		<category><![CDATA[SQL Server Consultant]]></category>
		<category><![CDATA[SQL Server Management]]></category>
		<category><![CDATA[TempDB]]></category>
		<category><![CDATA[The Sero Group]]></category>
		<guid isPermaLink="false">https://theserogroup.com/?p=3668</guid>

					<description><![CDATA[<p>If a user is a member of db_datareader, which grants access to a table, and db_denydatareader, which denies access to a table, which role will take precedent? That’s the question someone on LinkedIn recently posted in the SQL Server Administrators group recently. Here’s a link to the question. The LinkedIn poster essentially wanted to know&#8230; <br /> <a class="read-more" href="https://theserogroup.com/data-security/what-takes-precedent-db_datareader-grant-or-db_denydatareader-deny/">Read more</a></p>
<p>The post <a href="https://theserogroup.com/data-security/what-takes-precedent-db_datareader-grant-or-db_denydatareader-deny/">What Takes Precedent db_datareader (GRANT) or db_denydatareader (DENY)?</a> appeared first on <a href="https://theserogroup.com">The SERO Group</a>.</p>
]]></description>
										<content:encoded><![CDATA[
<p>If a user is a member of db_datareader, which grants access to a table, and db_denydatareader, which denies access to a table, which role will take precedent? </p>



<p>That’s the question someone on LinkedIn recently posted in the SQL Server Administrators group recently. Here’s a <a rel="noreferrer noopener" href="https://www.linkedin.com/feed/update/urn:li:activity:6789422838764974080/" target="_blank">link to the question</a>. The LinkedIn poster essentially wanted to know how SQL Server handles permissions when a user is a member of more than one database role if the roles conflict. </p>



<p>The short answer is: permissions in SQL Server are cumulative. If a user is a member of the db_datareader role and the db_datawriter role, the user will have both read and write permissions to the table. However, when DENY is thrown into the mix, it trumps all other assigned permissions. It doesn’t matter if multiple roles grant access to a table, if even one DENY is present for the user, the user will not have access to the table. </p>



<p>Here’s a link to some documentation that provides additional information and background. <a href="https://docs.microsoft.com/en-us/sql/relational-databases/security/authentication-access/database-level-roles?view=sql-server-ver15">Database-Level Roles &#8211; SQL Server | Microsoft Docs</a></p>



<h2 class="wp-block-heading" id="h-testing-db-datareader-and-db-denydatareader-precedence">Testing db_datareader and db_denydatareader precedence</h2>



<p>Sometimes an example is worth a thousand words so let’s create a simple scenario to demonstrate how db_denydatareader overrides db_datareader. For this example, I’ll use the <a href="https://theserogroup.com/career-development/data-getcha-data-here/">BaseballData sample database</a>. </p>



<p>Let’s start by creating two users, Arnie and Belinda. </p>



<pre class="wp-block-code"><code>USE MASTER; 
GO 

--create logins
CREATE LOGIN Arnie WITH PASSWORD = 'a7a68d@@#8tn'; 
CREATE LOGIN Belinda WITH PASSWORD = '**4mfn*@!96f';


--create database users 
USE BaseballData; 
GO 

CREATE USER Arnie FOR LOGIN Arnie; 
CREATE USER Belinda FOR LOGIN Belinda; </code></pre>



<p>Neither Arnie nor Belinda have access to the players table at this point. </p>



<pre class="wp-block-code"><code>--test access to the the players 
EXECUTE AS LOGIN = 'Arnie';

--attempt to select from the players table
SELECT TOP 5 USER_NAME(), lahmanID, nameFirst, nameLast FROM players; 

REVERT; 
</code></pre>



<figure class="wp-block-image size-large"><a href="https://theserogroup.com/wp-content/uploads/2021/04/no_sql_server_access_for_login_default.png"><img loading="lazy" decoding="async" width="806" height="148" src="https://theserogroup.com/wp-content/uploads/2021/04/no_sql_server_access_for_login_default.png" alt="Users have no SQL Server access by default" class="wp-image-3676" srcset="https://theserogroup.com/wp-content/uploads/2021/04/no_sql_server_access_for_login_default.png 806w, https://theserogroup.com/wp-content/uploads/2021/04/no_sql_server_access_for_login_default-300x55.png 300w, https://theserogroup.com/wp-content/uploads/2021/04/no_sql_server_access_for_login_default-768x141.png 768w" sizes="auto, (max-width: 806px) 100vw, 806px" /></a></figure>



<p>Now, let’s assign Arnie to the db_datareader role. We’ll assign Belinda to the db_datareader and db_denydatareader roles. </p>



<pre class="wp-block-code"><code>--add Arnie to the db_datareader role
ALTER ROLE db_datareader ADD MEMBER Arnie; 
GO 

--add Belinda to the db_datareader and db_denydatareader roles
ALTER ROLE db_datareader ADD MEMBER Belinda; 
ALTER ROLE db_denydatareader ADD MEMBER Belinda; 
GO 
</code></pre>



<p>Test Arnie&#8217;s access to the players table.</p>



<pre class="wp-block-code"><code>--test access to the the players 
EXECUTE AS LOGIN = 'Arnie';

--attempt to select from the players table
SELECT TOP 5 USER_NAME(), lahmanID, nameFirst, nameLast FROM players; 

REVERT; </code></pre>



<figure class="wp-block-image size-large"><a href="https://theserogroup.com/wp-content/uploads/2021/04/arnie_access-1.png"><img loading="lazy" decoding="async" width="394" height="198" src="https://theserogroup.com/wp-content/uploads/2021/04/arnie_access-1.png" alt="db_datareader access to sql" class="wp-image-3686" srcset="https://theserogroup.com/wp-content/uploads/2021/04/arnie_access-1.png 394w, https://theserogroup.com/wp-content/uploads/2021/04/arnie_access-1-300x151.png 300w" sizes="auto, (max-width: 394px) 100vw, 394px" /></a></figure>



<p>Meanwhile for Belinda.</p>



<pre class="wp-block-code"><code>--test access to the the players 
EXECUTE AS LOGIN = 'Belinda';

--attempt to select from the players table
SELECT TOP 5 USER_NAME(), lahmanID, nameFirst, nameLast FROM players; 

REVERT; </code></pre>



<figure class="wp-block-image size-large"><a href="https://theserogroup.com/wp-content/uploads/2021/04/Belinda_access.png"><img loading="lazy" decoding="async" width="800" height="150" src="https://theserogroup.com/wp-content/uploads/2021/04/Belinda_access.png" alt="db_denydatareader trumps db_datareader" class="wp-image-3678" srcset="https://theserogroup.com/wp-content/uploads/2021/04/Belinda_access.png 800w, https://theserogroup.com/wp-content/uploads/2021/04/Belinda_access-300x56.png 300w, https://theserogroup.com/wp-content/uploads/2021/04/Belinda_access-768x144.png 768w" sizes="auto, (max-width: 800px) 100vw, 800px" /></a></figure>



<p>So Belinda, despite being a member of the db_datareader database role was denied access to the table because she was also a member of the db_denydatareader role. DENY trumps GRANT. </p>



<p>Finally, for good measure, let’s remove Belinda from both roles and then add them back in reverse order. This will prove that order doesn’t matter when role member is assigned. </p>



<pre class="wp-block-code"><code>-- remove Belinda from her roles
ALTER ROLE db_datareader DROP MEMBER Belinda; 
ALTER ROLE db_denydatareader DROP MEMBER Belinda; 
GO 

--add Belinda to the roles in reverse order
ALTER ROLE db_denydatareader ADD MEMBER Belinda; 
ALTER ROLE db_datareader ADD MEMBER Belinda; 
GO 
</code></pre>



<p>Running the select statement again for Belinda, produces the same result &#8211; access denied.</p>



<p>So, when a user is assigned to multiple database roles, the effective permissions are cumulative, except when DENY is present. DENY means deny. Period. </p>



<h2 class="wp-block-heading" id="h-testing-db-datareader-and-db-denydatareader-precedent-for-sysadmin-and-db-owner">Testing db_datareader and db_denydatareader precedent for sysadmin and db_owner</h2>



<p>Oh, but you say, what about members of elevated roles such as db_owner and sysadmin? Will DENY still override someone who has that level of access? </p>



<p>Ahh! Good question. Let’s see. </p>



<p>Let’s create a third user, Charlene, and make her a member of db_owner. We’ll also create  a login, Dallas, and make it a member of the vaulted sysadmin server role. Note: in the example, we&#8217;ll add Dallas as database user. Members of the sysadmin role have access to database resources, such as tables, without the need for an associated database user. However, since db_denydatareader is a database role, Dallas will need a database user so we can attempt to deny the login with the database role.</p>



<pre class="wp-block-code"><code>USE MASTER; 
GO 

--create logins
CREATE LOGIN Charlene WITH PASSWORD = 'ynr87rn3!u*b'; 
CREATE LOGIN Dallas WITH PASSWORD = ')rbc$6t*hlq1';
GO 

--add Dallas to the sysadmin server role
ALTER SERVER ROLE sysadmin ADD MEMBER Dallas; 
GO 

--create database users 
USE BaseballData; 
GO 

--create user Charlene
CREATE USER Charlene FOR LOGIN Charlene; 
GO

--create user Dallas 
CREATE USER Dallas FOR LOGIN Dallas; 
GO

--add Charlene to the db_owner database role
ALTER ROLE db_owner ADD MEMBER Charlene; 
GO </code></pre>



<p>Now let’s test their access as members of db_owner and sysadmin to the players table. </p>



<pre class="wp-block-code"><code>--test access to the the players 
EXECUTE AS LOGIN = 'Charlene';

--attempt to select from the players table
SELECT TOP 5 USER_NAME(), lahmanID, nameFirst, nameLast FROM players; 

REVERT; 


--test access to the the players 
EXECUTE AS LOGIN = 'Dallas';

--attempt to select from the players table
SELECT TOP 5 USER_NAME(), lahmanID, nameFirst, nameLast FROM players; 

REVERT; 
</code></pre>



<p>As expected, both natively have access to the players table due to their elevated permissions. </p>



<figure class="wp-block-image size-large"><a href="https://theserogroup.com/wp-content/uploads/2021/04/elevated_permissions.png"><img loading="lazy" decoding="async" width="390" height="358" src="https://theserogroup.com/wp-content/uploads/2021/04/elevated_permissions.png" alt="roles with elevated permissions in sql server" class="wp-image-3681" srcset="https://theserogroup.com/wp-content/uploads/2021/04/elevated_permissions.png 390w, https://theserogroup.com/wp-content/uploads/2021/04/elevated_permissions-300x275.png 300w" sizes="auto, (max-width: 390px) 100vw, 390px" /></a></figure>



<p>Now, let&#8217;s add Charlene and Dallas to the db_denydatareader database role. </p>



<pre class="wp-block-code"><code>--add Charlene and Dallas to the db_denydatareader role
ALTER  ROLE db_denydatareader ADD MEMBER Charlene;
ALTER  ROLE db_denydatareader ADD MEMBER Dallas; 
GO </code></pre>



<p>Running the same query again as Charlene and Dallas now produces the following. </p>



<figure class="wp-block-image size-large"><a href="https://theserogroup.com/wp-content/uploads/2021/04/denyingaccesstosqltables.png"><img loading="lazy" decoding="async" width="784" height="222" src="https://theserogroup.com/wp-content/uploads/2021/04/denyingaccesstosqltables.png" alt="deny sql server access" class="wp-image-3682" srcset="https://theserogroup.com/wp-content/uploads/2021/04/denyingaccesstosqltables.png 784w, https://theserogroup.com/wp-content/uploads/2021/04/denyingaccesstosqltables-300x85.png 300w, https://theserogroup.com/wp-content/uploads/2021/04/denyingaccesstosqltables-768x217.png 768w" sizes="auto, (max-width: 784px) 100vw, 784px" /></a></figure>



<figure class="wp-block-image size-large"><a href="https://theserogroup.com/wp-content/uploads/2021/04/sysadmin_still_has_access.png"><img loading="lazy" decoding="async" width="390" height="194" src="https://theserogroup.com/wp-content/uploads/2021/04/sysadmin_still_has_access.png" alt="sysadmin has access to sql server" class="wp-image-3684" srcset="https://theserogroup.com/wp-content/uploads/2021/04/sysadmin_still_has_access.png 390w, https://theserogroup.com/wp-content/uploads/2021/04/sysadmin_still_has_access-300x149.png 300w" sizes="auto, (max-width: 390px) 100vw, 390px" /></a></figure>



<p>So, members of the db_owners database role can be denied access to key tables and resources within a database using database roles. However, members of the sysadmin server role will still have access even if their associated database user is denied access. </p>



<p>If you&#8217;ve been following along and want to clean up after your code</p>



<pre class="wp-block-code"><code>USE BaseballData; 
GO

DROP USER Arnie; 
DROP USER Belinda; 
DROP USER Charlene; 
DROP USER Dallas; 

USE MASTER; 
GO 

DROP LOGIN Arnie; 
DROP LOGIN Belinda; 
DROP LOGIN Charlene; 
DROP LOGIN Dallas; 
</code></pre>



<h2 class="wp-block-heading" id="h-want-to-work-with-the-sero-group">Want to work with The SERO Group?</h2>



<p>Want to learn more about how SERO Group helps organizations take the guesswork out of managing their SQL Servers? It’s easy and there is no obligation.&nbsp;</p>



<p><a href="https://theserogroup.com/#contact" target="_blank" rel="noreferrer noopener">Schedule a call</a> with us to get started.</p>
<p>The post <a href="https://theserogroup.com/data-security/what-takes-precedent-db_datareader-grant-or-db_denydatareader-deny/">What Takes Precedent db_datareader (GRANT) or db_denydatareader (DENY)?</a> appeared first on <a href="https://theserogroup.com">The SERO Group</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://theserogroup.com/data-security/what-takes-precedent-db_datareader-grant-or-db_denydatareader-deny/feed/</wfw:commentRss>
			<slash:comments>6</slash:comments>
		
		
		<post-id xmlns="com-wordpress:feed-additions:1">3668</post-id>	</item>
	</channel>
</rss>
