© The Author(s), under exclusive license to APress Media, LLC, part of Springer Nature 2022
B. WardSQL Server 2022 Revealedhttps://doi.org/10.1007/978-1-4842-8894-8_2

2. Install and Upgrade

Bob Ward1  
(1)
North Richland Hills, TX, USA
 

One of the first things you will want to do is to install SQL Server 2022 so you can explore all the goodness it has to offer. The great news for anyone familiar with SQL Server is that the installation experience for SQL Server 2022 is fairly identical to previous releases with a few minor changes.

If you are an experienced SQL Server user, in this chapter you can review the highlights of what is different for SQL Server 2022. If you are someone new to SQL Server, don’t worry. First, the installation process is amazingly simple, and our user experiences walk you through all of it. Second, if you need a “step-by-step” process, go straight to our documentation at https://aka.ms/deploysqlserver2022.

How to Install SQL Server 2022

You may be used to getting started with SQL Server by installing the Developer or Evaluation free edition of SQL Server and evaluating the product. SQL Server 2022 supports both of these editions, so if you just want to jump in, go to https://aka.ms/getsqlserver2022 and start testing!

I know that some people want to know more about the installation of SQL Server before they go “straight for the bits.” In this section of the chapter, I’ll review the prerequisites to install SQL Server and discuss the differences from previous versions and deployment options.

This section of the chapter focuses on installation of SQL Server on Windows. The section titled “Deploying on Other Platforms” later in this chapter discusses installation on Linux, containers, Kubernetes, and Azure. The details for deploying on these platforms can be found in Chapters 9 and 10 of the book.

Prerequisites

The prerequisites, including resources required, to install SQL Server 2022 on Windows have not changed from previous major versions of SQL Server, except the specific Windows operating system versions or Linux distributions we support. As in the past, we will support versions of Windows Server and Windows (client) that are “officially” supported, including any specific updates of Windows required to be supported. Consult the SQL Server 2022 release notes for any possible changes to prerequisites for SQL Server 2022 at https://docs.microsoft.com/sql/sql-server/sql-server-2022-release-notes.

One difference for prerequisites from previous versions of SQL Server is the requirement to be connected to Azure to support some of the new cloud-connected scenarios. The most important requirement is that if you choose to set up Azure-connected scenarios during installation, you will need an Azure subscription and a service principal.

Note

Some cloud-connected scenarios like Managed Instance and Synapse Link do not require any special steps during setup. New capabilities like Azure Active Directory (AAD) and Microsoft Purview integration do require this configuration.

I’ll describe the exact steps for this requirement later in this chapter in the section titled “Setting Up the Azure Extension for SQL Server.” I’ll also go more into the specifics of how SQL Server is connected to Azure in Chapter 3 of the book.

To find all the exact resource requirements you need to install SQL Server 2022 on Windows, review the documentation at https://aka.ms/deploysqlserver2022.

What Is Different for SQL Server 2022?

Installing SQL Server 2022 on Windows using the “wizard” is remarkably similar to installing SQL Server from previous releases. Therefore, I won’t show you a “screen-by-screen” experience. See the complete set of steps at https://aka.ms/deploysqlserver2022.

Note

I will make the boastful claim that I have probably installed and uninstalled SQL Server 2022 more than anyone in the world. I honestly lost count from November 2021 to November 2022 how many times I’ve installed and uninstalled SQL Server 2022. Maybe only beat by our automation tests at Microsoft!

Rather, I’ll discuss differences from previous releases. Let’s look at each of these differences from a perspective of running a SQL Server setup.

Azure Extension for SQL Server

The first option you will be presented with before choosing features is the Azure extension for SQL Server. The Azure extension for SQL Server feature represents software running on the computer or VM where SQL Server is installed to connect it to Azure. The capability for this extension is not new as it is found through Azure Arc–enabled SQL Server (you can read more at https://docs.microsoft.com/sql/sql-server/azure-arc/overview). You can still use the method in the documentation to connect SQL Server 2022 to Azure. We are just providing a method to do this as an integrated part of SQL Server setup.

This is a big topic to cover, so to learn more about the prerequisites and how to fill out the information for this feature, see the section later in this chapter titled “Setting Up the Azure Extension for SQL Server.”

Feature Differences

There are several differences when choosing features during installation, mostly around features that are removed. You can see these differences by looking at the SQL Server 2019 setup feature selection in Figure 2-1 and the features I’ve highlighted that are now removed.

A screenshot of the S Q L server 2019. The instance features of python, java connector, machine learning server, and distributed replay client are highlighted.

Figure 2-1

SQL Server 2019 setup features with features removed highlighted

Figure 2-2 shows a shorter list of features now available during setup.

A screenshot of the S Q L server 2022. Under the feature selection file is a list of instance features selected for S Q L server 2022.

Figure 2-2

The SQL Server 2022 feature selection

Let’s look further at the features removed from SQL Server 2022.

Removal of R, Python, and Java

In SQL Server 2016, 2017, and 2019, we included options to install open source runtime packages for R, Python, and Java as part of machine learning services and the language extension feature. While this was convenient for many, we found a lot of our customers using this feature wanted to use their own runtime package. We also had to figure out how to update the open source packages we installed. Because of this, we felt it didn’t make sense to continue to install these packages as part of setup. In SQL Server 2022, we no longer offer these packages as an option during setup. If you want to use machine learning services or language extensions, you still must choose this feature during setup.

Instead you can install your own packages. See the documentation at https://docs.microsoft.com/sql/machine-learning/install/sql-machine-learning-services-windows-install to get started for R and Python. For the Java language extension, you can start at https://docs.microsoft.com/sql/language-extensions/install/windows-java.

Removal of Polybase Hadoop Connectivity with Java

In SQL Server 2016, we introduced the concept of Polybase, the ability to query data in different formats and storage “where they live” using T-SQL. The original design translated T-SQL statements into Java code to query files in Hadoop systems. It was revolutionary, but the specific connection to Hadoop systems never really took off as a popular feature among a lot of our customers.

In SQL Server 2022, we have discontinued providing this feature along with Polybase scale-out groups. You can read more about the retirement of Polybase to Hadoop with Java, scale-out groups, and Big Data Clusters at https://cloudblogs.microsoft.com/sqlserver/2022/02/25/the-path-forward-for-sql-server-analytics/. However, the concept of Polybase is still alive and well. You will see in this book in Chapter 7 a new implementation of Polybase using REST APIs.

Important

In order to use Polybase REST APIs, you need to select the Polybase Query Service for External Data feature. This will install the Polybase services. The Polybase REST APIs do not use these services but are baked directly into the engine. However, for now you must select this feature to enable configuration options to support Polybase REST APIs. Polybase services for ODBC drivers also require you to select this feature and do use Polybase services.

Removal of Machine Learning Server

In the summer of 2022, we announced the retirement of Machine Learning Server and stated it would no longer be a feature in the next version of SQL Server. Therefore, it is not a feature option in SQL Server 2022 setup. You can read more about this retirement statement at https://docs.microsoft.com/lifecycle/announcements/microsoft-machine-learning-server-retiring.

Removal of Distributed Replay

Distributed replay is a tool to replay SQL Profiler traces and has been in the product for many years. We have decided to unbundle this feature from SQL Server installation and will make it available in a separable download package. I will be transparent with the readers of this book that we have not enhanced this capability for quite some time.

Memory Recommendations

In the past we introduced in setup the ability to configure “max server memory” for the instance of SQL Server, which includes recommended values. The recommend value for “max server memory” comes from our documentation at https://docs.microsoft.com/sql/database-engine/configure-windows/server-memory-server-configuration-options.

We have determined that we didn’t quite calculate this correctly, and we’ve updated the method in SQL Server 2022 setup. Be aware that this recommendation is very conservative in my opinion, so I would be careful about using it. The calculation for “max server memory” is ~75% of available free memory at the time setup is run. We built this to apply it across many different workloads and configurations. It is also important to note that this recommendation doesn’t consider other SQL instances, so if you run multiple SQL instances on the same server, you need to carefully consider the value for “max server memory” for each instance.

Other Installation Methods

SQL Server setup for Windows still supports options without a user interface through the command line. You can find examples of how to do this and see all the options at https://docs.microsoft.com/sql/database-engine/install-windows/install-sql-server-from-the-command-prompt. The only differences for SQL Server 2022 are the removal of options for discontinued features as described earlier in this chapter and the addition of new parameters to support the Azure extension for SQL Server.

If you are new to setting up SQL Server, you should know that the SQL Server Evaluation and Developer Editions come with an “easy setup” mode with an installer that installs just the defaults without going through any screens. If you choose this method, the Azure extension for SQL Server feature is not selected. If you want the full setup experience with the Evaluation or Developer Edition, choose the Custom option from the initial setup screen.

Setting Up the Azure Extension for SQL Server

In 2020, we announced a new hybrid capability for SQL Server called Azure Arc–enabled SQL Server. The concept is to take an existing installation of SQL Server and connect to Azure to provide new capabilities such as viewing instance details in the Azure portal, Microsoft Defender, and best practices assessments. The process of setting up SQL Server with Azure Arc is done from the Azure portal or through scripts. SQL Server 2022 provides an integrated method to install this in the SQL Server setup process, through a setup feature called the Azure extension for SQL Server.

The Azure extension for SQL Server provides the following capabilities for SQL Server 2022:
  • Microsoft Defender for SQL

  • SQL Assessment (which you can read more about at https://docs.microsoft.com/sql/sql-server/azure-arc/assess)

  • View of a connected SQL Server in the Azure portal along with other Azure SQL resources

  • Azure Active Directory (AAD) authentication

  • Access policies in Microsoft Purview (Purview integration requires AAD, which also requires the Azure extension for SQL Server)

You will learn more about these features in Chapter 3 of the book. I will describe more about the role of Azure Arc–enabled SQL Server in Chapter 11 of the book. Just connecting SQL Server to Azure does not cost you anything. It is only when you select certain services such as Microsoft Defender or Purview that you incur subscription costs.

Note

The Azure extension for SQL Server is not supported when running SQL Server on an Azure Virtual Machine. SQL Server uses the Infrastructure-as-a-Service (IaaS) Agent Extension to provide capabilities like Defender, assessments, and AAD authentication. You can read more about the IaaS Agent Extension at https://docs.microsoft.com/azure/azure-sql/virtual-machines/windows/sql-server-iaas-agent-extension-automate-management.

Figure 2-3 shows the information needed to set up the Azure extension for SQL Server.

A screenshot of the S Q L server 2022. It has options for azure service and subscription I D, resource group, region, tenant I D, and server U R L for azure extension.

Figure 2-3

Setting up the Azure extension for SQL Server

I’ll describe how to fill out these fields with information for Azure. I have some example files that can help you in this chapter in the ch2_install folder for the samples that come with the book.

What You Should Know First

Let me stop here before you read on to give you some guidance on Azure topics that I will discuss as part of filling out these fields:
Note

For my tenant at Microsoft, I didn’t have permission to create a custom role in the Azure portal. However, I was able to create one using the az CLI as documented at https://docs.microsoft.com/azure/role-based-access-control/custom-roles-cli. You can see my example JSON file from the samples for this chapter called sqlazureext.json. The script to create the role using this JSON file is in the sample file createcustomrole.ps1.

You will assign the service principal to the custom role and resource group you created. You can see an example of how to do this with the script sqlazureextsp.ps1.

When you create a service principal with the CLI, you will get a JSON result that will contain values for fields you will need for this screen. Be sure to save this result, especially the password. I’ll show you how each field from the output lines up with the fields on the feature screen for SQL Server setup.

The resulting JSON should look like this:
{
  "appId": "<appid GUID>",
  "displayName": "<service principal name>",
  "password": "<password>",
  "tenant": "<tenantID GUID>"
}
Note

Don’t include the quotation marks when using these values on the feature setup screen.

Service principals are highly privileged accounts in Azure. I created my service principal at the resource group scope, but the permissions assigned with the custom role are highly privileged. If you decide to disconnect and remove your SQL Server from Azure, make sure to remove the service principal.

Providing Values for the Feature Setup

With these resources created, you can fill out the fields from Figure 2-3 (all of these fields except Proxy Server URL are required).

Checking the Azure Extension for SQL Server

If you don’t want to install the Azure extension for SQL Server, you can uncheck this box. Leave it checked to install the extension. Remember that you don’t incur any costs just to set up the extension.

Login or Service Principal

You have a choice to use an Azure login from your subscription or a service principal. If you select Use Azure Login, you will be presented with a screen to log in with your credentials per your company requirements (Microsoft requires MFA). Once you sign in, we validate your account has the right permissions to set up the extension. Then we will auto-populate the following fields:
  • Azure Tenant ID

  • This is an ID for your Azure Active Directory associated with your account.

  • Azure Subscription ID

  • This is the default subscription ID for your Azure account. We will register your SQL Server under this subscription. You can choose a different subscription from a drop-down list.

  • Azure Resource Group

  • We will choose a resource group under your subscription, which we will use to register your SQL Server. You can choose from a drop-down list a different resource group.

  • Azure Region

  • We will choose the Azure region from the resource group, but you can choose a different region from a drop-down list.

  • Proxy Server URL

  • You can optionally put in a proxy URL if your SQL Server cannot directly connect to the Internet. By default, the agents installed with the extension on the server will use outbound TCP port 443 to connect to Azure services over the Internet. You can set up a proxy server. If you use a proxy server, put in the URL of the proxy in this field. You can read more about this at https://docs.microsoft.com/azure/azure-arc/servers/manage-agent#update-or-remove-proxy-settings. Leave this field blank if you are not using a proxy.

If you decide to use a service principal, you will need to fill in information that you collected when you created the service principal using a custom role:
  • Azure Service Principal ID

  • This is the value of appId from the JSON result of creating the service principal.

  • Azure Service Principal Secret

  • This is the value of password from the JSON result.

  • Azure Subscription ID

  • This is the subscription ID value you used as part of the –scopes parameter when you created the service principal.

  • Azure Resource Group

  • This is the name of the resource group you created as a prerequisite and used in the –scopes parameter to create the service principal.

  • Azure Region

  • The name of the Azure region where you created the resource group. The name of the region here should not contain spaces and should be lowercase. My region was East US, so the value should be eastus.

  • Azure Tenant ID

  • This is the value of the tenant from the JSON result when you created the service principal.

Proxy Server URL can also be used in this scenario.

What happens now?

When you hit the Next button, there will be a delay of several minutes before you can proceed. This is to do some validation to connect to Azure. During the installation, the Azure Arc Agent and the Azure extension for SQL Server will be installed to connect and register with Azure. You can see these agents by looking at installed programs after setup has successfully completed as seen in Figure 2-4.

A screenshot. 2 files titled azure connected machine agent and Microsoft S Q L server extension are highlighted with their publisher, size and version.

Figure 2-4

Azure Arc Agent and Azure extension for SQL Server

In addition, the Azure Connected SQL Server Onboarding role will be assigned automatically to the service principal. This role is required to connect SQL Server to Azure.

The setup logs show the details of what happens with a PowerShell script that setup executes (this is in the details.txt file from the SQL Server setup logs):
SQLArcOnboard: --SqlArcOnboardPrivate: ----------------------------------------
SQLArcOnboard: Getting setting AZURESERVICEPRINCIPAL: source = UI, type = Microsoft.SqlServer.Configuration.ArcOnboard.SqlArcServicePrincipal.
SQLArcOnboard: Getting setting AZURESERVICEPRINCIPALSECRET: source = UI, type = Microsoft.SqlServer.Configuration.ArcOnboard.SqlArcServicePrincipalSecret.
SQLArcOnboard: Getting setting AZURESUBSCRIPTIONID: source = UI, type = Microsoft.SqlServer.Configuration.ArcOnboard.SqlArcSubscriptionId.
SQLArcOnboard: Getting setting AZURETENANTID: source = UI, type = Microsoft.SqlServer.Configuration.ArcOnboard.SqlArcTenantId.
SQLArcOnboard: Getting setting AZUREREGION: source = UI, type = Microsoft.SqlServer.Configuration.ArcOnboard.SqlArcRegion.
SQLArcOnboard: Getting setting AZURERESOURCEGROUP: source = UI, type = Microsoft.SqlServer.Configuration.ArcOnboard.SqlArcResourceGroupName.
SQLArcOnboard: Getting setting AZUREARCPROXYSERVER: source = UI, type = Microsoft.SqlServer.Configuration.ArcOnboard.SqlArcProxy.
SQLArcOnboard: Powershell results Installed Powershell version 5.1.20348.643
SQLArcOnboard: Powershell results Az already installed. Skipping installation.
SQLArcOnboard: Powershell results Az.ConnectedMachine already installed. Skipping installation.
SQLArcOnboard: Powershell results Az.Resources already installed. Skipping installation.
SQLArcOnboard: Powershell results Arc for Servers resource not found. Registering the current machine now.
SQLArcOnboard: Powershell results Microsoft.Azure.PowerShell.Cmdlets.ConnectedMachine.Models.Api20210520.Machine
SQLArcOnboard: Powershell results Getting managed Identity ID of BW-SQL2022.
SQLArcOnboard: Powershell results Arc machine managed Identity does not have Azure Connected SQL Server Onboarding role. Assigning it now.
SQLArcOnboard: Powershell results Installing SQL Server - Azure Arc extension in the background.
SQLArcOnboard: Powershell results Microsoft.Azure.PowerShell.Cmdlets.ConnectedMachine.Runtime.PowerShell.AsyncOperationResponse
SQLArcOnboard: Powershell results Completed Onboarding process.
Within the Azure portal (portal.azure.com), you can search for the resource group you created and will see two resources as seen in Figure 2-5.

A screenshot of the azure portal. It has 2 files with their type and location for the resource group.

Figure 2-5

Azure Arc–enabled SQL Server in the portal

If you select SQL Server – Azure Arc, you will see interesting information on the main portal page as seen in Figure 2-6.

A screenshot of the main page of the azure portal. It has a list of essentials at the top and capabilities at the bottom.

Figure 2-6

Azure Arc–enabled SQL Server main portal page

Connect to Azure After Setup

If you decide not to select the Azure extension for SQL Server feature during SQL Server 2022 setup, you can connect your SQL Server 2022 instance with Azure at a later time following the steps at https://docs.microsoft.com/sql/sql-server/azure-arc/connect. Or you can go back and “add a feature” to the existing SQL Server 2022 instance, which provides you with the same screens as with the original setup. You can also connect many SQL instances at scale using steps found at https://docs.microsoft.com/sql/sql-server/azure-arc/connect-at-scale.

Removing the Azure Extension for SQL Server

You can disconnect your SQL Server 2022 instance at any time from Azure using the steps documented at https://learn.microsoft.com/en-us/sql/sql-server/azure-arc/connect#delete-your-arc-enabled-sql-server-resource. If you decide to completely remove the connection to Azure, I recommend you also remove the Azure extension for SQL Server using SQL Server setup.

Deploying on Other Platforms

This chapter has focused more on the experience of installing SQL Server on Windows. SQL Server is supported on other platforms including Linux, containers, and Kubernetes. Chapter 9 of this book will cover those experiences, but if you want to jump right in, you can use these resources:

SQL Server on Linuxhttps://aka.ms/sqllinux

SQL Server on containershttps://aka.ms/sqlcontainers

SQL Server on Kuberneteshttps://aka.ms/sqlk8s

Note

This page contains instructions on deploying a SQL container on Azure Kubernetes Service (AKS). Consult your Kubernetes platform documentation on the proper method to deploy pods and containers.

Be sure to consult the latest release notes for SQL Server 2022 on Linux and containers at https://docs.microsoft.com/sql/linux/sql-server-linux-release-notes-2022.

In addition, SQL Server 2022 can be deployed on Azure Virtual Machines. Chapter 10 of this book will go through more details on this experience. To get more information on SQL Server on Azure Virtual Machines, consult our documentation at https://aka.ms/sqlazurevm.

Side-by-Side and Multi-instance Installations

Like previous releases of SQL Server, SQL Server 2022 supports side-by-side installations on the same computer with different versions (supported versions) and multiple instances (aka named instances). There are no differences in support for both side-by-side and multi-instance installations from previous SQL Server releases. For more information, consult our documentation at https://docs.microsoft.com/sql/sql-server/install/work-with-multiple-versions-and-instances-of-sql-server. SQL Server on Linux supports multiple instances by using containers.

How to Upgrade to SQL Server 2022

SQL Server 2022 supports upgrades from previous releases of SQL Server with the same methods as in previous versions. You can read more at https://docs.microsoft.com/sql/database-engine/install-windows/upgrade-sql-server for all the details.

At the time of the writing of this book, the plan was to support an “in-place” upgrade from SQL Server 2012 Service Pack 4 or any higher version and database restore upgrades from SQL Server 2008/2008R2 and higher.

The Importance of dbcompat

Over my career at Microsoft, it has become apparent that one of the reasons customers do not upgrade to a new major version of SQL Server is because the latest version is not compatible with their application.

For the past several SQL Server versions, we have been trying to convince customers and developers to test for compatibility with the database compatibility level (dbcompat) of user databases. If you upgrade a SQL Server database to a new version, we maintain the previous dbcompat. You can read more on why this could be a new strategy for compatibility for you at https://aka.ms/dbcompat. Note that using an older dbcompat gives you more time to explore and test the latest dbcompat levels, which enable new capabilities like Intelligent Query Processing (IQP), which is discussed more in Chapters 4 and 5 of this book.

Configuration

Although this chapter is specifically designed to give you guidance on installation and upgrades, the configuration of SQL Server post installation is also an important topic. However, there are very few changes to SQL Server instance configuration in SQL Server 2022:
  • There are a few new server-level sp_configure options. They will be discussed throughout this book as they relate to new features for SQL Server 2022.

  • The SQL Server Configuration Manager has been enhanced to allow you to control the services (start and stop) for the Azure extension for SQL Server feature.

Other than that, there are no new instance-level configuration changes.

You will learn about new database-level configuration options as you explore new features throughout the book.

Easy to Install and Upgrade

SQL Server has been known for some time as a simple install-and-upgrade experience, and none of that changes in SQL Server 2022. As part of that experience, we have provided an integrated setup to get connected to Azure if that is part of your hybrid strategy.

If you read over all the details of this chapter, you are pretty much ready to dive in and learn about features. So let’s roll! The next chapter is about connecting SQL Server to the cloud in ways never before seen in the industry, which brings together SQL Server and Azure to provide disaster recovery, analytics, and security.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.219.95.244