Upgrading SQL Server running on Ubuntu to latest update
By: Manvendra Singh | Updated: 2017-04-19 | Comments (1) | Related: More > SQL Server on Linux
In a previous tip we described the installation steps to install SQL Server vNext CTP 1 on Ubuntu. In this tip we cover how to update an existing installation of SQL Server vNext running on Ubuntu.
In this tip we will walk through the steps to do an update.
Upgrading SQL Server vNext on Ubuntu
Before going ahead, you need to have SQL Server vNext CTP 1 running on Ubuntu and we will upgrade to CTP 1.1. I followed the step by step method Microsoft outlined in their documentation for this upgrade. Let's start the upgrade from SQL Server vNext CTP 1 to CTP 1.1 on Ubuntu.
I would recommend creating a full backup of all your user and system databases to keep a copy in case anything goes wrong with upgrade and we need to restore the databases. Since SQL Server vNext is still in the CTP phase, I assume you don't have anything critical running on this version so you can skip this step if you wish.
Now connect to Ubuntu server using PuTTY or by logging into the server locally. I connected to the Ubuntu server through PuTTY as shown in the below picture.
Now we will check the existing version of the SQL Server vNext running on Ubuntu. Connect using the sqlcmd utility and execute the below command to get the version details.
#connect to SQL Server. Enter the sa password once you get the password prompt. sqlcmd -S192.168.209.129 -Usa #check installed version of SQL Server once connected to SQL Server. SELECT @@VERSION GO
We can see that the installed version of SQL Server vNext is 188.8.131.52 which is SQL Server vNext CTP 1.
We can also check the details of the installed package mssql-server with the help of the "apt-get" command. The apt-get utility is a powerful and free package management command line program that is used to work with Ubuntu APT (Advanced Packaging Tool) library to perform installation of new software packages, removing existing software packages, upgrading of existing software packages and even used to upgrading the entire operating system. If you would like to check the information of the package along with a short description like version number, check sums, size, installed size, category, etc., use the show subcommand as shown below.
#check sql server package details apt-cache show mssql-server
Once we run "apt-get update" to resynchronize the package index files from their sources specified in /etc/apt/sources.list file, then the output of the above command will show all available updates. We can compare the above image with the one we will run post updating the source list of packages.
Now we will check the available updates of SQL Server through which we will upgrade the SQL Server. Although this is not a necessary step to perform, this will give you better a picture and help you understand the process of the upgrade. Run the below command to check updates.
#check available updates for SQL Server apt-get --just-print upgrade
The above command will display all the available updates for all installed packages. We can see there are 72 upgrades to apply, mssql-server is one of them.
As we can see, our SQL Server has one pending update from the above step, so now we will run apt-get update to resynchronize the package index files from the their sources specified in /etc/apt/sources.list file. The update command fetched the packages from their locations and updates the packages to the newer version. Run the below command to update the source list.
#Run apt-get update to update the source list of package. apt-get update mssql-server
Execution will start with a series of package updates. You can also see there are some updates from the Microsoft website for mssql-server package in the below image.
Now we have updated the source list of packages, so we will check again all available updates by running the same command which we have executed in Step 4. We can see there are two packages shown in the below screenshot, one is the older version and the other is the new update which we have to apply to upgrade mssql-server.
Next we will apply the available update to upgrade SQL Server to bring it to the latest version. Run the below command to start the upgrade. The below command will download the newest package and replace the binaries located under /opt/mssql/. The user generated databases and system databases will not be affected by this operation, but make sure to keep a backup of everything hosted on your SQL Server to be safe.
#Upgrade SQL Server. sudo apt-get install mssql-server
The package download process will start as shown in the above image. Once the download process is done, the upgrade will start. You can see the latest version of SQL Server once the upgrade completes.
Now your SQL Server has been upgraded from build version 184.108.40.206 (SQL Server VNext CTP 1) to 220.127.116.11 (SQL Server vNext CTP 1.1). We can verify it by executing the same command we used in Step 3. We can now see the SQL Server version has been updated to SQL Server vNext 18.104.22.168 (CTP1.1) in the below picture.
- Go ahead and check the databases hosted on this instance to make sure everything is accessible post upgrade.
- Continue to learn more about SQL Server vNext and stay tuned for more tips on this topic.
- Read more tips about SQL Server on Linux.
About the author
View all my tips
Article Last Updated: 2017-04-19