SQL

Restoring Backups from Azure Blob with dbatools

Recently I needed to write a PowerShell script that could build a backup set from a collection of backups stored in Azure Blob Storage without any backup history available from MSDB. And as with all things SQL Server and PowerShell related I went straight to dbatools.io to see if Restore-DbaDatabase was up to the task…and of course, it is…let’s talk about how I solved this challenge.

When restoring from Azure Blob, the main challenge you have is accessing the blobs and building a backup set. For this process, you’ll need access to the Storage Account via PowerShell and you’ll have to have define a Credential on your SQL Instance that has access to the Storage Account. Here’s the code I used to connect to my Storage Account in Azure.

Using kubectl logs to read the SQL Server Error Log in Kubernetes

When working with SQL Server running containers the Error Log is written to standard out. Kubernetes will expose that information to you via kubectl. Let’s check out how it works.

If we start up a Pod running SQL Server and grab the Pod name

kubectl get pods
NAME                                READY   STATUS    RESTARTS   AGE
mssql-deployment-56d8dbb7b7-hrqwj   1/1     Running   0          22m

We can usefollow flag and that will continuously write the error log to your console, similar to using tail with the -f option. If you remove the follow flag it will write the current log to your console. This can be useful in debugging failed startups or in the case below, monitoring the status of a database restore. When finished you can use CTRL+C to break out and return back to your prompt.

Workshop – Kubernetes Zero to Hero at SQL Saturday Denver!

Pre-conference Workshop at SQLSaturday Denver

I’m proud to announce that I will be be presenting an all day pre-conference workshop at SQL Saturday Denver on October 11th 2019! This one won’t let you down!

The workshop is **“Kubernetes Zero to Hero – Installation, Configuration, and Application Deployment” **

    <a href="https://www.eventbrite.com/e/kubernetes-zero-to-hero-installation-configuration-and-application-deployment-tickets-70529350185"><img loading="lazy" style="display: block; margin-left: auto; margin-right: auto;" title="NewImage.png" src="/images/2019/01/Availability-Group-StatusNewImage-1.png" alt="NewImage" width="129" height="126" border="0" /></a>

    **Here’s the abstract for the workshop**

  <blockquote>

      Modern application deployment needs to be fast and consistent to keep up with business objectives and Kubernetes is quickly becoming the standard for deploying container-based applications, fast. In this day-long session, we will start with an architectural overview of a Kubernetes cluster and how it manages application state. Then we will learn how to build a production-ready cluster. With our cluster up and running, we will learn how to interact with our cluster, common administrative tasks, then wrap up with how to deploy applications and SQL Server. At the end of the session, you will know how to set up a Kubernetes cluster, manage a cluster, deploy applications and databases, and how to keep everything up and running.

  </blockquote>

Session Objectives

Using strace inside a SQL Server Container

So, if you’ve been following my blog you know my love for internals. Well, I needed to find out exactly how something worked at the startup of a SQL Server process running inside a docker container and my primary tool for this is <a href="http://man7.org/linux/man-pages/man1/strace.1.html">strace</a>, well how do you run strace against processes running in a container? I hadn’t done this before and needed to figure this out…so let’s go through how I pulled this off.

Docker Image Tags are Case Sensitive

A quick post about pulling docker containers (this applies to docker run too)…when specifying the container image, the container image name and tag are case sensitive. We’re not going to discuss how much time troubleshooting it too me to figure this out…but let’s just say it’s more than I care to admit publicly.

In this code you can see I’m specifying the following image and tag server:2019-rc1-ubuntu (notice the lowercase rc in the tag)

Persisting SQL Server Data in Docker Containers – Part 3

In the first two posts in this series we discussed the need for data persistency in containers then we discussed where the data actually lives on our systems. Now let’s look at specifying the location of the data on the underlying file system of the base OS.

This is the third post in a three part series on Persisting SQL Server Data in Docker Containers. The first post introducing Docker Volumes is here. The second post on where Docker actually stores your data is here.

Persisting SQL Server Data in Docker Containers – Part 2

So in my previous post, we discussed Docker Volumes and how they have a lifecycle independent of the container enabling us to service the container image independent of the data inside the container. Now let’s dig into Volumes a little bit more and learn where Docker actually stores that data on the underlying operating system.

This is the second post in a three part series on Persisting SQL Server Data in Docker Containers. The first post introducing Docker Volumes is here. And the third post on mapping base OS directories directly into containers is here.

Persisting SQL Server Data in Docker Containers – Part 1

What’s the number one thing a data professional wants to do with their data…keep it around. Let’s talk about running SQL Server in Containers using Docker Volumes on a Mac

This is the first post in a three part series on Persisting SQL Server Data in Docker Containers. The second post on where Docker actually stores your data is here. And the third post on mapping base OS directories directly into containers is here.

Microsoft Most Valuable Professional – Data Platform for 2019-2020

Today, I’m proud to announce that I have been renewed as an Microsoft MVP – Data Platform for the 2019-2020 award year, my third MVP award. This is an truly an honor and I’m humbled to be included in this group of exceptional data professionals. I really look forward to continuing to work with everyone in the MVP community and continuing to contribute to our unmatched Data Platform Community!

MVP Logo Horizontal Secondary Blue286 CMYK 300ppi****

Speaking at SQL Saturday Dallas

Speaking at SQLSaturday Dallas!

  I’m proud to announce that I will be speaking at <a href="https://www.sqlsaturday.com/841/eventhome.aspx">SQL Saturday Dallas</a> on May 17th 2018! This one won’t let you down! <a href="https://www.sqlsaturday.com/841/Sessions/Schedule.aspx">Check out the amazing schedule</a>!

  If you don’t know what SQLSaturday is, it’s a whole day of free SQL Server training available to you at no cost!

  If you haven’t been to a SQLSaturday, what are you waiting for! <a href="https://www.sqlsaturday.com/841/registernow.aspx">Sign up now</a>!

  My presentation is **“<a href="https://www.sqlsaturday.com/841/Sessions/Details.aspx?sid=92433">Practical Container Scenarios in Azure</a>” **

  <a href="https://www.sqlsaturday.com/841/EventHome.aspx"><img loading="lazy" style="display: block; margin-left: auto; margin-right: auto;" title="NewImage.png" src="/images/2019/05/SQLSATDALLASNewImage.png" alt="NewImage" width="127" height="20" border="0" /></a>

  Here’s the abstract for the talk

<blockquote>

    You’ve heard the buzz about containers and Kubernetes, now let’s start your journey towards rapidly deploying and scaling your container-based applications in Azure. In this session, we will introduce containers and the container orchestrator Kubernetes. Then we’ll dive into how to build a container image, push it into our Azure Container Registry and deploy it our Azure Kubernetes Services cluster. Once deployed, we’ll learn how to keep our applications available and how to scale them using Kubernetes.

    Key topics introduced<br />Building Container based applications<br />Publishing containers to Azure Container Registry<br />Deploying Azure Kubernetes Services Clusters<br />Scaling our container-based applications in Azure Kubernetes Services

</blockquote>