title | description | author | ms.author | ms.date | ms.service | ms.subservice | ms.topic | ms.custom | helpviewer_keywords | ||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Start, stop, and restart SQL Server services on Linux |
Find out how to start, stop, or restart various SQL Server services on Linux. See how to use Transact-SQL and command-line tools for these actions. |
rwestMSFT |
randolphwest |
09/19/2024 |
sql |
configuration |
conceptual |
|
|
[!INCLUDE SQL Server - Linux]
This article describes how to start, stop, or restart the [!INCLUDE ssNoVersion] [!INCLUDE ssDE] and SQL Server Agent on Linux by using the command line, or Transact-SQL.
For [!INCLUDE ssNoVersion] on Windows, see Start, stop, pause, resume, and restart SQL Server services.
For [!INCLUDE ssNoVersion] on Linux containers, see Configure and customize SQL Server Linux containers.
[!INCLUDE ssNoVersion] components are executable programs that run as services (also known as daemons on Linux). Linux services can run without displaying any activity on the computer screen and without user interaction on the command line.
The [!INCLUDE ssDE] service is the default instance, with a limit of one per computer. Named instances aren't supported on Linux. To run multiple instances of [!INCLUDE ssNoVersion] on a single computer using containers, see Deploy and connect to SQL Server Linux containers.
The SQL Server Agent service executes scheduled administrative tasks, which are called jobs and alerts. For more information, see SQL Server Agent. SQL Server Agent isn't available in every edition of [!INCLUDE ssNoVersion]. For a list of features supported by the editions of [!INCLUDE ssNoVersion], see Editions and supported features of SQL Server 2022.
On Linux, you can't pause the [!INCLUDE ssDE] service like you can on Windows. The SQL Server Agent service also can't be paused or resumed.
When running on a cluster, use the appropriate cluster management tool to manage the [!INCLUDE ssDE] for your Linux distribution. See Deploy a Pacemaker cluster for SQL Server on Linux for an example using Pacemaker.
By default, only members of the local administrator group can start, stop, or restart a service.
Stopping the [!INCLUDE ssDE] by using the Transact-SQL SHUTDOWN
command requires membership in the sysadmin or serveradmin fixed server roles, and isn't transferable.
The following steps show how to start, stop, restart, and check the status of the [!INCLUDE ssNoVersion] service on Linux. To manage a SQL Server container, see Troubleshoot SQL Server on Linux.
Check the status of the [!INCLUDE ssDE] service using this command:
sudo systemctl status mssql-server
You can stop, start, or restart the [!INCLUDE ssDE] service as needed using the following commands:
sudo systemctl stop mssql-server
sudo systemctl start mssql-server
sudo systemctl restart mssql-server
To set up and manage the SQL Server Agent, see Install SQL Server Agent on Linux. To restart the SQL Server Agent service, you must restart the [!INCLUDE ssDE] service.
The [!INCLUDE ssDE] can be stopped by using the SHUTDOWN
statement.
-
To wait for currently running Transact-SQL statements and stored procedures to finish, and then stop the [!INCLUDE ssDE], execute the following statement.
SHUTDOWN;
-
To stop the [!INCLUDE ssDE] immediately, execute the following statement.
SHUTDOWN WITH NOWAIT;
For more information, see SHUTDOWN.