Profiler and Trace vs. Extended Events

SQL Server
It's a running joke among the more experienced (read, older) Microsoft Data Platform specialists as to whether you're #teamprofiler or #teamexevents. I'm very much #teamexevents, but I really don't care that you're #teamprofiler. If you want to use the old way of doing things, that's fine. However, I do have a bone to pick. Why on earth would you recommend to new data professionals working on modern systems, let's say at least 2016 or better, who are just getting going on this journey, that they should be using Trace? What are you smoking? Trace vs. Extended Events We're not just talking about where you are comfortable. I get it. You've used Trace/Profiler for 20+ years. Getting it going is all muscle memory. That's fine. As the kids say, you do…
Read More

Running Containers In a Virtual Machine

Containers
The more you work with containers, the more you just want to work with containers. However, there are still reasons to have a virtual machine for some types of workloads. So, what if you want to work with containers inside a virtual machine. Is that possible? Yes, and shockingly easily. Enable Virtualization In Virtualization I knew from conversations I've had previously that running Docker inside a virtual machine was possible. I just didn't know the details. So, with a complete lack of knowledge, I did the most expedient thing possible: I installed Docker in a VM and started it up. Now, let's talk about my setup for a moment. My laptop is running HyperV as my hypervisor. You have to have some type of hypervisor for Docker to work. I'm…
Read More

Sample Azure DevOps Pipelines

DevOps
I've said it before and I will repeat myself on this because it's an important concept: DevOps is about culture and communication, not tools Now, that said, to implement the automation required in DevOps, you're going to have to get into some degree of tooling. There are a whole slew of possible tools to support you: Jenkins, Team City, Octopus and more. All these tools offer excellent solutions with variations on limits, methodologies, etc. You'll need to explore them to understand which ones are best for you and your processes. I've been doing a lot of work lately in another tool, Azure DevOps. Let me show you a little of what I've done. Azure DevOps Pipelines I don't mean for this to be a complete tutorial on setting up Azure…
Read More

The Constant and Constantly Changing Role of the DBA

DevOps, Redgate Software, SQL Server
I've been working in and around data for over 30 years now. My title has changed a number of times and is poised to change again. My responsibilities have also shifted fairly continuously over that time. Even though it has been more than 20 years since I first took on the title of DBA, some aspects of the job are the same. However, over that 20 years, a stack of new technologies and processes have fundamentally changed a whole swath of what I do. The DBA Song Remains the Same Are your servers online? Are all databases available? Did the data load process run successfully last night? When was the last time a backup was run on this database? I honestly don't care if you're in the cloud, on-premises, or…
Read More

Which Query Used the Most CPU? Implementing Extended Events

SQL Server, T-SQL, Tools
A question that comes up on the forums all the time: Which query used the most CPU. You may see variations on, memory, I/O, or just resources in general. However, people want to know this information, and it's not readily apparent how to get it. While you can look at what's in cache through the DMVs to see the queries there, you don't get any real history and you don't get any detail of when the executions occurred. You can certainly take advantage of the Query Store for this kind of information. However, even that data is aggregated by hour. If you really want a detailed analysis of which query used the most CPU, you need to first set up an Extended Events session and then consume that data. A…
Read More

Containers: More on Volumes

Containers
In my last post I showed how you can create a volume with your container. I then showed a few things you can with a container using a volume. I want to explore volumes just a little bit more. Locate Your Volume To have a little more fun with volumes, first, let's share a drive. You do this in the Settings in Docker Desktop (assuming that's what you're using): While this should just work, it didn't for me until I restarted Docker. So you may need to do that. Go to the drive and create a directory. I'm putting one in at C:\Docker\SQL. Once I've done that, let's create a new container: docker run ` --name SQL19 ` -p 1433:1433 ` -e "ACCEPT_EULA=Y" ` -e 'SA_PASSWORD=$cthulhu1988' ` -v C:\Docker\SQL:/sql `…
Read More

Containers: Create a Custom Container

Containers
Creating a custom container is where things get truly exciting. There's actually a ton of work and knowledge around this. To start with, I'm going to keep it simple. I'm going to create a container with a database & some data and a couple of general customizations. From that, we'll create our own container. To understand why I've got a series on containers, read here. Setting Up a Custom Container To start with, I'm going to spin up a container with nothing fancy: docker run -e 'ACCEPT_EULA=Y' ` -e 'SA_PASSWORD=$cthulhu1988' ` -p 1433:1433 ` --name DockerDemoTemplate ` -d mcr.microsoft.com/mssql/server:2019-CTP2.5-ubuntu With this running, let's connect up and make some changes: USE master; GO CREATE DATABASE CustomContainer; GO USE CustomContainer GO CREATE TABLE dbo.CustomTable (ID INT IDENTITY (1,1) NOT NULL PRIMARY KEY,…
Read More

Containers: Working With Volumes

Containers
In the previous two posts on containers I showed how use Docker commands to get an image and create a container. This time, we're going to create a container again, but, we're also going to create a volume so we can do some fun stuff. For an understanding of why I'm doing a series of blog posts on containers, read here. Docker Volumes You can create a container with a volume, or local, persistent storage. The usage is really simple: docker run -e 'ACCEPT_EULA=Y' ` -e 'SA_PASSWORD=$cthulhu1988' ` -p 1450:1433 ` --name DockerDemo17vol ` -v sqlvol:/var/opt/mssql ` -d mcr.microsoft.com/mssql/server:2017-latest This will create and kick off a new container based on SQL Server 2017. Nothing to it really. If you get the IP address for the machine, you can connect to…
Read More

Containers: Creating a Container

Containers
In yesterday's blog post we pulled SQL Server images in preparation for today's blog post where we create containers from those images. If you haven't already, get Docker installed and follow the instructions here to get at least one image on your machine. If you're interested in why I'm talking about containers all week, read this. I'm using all PowerShell commands to control Docker. Docker Run You can use 'docker create' to create an image and then start it up. However, we can just get started running a container from one of the images we downloaded yesterday. We can just simultaneously create and start the container using 'docker run': docker run -e 'ACCEPT_EULA=Y' ` -e 'SA_PASSWORD=$cthulhu1988' ` -p 1433:1433 ` --name dockerdemo ` -d mcr.microsoft.com/mssql/server:2017-latest Let's break this down a…
Read More

Containers: Getting an Image

Containers
I'm working with Docker running on Windows or Linux. There are other ways to do this, but Docker seems to be a pretty strong standard. I'll leave it to you to get Docker installed on your system. Go here to get the appropriate installation. I explain why I'm learning Docker and containers here if you're interested. Docker Pull The first command you have to learn is 'docker pull'. You then have to supply something for it to pull, an image that will be used to create your containers. I'm using Powershell for the commands I'm posting this week. Here's how you get an image with SQL Server 2017: docker pull mcr.microsoft.com/mssql/server:2017-latest Assuming you have Docker installed and running, you should get an image downloaded. Depending on your network bandwidth, this…
Read More