How to Uninstall SQL Server 2017 from RedHat Linux Server

We all know how to install SQL Server 2017 on RedHat Linux. Here I will explain step by step process to uninstall SQL Server 2017 on RedHat Linux 7.3 server.

Read More on SQL Server Installation on Linux Servers

Uninstall SQL Server 2017 on RHEL

Uninstalling SQL Server 2017 that is running on Linux server is totally different process as compared to its windows based SQL Server. Follow below step by step process to uninstall SQL Server 2017 from your RHEL Linux server.

1- Connect to your RHEL server where SQL Server 2017 is running and that needs to be uninstalled from the server. Check whether SQL Server is installed on this machine or not by checking SQL Server service. You can see SQL Server is running on this server.

#Run below command to check SQL Server Service.
systemctl status mssql-server

Check SQL Server Service on RHEL

2- Check SQL Server files along with the database files before removing SQL Server. We will validate SQL Server removal by checking these files post uninstallation.

#Check SQL Server binaries & database files
sudo ls -lrt /var/opt/mssql
sudo ls -lrt /var/opt/mssql/data

check database files

Note: Make sure to run full backup of all your databases and keep them in a safer place for future needs.

3- Now, we will uninstall SQL Server by running below command.

#Remove SQL Server from your Linux machine
sudo yum remove mssql-server

uninstall SQL Server 2017 from RHEL

You can see details of SQL Server packages that are going to be removed from this machine. These packages are SQL Server and SQL Server Agent that are going to be removed here. Above command will ask us to type y to proceed with the uninstallation and type N to quit this uninstallation. Type y to proceed with the SQL Server removal.

uninstall sql server 2017 from rhel

You can see SQL Server and SQL Server Agent both packages have been removed from this machine.

4- Now, remove all SQL Server binaries and database files from its installed location that we checked in second screenshot by running below command.

#Remove database files and SQL binaries.
sudo rm -rf /var/opt/mssql

remove sql server binaries

Here, your SQL Server has been removed from this linux machine. You can check SQL Server binaries and database files by running below commands. We can see no files in these locations because they have been removed now.

#Check database files.
sudo ls -lrt /var/opt/mssql/data

#Check SQL Server files & folders.
sudo ls -lrt /var/opt/mssql

check sql server binaries

5- Now you can check SQL Server service again by executing below command.

#Check SQL Server Service post SQL Server Removal.
systemctl status mssql-server 

We can see SQL Server is not loaded this time but service is showing as active.

Check SQL Server service post uninstallation

When you will try to restart this service, it will throw you an error that unit not found as shown in below image.

Restart SQL Server service post uinstallation

6- Now we need to reboot the server to update SQL Server service status on RHEL. I restarted this linux machine and again checked the SQL Server service. You can see this time it says service could not found.

restart RHEL and check SQL Service

I hope you like this article. Please follow ourĀ facebook page and Twitter handle to get latest updates.

Manvendra Deo Singh
Follow me:
Summary
How to Uninstall SQL Server 2017 from RedHat Linux Server
Article Name
How to Uninstall SQL Server 2017 from RedHat Linux Server
Description
Uninstall SQL Server that is running on Linux server is totally different process as compared to its windows based SQL Server. Follow below step by step process to uninstall SQL Server from your RHEL Linux server.
Author
Publisher Name
www.techyaz.com

You may also like...

Leave a Reply

Your email address will not be published. Required fields are marked *