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
- Installing SQL Server 2017 on Ubuntu Server
- How to Install SQL Server on Redhat Linux without Internet – Offline Installation
- How to Install SQL Server on Ubuntu without Internet access – Offline Installation
- Installing SQL Tools on RedHat Linux Server
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
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
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
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.
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
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
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.
When you will try to restart this service, it will throw you an error that unit not found as shown in below image.
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.
Latest posts by Manvendra Deo Singh (see all)
- Understanding Hybrid Buffer Pool in SQL Server - December 30, 2018
- Fix:VIEW SERVER STATE permission was denied on object ‘server’, database ‘master’ - August 30, 2018
- SQL Server Error 5184: Cannot use file ‘I:\Path\Techyaz.mdf’ for clustered server - August 29, 2018