Benjamin Nevarez Rotating Header Image

Linux

SQL Server on Linux Foreword by Kalen Delaney

I started working with SQL Server more than 30 years ago, when it was a Sybase product that ran on Unix (as well as on more than half a dozen other operating systems), and we did all our work on Unix machines. SQL Server didn’t run on Windows at that time, because there was no Windows operating system. But several years later, when Sybase partnered with Microsoft to port its database product onto PC-based operating systems, few people could foresee just how powerful and ubiquitous these PCs would become. PC is hardly about only personal computers these days.

I’ve seen a lot of changes with SQL Server over these three decades, and some of the most interesting ones for me are when the product seems to circle back and add features or internal behaviors that were originally part of the product but had once been discarded. Some of the original ideas were not that far off base after all. Having SQL Server return to its roots and become available on Linux (a Unix-based OS) in SQL Server 2017 almost seems like coming home.

Benjamin Nevarez has been working with Unix-based operating systems almost as long as I’ve been working with SQL Server. He was also excited to see SQL Server make an appearance on Linux. It didn’t take him long to decide to get his hands dirty and figure out how SQL Server professionals could get the maximum value out of the new OS. He wrote this book to make available to others all that he had learned.

I have known Ben for more than a dozen years, since he first started finding typos and other errors in my SQL Server 2005 books. We started a dialog, and I then asked him if he was interested in being a technical editor for some of my work. Through this technical collaboration, I have learned that when Ben sets out to learn something, he does it thoroughly. His attention to detail and passion for complete answers never cease to amaze me.

In this book, Ben tells you how to get started using SQL Server on Linux and how the database system actually works on the new platform. Chapters 1, 2, and 3 are particularly useful if you’re new to Linux but experienced with SQL Server. Although most SQL Server books wouldn’t go into operating system administration details, Chapter 3 does just that, to make the transition easier for people who have many years, if not decades, of experience with Windows. Of course, if you’re already proficient with Linux, but new to SQL Server, you can focus on the following chapters when Ben’s expertise with SQL Server shines through.

In Chapter 4, he tells you how SQL Server can be configured and blends SQL Server details with the Linux tools you need to access and control your SQL Server. Chapters 5 and 6 are very SQL Server focused. Chapter 5 provides some very detailed information about working with SQL Server queries, including how queries are optimized and processed, and how you can tune slow-running queries. Chapter 6 tells you all about some of the latest and greatest in SQL Server’s optimization techniques in the most recent versions of SQL Server. Finally, in Chapters 7 and 8, he provides coverage of two critical focus areas for a database administrator: managing availability and recoverability, and setting up security. These are critical topics for any DBA, and because they involve the relationship between the database engine and the operating system, it’s best to learn about them from someone who is an expert in both areas.

Although both Linux and SQL Server are huge topics and there is no way one book can provide everything you need to know about both technologies, Ben has done an awesome job of giving you exactly what you need to know, not only to get SQL Server running on the Linux operating system, but to have it performing well, while keeping your data safe and secure.

—Kalen Delaney

www.SQLServerInternals.com

Poulsbo, Washington, March 2018

Why I decided to write a book about SQL Server on Linux

I started my IT career working with Unix applications and databases back in the early ’90s, and my first job ever was as a data processing manager for a small IT shop. Back then, I was running Unix System V Release 4 on an NCR system. With such big and expensive minicomputer systems, I was always wondering if I could have a Unix system on less expensive hardware, such as a PC, to learn and test without disrupting our shared test systems.

Then I read an article in a personal computing magazine about something called Linux. Nobody knew what Linux was back in those days. Very few people—mostly at universities—had even access to the Internet back then. So I downloaded Linux on four or five floppy disks, installed it on a PC, and started playing with it. It was a distribution called Slackware. It was amazing that I could finally experiment and test everything I wanted on my own personal Unix system.

I continued to work with Linux and all the popular Unix commercial implementations, including IBM AIX, HP-UX, Sun Solaris, and others, throughout the ’90s. For several years, people still didn’t know what Linux was. It was not an immediate success. But by the end of the ’90s I decided to specialize in SQL Server, and by doing that I left the Unix world behind.

So it looked like I was not going to touch a Unix system ever again. But one day in March 2016, Microsoft surprised the technology community by announcing that SQL Server would be available on Linux. When I first heard the news, I thought it would be cool to write a book about it. Because I was just finishing a book about SQL Server 2016, I decided to wait to see how the technology evolved and to take a break from writing. One day, as I was running while training for a marathon, I started thinking about the project again and decided it could be a great idea to write a book about SQL Server on Linux. Just after finishing my run, I went to my laptop and sent an e-mail to my contact at McGraw-Hill Education, who eventually connected me with Lisa McClain. Within a few days, I was now working on this new book project.

Let me tell you how I structured this book.

Chapter 1 shows you how to get SQL Server running on Linux as quickly as possible, so you can start using the technology, even though I haven’t covered all the details yet. The chapter covers how to install SQL Server on Red Hat Enterprise Linux, SUSE Linux Enterprise Server, and Ubuntu and how to configure an image of SQL Server on a Docker container. More details of the setup and configuration are included in Chapter 4.

Chapter 2 covers some SQL Server history with different operating systems and explains some of the details about how SQL Server on Linux works. This includes describing the interaction between SQL Server and the operating system, decisions regarding its architecture, and information about its software implementation, among other related topics. It also covers details about the SQL Operating System (SQLOS), the Drawbridge technology, and the SQL Platform Abstraction Layer (SQLPAL).

I include an entire chapter dedicated to Linux for the SQL Server professional. Chapter 3 covers all the basic Linux commands you need to get started, including managing files and directories and their permissions, along with a few more advanced topics, including system monitoring.

Chapter 4 covers SQL Server setup and configuration in a Linux environment, and it is divided into three main topics: using the mssql-conf utility to configure SQL Server, which is required in Linux environments; using Linux-specific kernel settings and operating system configurations; and using some traditional SQL Server configurations for both Windows and Linux installations.

After spending time learning how to set up and configure SQL Server, you’ll move to Chapter 5, which discusses how to use SQL Server to perform database operations. This chapter, in particular, covers query tuning and optimization topics, which are applicable both to Windows and Linux installations—and, in fact, to all the currently supported versions of the product.

Chapter 6 continues with query processing and covers the new features available in SQL Server 2017, such as adaptive query processing and automatic tuning.

Chapter 7 is about high-availability and disaster-recovery solutions for SQL Server on Linux and focuses on Always On availability groups. Availability groups on both Windows and Linux can be used in high-availability and disaster-recovery configurations and for migrations and upgrades, or even to scale out readable copies of one or more databases. The chapter also covers Pacemaker, a clustering solution available on Linux distributions.

Finally, I close the book with Chapter 8, which is about security. This chapter reviews security from a general point of view and includes details about some of the new security features in SQL Server, including Transparent Data Encryption, Always Encrypted, Row-Level Security, and Dynamic Data Masking.