Skip to content

Latest commit

 

History

History
101 lines (68 loc) · 5.58 KB

File metadata and controls

101 lines (68 loc) · 5.58 KB
title Start, stop, and restart SQL Server services on Linux
description 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.
ms.date 02/24/2022
ms.service sql
ms.subservice configuration
ms.topic conceptual
helpviewer_keywords
SQL Server on Linux, startup options
Database Engine [SQL Server], starting and stopping services on Linux
command line [SQL Server], starting and stopping SQL Server services on Linux
starting SQL Server Database Engine on Linux
command prompt [SQL Server] on Linux
startup options [SQL Server] on Linux
systemctl commands [SQL Server]
SQL Server on Linux, starting and stopping
stopping SQL Server on Linux
SQL Server Database Engine on Linux setting startup options
administering SQL Server on Linux, starting and stopping services
author rwestMSFT
ms.author randolphwest
ms.reviewer randolphwest

Start, stop, and restart SQL Server services on Linux

[!INCLUDE SQL Server - Linux]

This article describes how to start, stop, or restart the [!INCLUDEssNoVersion] [!INCLUDEssDE] and SQL Server Agent on Linux by using the command line, or Transact-SQL.

For [!INCLUDEssNoVersion] on Windows, see Start, stop, pause, resume, and restart SQL Server services.

Identify the service

[!INCLUDEssNoVersion] 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.

[!INCLUDEssDE] service

The [!INCLUDEssDE] service is the default instance, with a limit of one per computer. Named instances aren't supported on Linux. To run multiple instances of [!INCLUDEssNoVersion] on a single computer using containers, see Deploy and connect to SQL Server Docker containers.

SQL Server Agent service

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 [!INCLUDEssNoVersion]. For a list of features that are supported by the editions of [!INCLUDEssNoVersion], see Features Supported by the Editions of SQL Server 2019.

Additional Information

  • On Linux, you can't pause the [!INCLUDEssDE] 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 [!INCLUDEssDE] for your Linux distribution. See Deploy a Pacemaker cluster for SQL Server on Linux for an example using Pacemaker.

Permissions

By default, only members of the local administrator group can start, stop, or restart a service.

Stopping the [!INCLUDEssDE] by using the Transact-SQL SHUTDOWN command requires membership in the sysadmin or serveradmin fixed server roles, and is not transferable.

Using command-line tools

The following steps show how to start, stop, restart, and check the status of the [!INCLUDEssNoVersion] service on Linux. To manage a SQL Server Docker container, see Troubleshoot SQL Server on Linux.

Check the status of the [!INCLUDEssDE] service using this command:

sudo systemctl status mssql-server

You can stop, start, or restart the [!INCLUDEssDE] 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 [!INCLUDEssDE] service.

Transact-SQL

The [!INCLUDEssDE] can be stopped by using the SHUTDOWN statement.

To stop the [!INCLUDEssDE] using Transact-SQL

  • To wait for currently running Transact-SQL statements and stored procedures to finish, and then stop the [!INCLUDEssDE], execute the following statement.

    SHUTDOWN;
  • To stop the [!INCLUDEssDE] immediately, execute the following statement.

    SHUTDOWN WITH NOWAIT;

For more information about the SHUTDOWN statement, see SHUTDOWN (Transact-SQL).

Next steps