- Start, stop, pause, resume, restart SQL Server services
- Identify the service
- Database Engine service
- SQL Server Agent service
- SQL Server Browser service
- Additional Information
- Security
- Permissions
- SQL Server Configuration Manager
- Starting SQL Server Configuration Manager
- To start, stop, pause, resume, or restart an instance of the SQL Server Database Engine
- To start, stop, pause, resume, or restart the SQL Server Browser or an instance of the SQL Server Agent
- SQL Server Management Studio
- To start, stop, pause, resume, or restart an instance of the SQL Server Database Engine
- To start, stop, or restart an instance of the SQL Server Agent
- Command Prompt Window using net Commands
- To start the default instance of the Database Engine
- To start a named instance of the Database Engine
- To start the Database Engine with startup options
- To start the SQL Server Agent on the default instance of SQL Server
- To start the SQL Server Agent on a named instance of SQL Server
- To start the SQL Server Browser
- To pause or stop services from the Command Prompt window
- Transact-SQL
- To stop the Database Engine using Transact-SQL
- PowerShell
- To start and stop Database Engine services
- Using Service Controller Class
- Manage the SQL Server service on Linux
- To start, stop, or restart an instance of the SQL Server Database Engine
- Start, Stop, or Pause the SQL Server Agent Service Start, Stop, or Pause the SQL Server Agent Service
- Перед началом Before You Begin
- Ограничения Limitations and Restrictions
- безопасность Security
- Permissions Permissions
- Использование среды SQL Server Management Studio Using SQL Server Management Studio
- Запуск, остановка и перезапуск службы агента SQL Server To start, stop, or restart the SQL Server Agent Service
Start, stop, pause, resume, restart SQL Server services
Applies to: SQL Server (all supported versions)
This topic describes how to start, stop, pause, resume, or restart the SQL Server Database Engine, the SQL Server Agent, or the SQL Server Browser service by using SQL Server Configuration Manager, SQL Server Management Studio (SSMS), net commands from a command prompt, Transact-SQL, or PowerShell.
Identify the service
SQL Server components are executable programs that run as a Windows service. Programs that run as a Windows service can continue to operate without displaying any activity on the computer screen.
Database Engine service
The executable process that is the SQL Server Database Engine. The Database Engine can be the default instance (limit one per computer) or can be one of many named instances of the Database Engine. Use SQL Server Configuration Manager to determine which instances of the Database Engine are installed on the computer. The default instance (if you install it) is listed as SQL Server (MSSQLSERVER). Named instances (if you install them) are listed as SQL Server ( ). By default, SQL Server Express is installed as SQL Server (SQLEXPRESS).
SQL Server Agent service
A Windows service that executes scheduled administrative tasks, which are called jobs and alerts. For more information, see SQL Server Agent. SQL Server Agent is not available in every edition of SQL Server. For a list of features that are supported by the editions of SQL Server, see Features Supported by the Editions of SQL Server 2019.
SQL Server Browser service
A Windows service that listens for incoming requests for SQL Server resources and provides clients information about SQL Server instances installed on the computer. A single instance of the SQL Server Browser service is used for all instances of SQL Server installed on the computer.
Additional Information
Pausing the Database Engine service prevents new users from connecting to the Database Engine, but users who are already connected can continue to work until their connections are broken. Use pause when you want to wait for users to complete work before you stop the service. This enables them to complete transactions that are in progress. Resume allows the Database Engine to accept new connections again. The SQL Server Agent service cannot be paused or resumed.
The SQL Server Configuration Manager and SSMS display the current status of services by using the following icons.
SQL Server Configuration Manager
A green arrow on the icon next to the service name indicates that the service is started.
A red square on the icon next to the service name indicates that the service is stopped.
Two vertical blue lines on the icon next to the service name indicate that the service is paused.
When restarting the Database Engine, a red square indicates that the service stopped, and then a green arrow indicates that the service started successfully.
SQL Server Management Studio (SSMS)
A white arrow on a green circle icon next to the service name indicates that the service is started.
A white square on a red circle icon next to the service name indicates that the service is stopped.
Two vertical white lines on a blue circle icon next to the service name indicate that the service is paused.
When using SQL Server Configuration Manager or SSMS, only options that are possible are available. For example, if the service is already started, Start is unavailable.
When running on a cluster, the SQL Server Database Engine service is best managed by using Cluster Administrator.
Security
Permissions
By default, only members of the local administrators group can start, stop, pause, resume, or restart a service. To grant non-administrators the ability to manage services, see How to grant users rights to manage services in Windows Server 2003. (The process is similar on other versions of Windows Server.)
Stopping the Database Engine by using the Transact-SQL SHUTDOWN command requires membership in the sysadmin or serveradmin fixed server roles, and is not transferable.
SQL Server Configuration Manager
Starting SQL Server Configuration Manager
On the Start menu, point to All Programs, point to Microsoft SQL Server, point to Configuration Tools, and then click SQL Server Configuration Manager.
Because the SQL Server Configuration Manager is a snap-in for the Microsoft Management Console program and not a stand-alone program, SQL Server Configuration Manager does not appear as an application in newer versions of Windows. Here are the paths to the last four versions when Windows is installed on the C drive.
Version | Path |
---|---|
SQL Server 2019 | C:\Windows\SysWOW64\SQLServerManager15.msc |
SQL Server 2017 | C:\Windows\SysWOW64\SQLServerManager14.msc |
SQL Server 2016 | C:\Windows\SysWOW64\SQLServerManager13.msc |
SQL Server 2014 | C:\Windows\SysWOW64\SQLServerManager12.msc |
SQL Server 2012 | C:\Windows\SysWOW64\SQLServerManager11.msc |
To start, stop, pause, resume, or restart an instance of the SQL Server Database Engine
Start SQL Server Configuration Manager, using the instructions above.
If the User Account Control dialog box appears, click Yes.
In SQL Server Configuration Manager, in the left pane, click SQL Server Services.
In the results pane, right-click SQL Server (MSSQLServer) or a named instance, and then click Start, Stop, Pause, Resume, or Restart.
Click OK to close the SQL Server Configuration Manager.
To start an instance of the SQL Server Database Engine with startup options, see Configure Server Startup Options (SQL Server Configuration Manager).
To start, stop, pause, resume, or restart the SQL Server Browser or an instance of the SQL Server Agent
Start SQL Server Configuration Manager, using the instructions above.
If the User Account Control dialog box appears, click Yes.
In SQL Server Configuration Manager, in the left pane, click SQL Server Services.
In the results pane, right-click SQL Server Browser, or SQL Server Agent (MSSQLServer) or SQL Server Agent ( ) for a named instance, and then click Start, Stop, Pause, Resume, or Restart.
Click OK to close the SQL Server Configuration Manager.
SQL Server Agent cannot be paused.
SQL Server Management Studio
To start, stop, pause, resume, or restart an instance of the SQL Server Database Engine
In Object Explorer, connect to the instance of the Database Engine, right-click the instance of the Database Engine you want to start, and then click Start, Stop, Pause, Resume, or Restart.
Or, in Registered Servers, right-click the instance of the Database Engine you want to start, point to Service Control, and then click Start, Stop, Pause, Resume, or Restart.
If the User Account Control dialog box appears, click Yes.
When prompted if you want to act, click Yes.
To start, stop, or restart an instance of the SQL Server Agent
In Object Explorer, connect to the instance of the Database Engine, right-click SQL Server Agent, and then click Start, Stop, or Restart.
If the User Account Control dialog box appears, click Yes.
When prompted if you want to act, click Yes.
Command Prompt Window using net Commands
The Microsoft SQL Server services can be started, stopped, or paused by using Microsoft Windows net commands.
To start the default instance of the Database Engine
From a command prompt, enter one of the following commands:
net start «SQL Server (MSSQLSERVER)»
net start MSSQLSERVER
To start a named instance of the Database Engine
From a command prompt, enter one of the following commands. Replace with the name of the instance you want to manage.
net start «SQL Server ( instancename )»
net start MSSQL$ instancename
To start the Database Engine with startup options
Add startup options to the end of the net start «SQL Server (MSSQLSERVER)» statement, separated by a space. When started using net start, startup options use a slash (/) instead of a hyphen (-).
net start «SQL Server (MSSQLSERVER)» /f /m
net start MSSQLSERVER /f /m
For more information about startup options, see Database Engine Service Startup Options.
To start the SQL Server Agent on the default instance of SQL Server
From a command prompt, enter one of the following commands:
net start «SQL Server Agent (MSSQLSERVER)»
net start SQLSERVERAGENT
To start the SQL Server Agent on a named instance of SQL Server
From a command prompt, enter one of the following commands. Replace instancename with the name of the instance you want to manage.
net start «SQL Server Agent( instancename )»
net start SQLAgent$ instancename
For information about how to run SQL Server Agent in verbose mode for troubleshooting, see sqlagent90 Application.
To start the SQL Server Browser
From a command prompt, enter one of the following commands:
net start «SQL Server Browser»
net start SQLBrowser
To pause or stop services from the Command Prompt window
To pause or stop services, modify the commands in the following ways.
To pause a service, replace net start with net pause.
To stop a service, replace net start with use net stop.
Transact-SQL
The Database Engine can be stopped by using the SHUTDOWN statement.
To stop the Database Engine using Transact-SQL
To wait for currently running Transact-SQL statements and stored procedures to finish, and then stop the Database Engine, execute the following statement.
To stop the Database Engine immediately, execute the following statement.
For more information about the SHUTDOWN statement, see SHUTDOWN (Transact-SQL).
PowerShell
To start and stop Database Engine services
In a Command Prompt window, start SQL Server PowerShell by executing the following command.
At a SQL Server PowerShell command prompt, by executing the following command. Replace computername with the name of your computer.
Identify the service that you want to stop or start. Pick one of the following lines. Replace instancename with the name of the named instance.
To get a reference to the default instance of the Database Engine.
To get a reference to a named instance of the Database Engine.
To get a reference to the SQL Server Agent service on the default instance of the Database Engine.
To get a reference to the SQL Server Agent service on a named instance of the Database Engine.
To get a reference to the SQL Server Browser service.
Complete the example to start and then stop the selected service.
Using Service Controller Class
You can use ServiceController class to control SQL server service or any other Windows service. For an example on how to do this, see ServiceController Class.
Manage the SQL Server service on Linux
To start, stop, or restart an instance of the SQL Server Database Engine
The following shows how to start, stop, restart, and check the status of the SQL Server service on Linux.
Check the status of the SQL Server service using this command:
You can stop, start, or restart the SQL Server service as needed using the following commands:
Start, Stop, or Pause the SQL Server Agent Service Start, Stop, or Pause the SQL Server Agent Service
Применимо к: Applies to: SQL Server SQL Server (все поддерживаемые версии) SQL Server SQL Server (all supported versions) Управляемый экземпляр SQL Azure Azure SQL Managed Instance Управляемый экземпляр SQL Azure Azure SQL Managed Instance Применимо к: Applies to: SQL Server SQL Server (все поддерживаемые версии) SQL Server SQL Server (all supported versions) Управляемый экземпляр SQL Azure Azure SQL Managed Instance Управляемый экземпляр SQL Azure Azure SQL Managed Instance
В Управляемом экземпляре Azure SQL в настоящее время поддерживается большинство функций агента SQL Server (но не все). On Azure SQL Managed Instance, most, but not all SQL Server Agent features are currently supported. Подробные сведения см. в статье Различия в T-SQL между Управляемым экземпляром SQL Azure и SQL Server. See Azure SQL Managed Instance T-SQL differences from SQL Server for details.
В этом разделе описывается, как запустить, остановить или перезапустить службу агента SQL Server в SQL Server SQL Server с помощью среды SQL Server Management Studio SQL Server Management Studio . This topic describes how to start, stop, or restart the SQL Server Agent Service in SQL Server SQL Server by using SQL Server Management Studio SQL Server Management Studio .
Службу агента SQL Server SQL Server можно настроить для автоматического запуска вместе с операционной системой или запуска вручную для выполнения определенных заданий. You can configure the SQL Server SQL Server Agent service to start automatically when the operating system starts, or you can start it manually when you need to complete jobs. Службу агента SQL Server SQL Server можно остановить или приостановить, чтобы прекратить выполнение заданий, уведомления операторов и оповещения. You can stop or pause the SQL Server SQL Server Agent service to suspend jobs, operator notifications, and alerts.
Перед началом Before You Begin
Ограничения Limitations and Restrictions
Для автоматизации задач администрирования агент Microsoft Microsoft SQL Server SQL Server должен выполняться в качестве службы. Microsoft Microsoft SQL Server SQL Server Agent must be running as a service in order to automate administrative tasks. Дополнительные сведения см. в статье Configure SQL Server Agent. For more information, see Configure SQL Server Agent.
Узел агента SQL Server SQL Server отображается в обозревателе объектов только при наличии у пользователя разрешения на использование узла. Object Explorer only displays the SQL Server SQL Server Agent node if you have permission to use it.
безопасность Security
Permissions Permissions
Для выполнения своих функций агент SQL Server SQL Server должен быть настроен на использование учетных данных записи, которая является членом предопределенной роли сервера sysadmin в среде SQL Server SQL Server . To perform its functions, SQL Server SQL Server Agent must be configured to use the credentials of an account that is a member of the sysadmin fixed server role in SQL Server SQL Server . Эта учетная запись должна иметь следующие разрешения Windows. The account must have the following Windows permissions:
Вход в систему в качестве службы (SeServiceLogonRight) Log on as a service (SeServiceLogonRight)
Замена токена уровня процесса (SeAssignPrimaryTokenPrivilege) Replace a process-level token (SeAssignPrimaryTokenPrivilege)
Обход проходной проверки (SeChangeNotifyPrivilege) Bypass traverse checking (SeChangeNotifyPrivilege)
Назначение квот памяти процессам (SeIncreaseQuotaPrivilege) Adjust memory quotas for a process (SeIncreaseQuotaPrivilege)
Дополнительные сведения о разрешениях Windows, необходимых для учетной записи службы агента SQL Server SQL Server , см. в разделах Выбор учетной записи для службы агента SQL Server и Настройка учетных записей служб Windows. For more information about the Windows permissions required for the SQL Server SQL Server Agent service account, see Select an Account for the SQL Server Agent Service and Setting Up Windows Service Accounts.
Использование среды SQL Server Management Studio Using SQL Server Management Studio
Запуск, остановка и перезапуск службы агента SQL Server To start, stop, or restart the SQL Server Agent Service
В обозревателе объектов щелкните знак «плюс», чтобы развернуть сервер, на котором нужно управлять службой агента SQL Server. In Object Explorer, click the plus sign to expand the server where you want to manage SQL Server Agent Service.
Щелкните правой кнопкой мыши элемент Агент SQL Server и выберите команду Запуск, Стоп или Перезапуск. Right-click SQL Server Agent, and then select either Start, Stop, or Restart.
В диалоговом окне Контроль учетных записей нажмите Да. In the User Account Control dialog box, click Yes.
При появлении запроса о необходимости выполнения действия нажмите кнопку Да. When prompted if you want to perform the action, click Yes.
Дополнительные сведения можно найти в разделе For more information, see: