Press "Enter" to skip to content

Month: September 2023

Restoring Backups from S3 to Azure SQL MI

Strahinja Rodic announces a new feature going to GA:

In September last year SQL server 2022 introduced new feature – backup and restore to simple storage service (S3) – compatible object storage that grants the user the capability to back up or restore their databases using S3-compatible object storage, whether that be on-premises, or in the cloud.

To provide this integration Azure SQL MI is enriched with a new S3 connector, which uses the S3 REST API to connect to Amazon S3 storage. It extends the existing RESTORE FROM URL syntax by adding support for the new S3 connector using the REST API.

Click through to see what you need to have set up for it to work, as well as the restoration process.

Comments closed

Automatic SSL Certificate Updates for SQL Server

Jamie Wick doesn’t want to waste time clicking mouse buttons:

In a previous post (How Secure Are Your Client Connections?) I covered using SSL certificates to encrypt client connections to SQL Server. One part of the process that has always been annoyingly repetitive is the need to regularly renew/update the SSL certificate(s) and reconfigure SQL Server to use them. In the past our SSL certs were good for 3 years. Then in 2020 Google, Microsoft, Apple & others announced that they were reducing their certificate validity period to a maximum of 398 days. Recently, there have been proposals to further reduce the validity period to 90 days. When this happens (and I’m certain it is a when, and not an if situation), manually replacing SSL certs on multiple SQL servers will not be a viable option.

Read on to see what Jamie’s solution to the problem is.

Comments closed

Scale-Out Read-Only Databases in Azure SQL DB

Etienne Lopes begins a new series:

As part of High Availability architecture, each single database, elastic pool database, and managed instance in the Premium and Business Critical service tier is automatically provisioned with a primary read-write replica and one or more secondary read-only replicas.”

Read on to see how you can add support for read-only, scale-out replicas to an existing Azure SQL Database. Just know how much that bill is going to be.

Comments closed

Power Query Templates

Reza Rad looks at a new feature:

Have you ever considered exporting your entire Power Query Editor project as a single object? Have you thought about what benefits this would bring for you? Things such as version control and team development can be on the horizon, bringing the ability to migrate between tools and services easily. Fortunately, such functionality exists, called the Power Query Template. In this article and video, I will explain what this is, how it works, and the importance of such a feature.

Reza is, on the whole, quite pleased with it.

Comments closed

Debugging SQL Server Stored Procedures

Erik Darling lays out a good opinion:

This can really save your hide when you hit a reproducible issue. Proper error handling is part of proper debugging, too.

I generally detest PowerShell, but I love that some commands have a -WhatIf parameter to test what would happen. For normal SQL Server queries, you don’t get that.

But if you’re writing dynamic SQL that may execute database commands (backup, checkdb, settings changes, etc.), you should also include a parameter that prevents dynamic SQL execution so you can debug without worrying about wreaking havoc.

Read the whole thing. I might handle the specific mechanisms of debugging slightly differently, but Erik’s packed this post full of good advice.

Comments closed

The READPAST Query Hint

Chad Callihan gives us a hint:

Have you ever heard of the READPAST query hint? I would say it’s kind of a sibling to NOLOCK. With NOLOCK, you’ll get data back faster but risk dirty reads. With READPAST, SQL Server will skip right past locked data altogether. This can either be helpful or, if you don’t know how it’s used, incredibly dangerous.

Read on to see what it does. I’m not sure I’ve ever used READPAST before, but I’m also using read committed snapshot isolation whenever I can, so that would limit the utility of the READPAST hint. I don’t have the visceral disgust with READPAST that I do with NOLOCK, though I suppose the reason for that is just how uncommon the former is, whereas every bad code base I run into is inundated with NOLOCK everywhere.

Comments closed

BotChat BiWeekly

Mala Mahadevan starts a newsletter:

I do my best to find trustworthy sources to learn from, but you know how it is – sometimes it’s tough to tell what’s legit. So, if you ever see me post something that seems a bit off, please cut me some slack. These aren’t necessarily my opinions, just things that caught my eye.

What I learn is just my take on what I heard or read. It might not always jive with what the original speaker or writer means, or understand. I don’t use any fancy AI bots like ChatGPT to help me out. I just quote stuff and break it down in my own words.

Mala focuses on a pair of videos. I snuck into the newsletter with a few bomb-throwing statements, particularly around anthropomorphism (the assignment of human or human-like qualities to non-humans). Anthropomorphism is extremely common in language. It’s all well and good as metaphor, but once you start to believe it for real, that’s when you end up in trouble.

Comments closed

A Currency Conversion Pattern for DAX

Teo Lachev pulls out the money clip:

Currency conversion is a common requirement, such as when implementing analytics on top of ERP sales data recorded in multiple currencies. The most flexible approach is to allow the user to select a currency and perform the conversion at runtime, ideally by centralizing the conversion code in Power BI calculation groups. However, this approach has several shortcomings:

Read on for those shortcomings, as well as an approach Teo has to improve things.

Comments closed

Row-Level Security Setup in SQL Server

Ben Johnston configures row-level security in SQL Server:

Implementing RLS is as much a business endeavour as technical. Without a business case to implement RLS, there is no reason for the extra effort and testing involved. This is where driving out business requirements and making sure the solution fits the problem is important. Non-technical members of the team or business partners likely won’t know what RLS is or if it should be used. Differential access to the same data, replacing systems (or proposed systems) with multiple reports based on user groups, and multi-tenant access are possible indicators that RLS may be a useful tool. There are always multiple ways to solve a problem. If RLS would simplify the design and make it more robust, that’s when I start to seriously consider it for a design. It does help if the business is aware of RLS and have used it in other projects or databases, but having the business essentially design the system is dangerous too. Use all of the information available during planning sessions and design the system that best fits the need of the business and the skills of the technical team.

Read the whole thing. I’m particularly interested in this series, as I’ve liked row-level security and didn’t find any trivial workarounds or exploits, but also hate how slow it is once you’re dealing with large datasets.

Comments closed

Australian Azure Downtime After-Action Report

Brent Ozar shares some thoughts:

Note that 11:34, the decision was made to shut down infrastructure without Microsoft failing your databases over elsewhere. If you were an Azure SQL DB or Cosmos DB user, and you weren’t paying for replicas in another data center, it was up to you to follow Microsoft’s disaster recovery guidance.

Controversial opinion: I actually love that and I think it’s great.

That is definitely a controversial opinion, but it’s also one I agree with. Read on for more of Brent’s thoughts.

Comments closed