In the previous blog post we have seen how to Install SQL Server on Linux(CENTOS). In this post, let’s see how to manage SQL Server Services in Linux environment. After all as a DBA, we should know how to manage our database services 🙂 Let’s get started…
In Linux world, to manage services, we’ll be using command called “SYSTEMCTL“. We can check the status, stop,start,disable,enable any service running on a linux box using that command.
Syntax is very simple to remember: systemctl action ServiceName. Check this documentation for more details.
Verify the current status of SQL Server services:
Syntax: systemctl status mssql-server
As you can see SQL Server Service is enabled and is running. Okay, let’s stop and disable them.
Stop and Disable SQL Server services:
Syntax: sudo systemctl stop mssql-server
sudo systemctl disable mssql-server
Once this is done, check the status of SQL services(See below screenshot for all the three steps)
Now, Let’s start SQL services(Since we have disabled the services as well besides stopping, let’s enable and then start SQL)
Enable and Start SQL Server Services:
Syntax: sudo systemctl enable mssql-server
sudo systemctl start mssql-server
It successfully created syslink right after enabling the service. Then I started SQL service, Let’s check the status of the service again.
Happy SQLing on Linux 🙂 Fun Fun….