Learning PostgreSQL: The Tools

AWS, PostgreSQL, RDS
In case you don't know, I've been writing a series of articles over on Simple-Talk as I learn PostgreSQL. It's all from the point of view of a SQL Server person, expanding into a new technology. In other words, a true story. I thought I'd take a moment here on my own blog to talk about the tools I'm using and why I chose those. AWS RDS Let's establish up front, I'm lazy. Very lazy. So yeah, I'm trying to learn this new technology, but I'm going to find as many ways to use the knowledge, skills & tools I already have as I can. Now, I first started learning PostgreSQL because I wanted to learn more about how Flyway works. Further, as I also needed to learn how to…
Read More

Containers: Upgrading SQL Server from 2017 to 2019 RTM

Containers
Throughout the pre-release of SQL Server 2019, I was demoing an effectively instant, and magical, container upgrade from 2017 to 2019. However, when I finally downloaded the release bits in a new image, the magic went away. In fact, I got errors, so what happened? Non-root User In SQL Server 2017, the containers were running as root. The thing is, you're basically setting up your instance to run as administrator of the system. We all know that's a no-no. So, in SQL Server 2019, Microsoft fixed this and now the SQL Server instance within the Linux container runs as mssql, much better. However, this immediately causes issues when we're doing an in-place upgrade using a volume on a 2017 container to move to 2019. We're not root any more. Let's…
Read More

Docker, Git and DBATools

DevOps, Professional Development
For those who don't know, last week was the PASS Summit. It's an amazing event every year, but this last week, I saw a ton of indications that our peers are spotting the changing technology landscape largely defined by three tools, Docker, Git and DBATools. None of those indications resonated quite as much as this tweet from Kevin Hill: 3 things I can no longer justify ignoring: #dbatools Git and #Docker for my dev SQL work@cl @sqldbawithbeard @Kendra_Little and @unclebiguns @GFritchey, I blame you 🤪😂There’s more but those are top 3— SQL Cyclist (@Kevin3NF) November 9, 2019 There are a million things to learn about in our rapidly shifting technological landscape, but I think this assessment, especially the way it was put, "no longer justify ignoring" really nails some of…
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

SQL Server Containers Are Boring

Containers
Not really, but sort of. The beauty of containers, at least in a dev/test environment, is the ability to spin them up while you need them and then throw them away when you're done. Containers give you a bunch of functionality not otherwise available through a VM. However, once you've spun up a container, they're so dull. Why Are Containers Boring Grant? I'm so glad you asked. Last week I was presenting at SQLIntersection (great show, you should consider attending). I was talking about Query Store in SQL Server 2019. One person in the audience asked, "Can Query Store run inside a container?" I responded, "Great question, let's check." I then switched over to VS code to show this: docker run ` --name DemoSharedVol ` -p 1460:1433 ` -e "ACCEPT_EULA=Y"…
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