Monday Coffee: The evolving DBA

Over the weekend I saw a few tweets about the role of the DBA. These tweets (and corresponding blog posts) come around once every so often and are generally along the lines of “Is the DBA role dead?” (or something to that ilk).

Here’s my two cents on the matter, the DBA role is nor ever will be dead.

However that doesn’t mean that I don’t think the role will change. It’s definitely changing, DBA roles twenty years from now will be very different just as DBA roles twenty years ago are very different to what they are now.

And that’s a good thing right? Who wants to be doing exactly the same thing for their entire careers?

I think DBAs are probably one of the best IT roles to cope with change. We have to learn a broad spectrum of skills, from system administration to database development which allows us to move into other areas as focuses change.

With all the new technologies that are coming out we have options to specialise in Data Science or even say, Linux administration as our priorities shift away from the traditional backup/restore, query tuning etc. tasks.

I personally think it’s the most exciting time to be a DBA and I look forward to the changes of my role continuing.

Have a good week!

Friday Reading 2017-07-28

Hope you all had a good week. Been pretty chilled out here so I’ve been reading…

Announcing Azure Container Instances
Microsoft blog about a new Azure service allowing us to deploy containers from the Azure CLI

sp_WhoIsActive Documentation
All of the supporting docs for Adam Machanic’s excellent sp_WhoIsActive

13 things you should know about Statistics and the Query Optimizer
Old post but always good to have a refresher into how the Query Optimizer works

Remove all user defined variables without restarting the PowerShell Console or ISE
Interesting post on how to reset variables in powershell

Downloadable SQL Server Desktop Wallpapers
Kendra Little’s awesome handdrawn SQL wallpapers. I’ve got my eye on the partitioning one 🙂

Have a good weekend!

Automatically restarting Docker containers

One of the problems that I’ve encountered since moving my Dev/QA departments to using SQL Server within containers is that the host machine is now a single point of failure.

Now there’s a whole bunch of posts I could write about this but the one point I want to bring up now is…having to start up all the containers after patching the host.

I know, I know…technically I shouldn’t bother. After patching and bouncing the host, the containers should all be blown away and new ones deployed. But this is the real world and sometimes people want to retain the container(s) that they’re working with.

I have found it best practice to stop all containers before restarting the host (with the docker stop command) and then starting them back up (with the docker start command) once the host has come online.

However I need not have bothered! Docker gives you the option of setting a restart policy for your containers with the following options: –

  • no: Never automatically restart (the default)
  • on-failure: Restart if there’s been an issue which isn’t critical
  • unless-stopped: Restart unless Docker stops or is explicitly stopped
  • always: Always restart unless explicitly stopped

Let’s run through a quick test using Docker on Windows Server 2016. First let’s run a container: –

docker run -d -p 15789:1433 --restart always --env ACCEPT_EULA=Y --env SA_PASSWORD=Testing1122 --name testcontainer microsoft/mssql-server-windows

docker ps

I’ve used the always option here, so Docker won’t restart my container, but what happens when I bounce the server?

restart-computer -force

Wait for the server to restart and then I can compare system uptime to container uptime: –

$wmi = Get-WmiObject -Class Win32_OperatingSystem
$wmi.ConvertToDateTime($wmi.LocalDateTime) - $wmi.ConvertToDateTime($wmi.LastBootUpTime)

docker ps

N.B. – code to check system uptime is from here

From the above screen shot I can see that the server came up ~6 mins ago and the container came up ~4 mins ago. OK, there’s a bit of a delay there (probably due to the host OS booting, my Azure VMs aren’t really high spec) but the container has come up automatically! So with this switch there’s no need to have to manually start up all the containers on the host.

I’d recommend specifying this switch for all containers if they are being used for active development as this would be pretty handy if there was ever a case of an unexpected host reboot. I don’t want to have to be running start commands whilst a load of developers are waiting for their SQL instances to spin up 🙂

Thanks for reading!

Monday Coffee: SQL Services in Containers

I had an interesting question on twitter last week when I published my post on Running Linux Container on Windows: –

“Does that container support Microsoft ML yet?”

I have absolutely no experience with Machine Learning so really had no clue. But as I had the container up and running I thought I’d give it a quick test by seeing if I could run a Python script. However I didn’t get far: –

The required services are not installed in the container so no luck. It’s the same with the SQL Agent service, you can enable it and create jobs but when you try and run them: –

The SQL Agent service is there in windows containers but if you try and start it up you’ll get a whole bunch of errors.

So it seems, for now, that it really is just the Database Engine that’s available in containers. That’s really useful on its own but there are a lot of people out there who require the other components of SQL Server. If Microsoft want to see people running SQL in Containers become widespread, then more functionality really needs to be available.

I actually have high hopes for this, especially with the announcement of the Agent running on Linux. Hopefully we’ll see this in containers soon.

Hmm, could try to build a custom image with the Agent…

Have a good week!

Friday Reading 2017-07-21

Fun week! I moderated a couple of great sessions for 24 Hours of PASS: Summit Preview. As someone getting into presenting, watching the Pros do it is invaluable.

Here’s the sessions that I moderated: –

PowerShell for DBAs, What’s in it For Me?
Ben Miller gave a great overview of the powershell for DBAs out there just getting into it

Becoming Proficient with Columnstore Indexes
Niko Neugebauer with an introduction to Columnstore Indexes – really handy if you haven’t used them before

On Transactions and Atomic Operations
Gail Shaw with a cool back to basics sessions on how transactions within SQL Server work

Recordings should be up in a week.

I’m also speaking for the PASS Virtualisation chapter next month, at 17:00 (UTC) on the 9th of August. Details are here, hope you can join in!

Have a good weekend!