Skip to content

Latest commit

 

History

History
367 lines (237 loc) · 21.5 KB

File metadata and controls

367 lines (237 loc) · 21.5 KB
title Start, Stop, Pause, Resume, Restart SQL Server Services | Microsoft Docs
ms.custom
ms.date 02/26/2016
ms.prod sql-non-specified
ms.prod_service database-engine
ms.service
ms.component configure-windows
ms.reviewer
ms.suite sql
ms.technology
database-engine
ms.tgt_pltfrm
ms.topic article
helpviewer_keywords
SQL Server Configuration Manager, start and stop services
stopping SQL Server Agent
parameters [SQL Server], startup options
SQL Server, startup options
Database Engine [SQL Server], starting and stopping services
pausing SQL Server
PowerShell [SQL Server], starting and stopping services
single-user mode [SQL Server], starting in
SQL Server Management Studio [SQL Server], starting or stopping services
stopping SQL Server Browser service
starting SQL Server Agent
default instances [SQL Server], starting and stopping
SQL Server Agent, starting and stopping
command prompt [SQL Server], starting and stopping SQL Server services
continuing SQL Server
starting SQL Server Database Engine
net stop commands [SQL Server]
command prompt [SQL Server], SQL Browser service
Configuration Manager, start and stop services
resuming SQL Server
startup options [SQL Server]
named instances [SQL Server], starting and stopping
net start commands [SQL Server]
SQL Server, starting and stopping
stopping SQL Server
starting SQL Server Browser service
SQL Server Database Engine setting startup options
administering SQL Server, starting and stopping services
Management Studio [SQL Server], starting or stopping services
ms.assetid 32660a02-e5a1-411a-9e57-7066ca459df6
caps.latest.revision 20
author MikeRayMSFT
ms.author mikeray
manager craigg
ms.workload Active

Start, Stop, Pause, Resume, Restart SQL Server Services

[!INCLUDEappliesto-ss-xxxx-xxxx-xxx-md]

For content related to previous versions of SQL Server, see Start Stop Pause Resume Restart the Database Engine SQL Server Agent or SQL Server Browser Service.

This topic describes how to start, stop, pause, resume, or restart the [!INCLUDEssDEnoversion], the [!INCLUDEssNoVersion] Agent, or the [!INCLUDEssNoVersion] Browser service by using [!INCLUDEssNoVersion] Configuration Manager, [!INCLUDEssManStudioFull], net commands from a command prompt, [!INCLUDEtsql], or PowerShell.

Before You Begin

What is the [!INCLUDEssDEnoversion] service, the [!INCLUDEssNoVersion] Agent service, and the [!INCLUDEssNoVersion] Browser service?

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

[!INCLUDEssDE] service
The executable process that is the [!INCLUDEssDEnoversion]. The [!INCLUDEssDE] can be the default instance (limit one per computer), or can be one of many named instances of the [!INCLUDEssDE]. Use [!INCLUDEssNoVersion] Configuration Manager to determine which instances of [!INCLUDEssDE] are installed on the computer. The default instance (if you install it) is listed as [!INCLUDEssNoVersion] (MSSQLSERVER). Named instances (if you install them) are listed as [!INCLUDEssNoVersion] (<instance_name>). By default, [!INCLUDEssNoVersion] Express is installed as [!INCLUDEssNoVersion] (SQLEXPRESS).

[!INCLUDEssNoVersion] Agent service
A Windows service that executes scheduled administrative tasks, which are called jobs and alerts. For more information, see SQL Server Agent. [!INCLUDEssNoVersion] Agent is not 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 2016.

[!INCLUDEssNoVersion] Browser service
A Windows service that listens for incoming requests for [!INCLUDEssNoVersion] resources and provides clients information about [!INCLUDEssNoVersion] instances installed on the computer. A single instance of the [!INCLUDEssNoVersion] Browser service is used for all instances of [!INCLUDEssNoVersion] installed on the computer.

Additional Information

  • Pausing the [!INCLUDEssDE] service prevents new users from connecting to the [!INCLUDEssDE], 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 [!INCLUDEssDE] to accept new connections again. The [!INCLUDEssNoVersion] Agent service cannot be paused or resumed.

  • The [!INCLUDEssNoVersion] Configuration Manager and [!INCLUDEssManStudioFull] display the current status of services by using the following icons.

    [!INCLUDEssNoVersion] 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 indicates that the service is paused.

    • When restarting the [!INCLUDEssDE], a red square will indicate that the service stopped, and then a green arrow will indicate that he service started successfully.

    [!INCLUDEssManStudioFull]

    • 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 indicates that the service is paused.

  • When using [!INCLUDEssNoVersion] Configuration Manager or [!INCLUDEssManStudioFull], only options that are possible will be available. For example, if the service is already started, Start will be unavailable.

  • When running on a cluster, the [!INCLUDEssDEnoversion] 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.)

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

Using [!INCLUDEssNoVersion] Configuration Manager

Starting [!INCLUDEssNoVersion] Configuration Manager

  1. On the Start menu, point to All Programs, point to [!INCLUDEssCurrentUI], point to Configuration Tools, and then click SQL Server Configuration Manager.

    Because [!INCLUDEssNoVersion] Configuration Manager is a snap-in for the [!INCLUDEmsCoName] Management Console program and not a stand-alone program, [!INCLUDEssNoVersion] Configuration Manager does not appear as an application in newer versions of Windows. Here are the paths to the last four versions when Windows in installed on the C drive.

    [!INCLUDEssNoVersion] 2016 C:\Windows\SysWOW64\SQLServerManager13.msc
    [!INCLUDEssSQL14] C:\Windows\SysWOW64\SQLServerManager12.msc
    [!INCLUDEssSQL11] C:\Windows\SysWOW64\SQLServerManager11.msc
    [!INCLUDEssKatmai] C:\Windows\SysWOW64\SQLServerManager10.msc

To start, stop, pause, resume, or restart the an instance of the [!INCLUDEssDEnoversion]

  1. Start [!INCLUDEssNoVersion] Configuration Manager, using the instructions above.

  2. If the User Account Control dialog box appears, click Yes.

  3. In [!INCLUDEssNoVersion] Configuration Manager, in the left pane, click SQL Server Services.

  4. In the results pane, right-click SQL Server (MSSQLServer) or a named instance, and then click Start, Stop, Pause, Resume, or Restart.

  5. Click OK to close [!INCLUDEssNoVersion] Configuration Manager.

Note

To start an instance of the [!INCLUDEssDEnoversion] with startup options, see Configure Server Startup Options (SQL Server Configuration Manager).

To start, stop, pause, resume, or restart the [!INCLUDEssNoVersion] Browser or an instance of the [!INCLUDEssNoVersion] Agent

  1. Start [!INCLUDEssNoVersion] Configuration Manager, using the instructions above.

  2. If the User Account Control dialog box appears, click Yes.

  3. In [!INCLUDEssNoVersion] Configuration Manager, in the left pane, click SQL Server Services.

  4. In the results pane, right-click [!INCLUDEssNoVersion] Browser, or [!INCLUDEssNoVersion] Agent (MSSQLServer) or [!INCLUDEssNoVersion] Agent (<instance_name>) for a named instance, and then click Start, Stop, Pause, Resume, or Restart.

  5. Click OK to close [!INCLUDEssNoVersion] Configuration Manager.

Note

[!INCLUDEssNoVersion] Agent cannot be paused.

Using [!INCLUDEssNoVersion] Management Studio

To start, stop, pause, resume, or restart the an instance of the [!INCLUDEssDEnoversion]

  1. In Object Explorer, connect to the instance of the [!INCLUDEssDE], right-click the instance of the [!INCLUDEssDE] you want to start, and then click Start, Stop, Pause, Resume, or Restart.

    Or, in Registered Servers, right-click the instance of the [!INCLUDEssDE] you want to start, point to Service Control, and then click Start, Stop, Pause, Resume, or Restart.

  2. If the User Account Control dialog box appears, click Yes.

  3. When prompted if you want to perform the action, click Yes.

To start, stop, or restart the an instance of the [!INCLUDEssNoVersion] Agent

  1. In Object Explorer, connect to the instance of the [!INCLUDEssDE], right-click [!INCLUDEssNoVersion] Agent, and then click Start, Stop, or Restart.

  2. If the User Account Control dialog box appears, click Yes.

  3. When prompted if you want to perform the action, click Yes.

From the Command Prompt Window using net Commands

The [!INCLUDEmsCoName] [!INCLUDEssNoVersion] services can be started, stopped, or paused by using [!INCLUDEmsCoName] Windows net commands.

To start the default instance of the [!INCLUDEssDE]

  • From a command prompt, enter one of the following commands:

    net start "SQL Server (MSSQLSERVER)"

    -or-

    net start MSSQLSERVER

To start a named instance of the [!INCLUDEssDE]

  • 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 ( instancename )"

    -or-

    net start MSSQL$ instancename

To start the [!INCLUDEssDE] 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

    -or-

    net start MSSQLSERVER /f /m

    [!NOTE]
    For more information about startup options, see Database Engine Service Startup Options.

To start the [!INCLUDEssNoVersion] Agent on the default instance of [!INCLUDEssNoVersion]

  • From a command prompt, enter one of the following commands:

    net start "SQL Server Agent (MSSQLSERVER)"

    -or-

    net start SQLSERVERAGENT

To start the [!INCLUDEssNoVersion] Agent on a named instance of [!INCLUDEssNoVersion]

  • 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 )"

    -or-

    net start SQLAgent$ instancename

For information about how to run [!INCLUDEssNoVersion] Agent in verbose mode for troubleshooting, see sqlagent90 Application.

To start the [!INCLUDEssNoVersion] Browser

  • From a command prompt, enter one of the following commands:

    net start "SQL Server Browser"

    -or-

    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.

Using Transact-SQL

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

To stop the [!INCLUDEssDE] using [!INCLUDEtsql]

  • To wait for currently running [!INCLUDEtsql] 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).

Using PowerShell

To start and stop [!INCLUDEssDE] services

  1. In a Command Prompt window, start [!INCLUDEssNoVersion] PowerShell by executing the following command.

    sqlps  
    
  2. At a [!INCLUDEssNoVersion] PowerShell command prompt, by executing the following command. Replace computername with the name of your computer.

    # Get a reference to the ManagedComputer class.  
    CD SQLSERVER:\SQL\computername  
    $Wmi = (get-item .).ManagedComputer  
    
  3. 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 [!INCLUDEssDE].

      $DfltInstance = $Wmi.Services['MSSQLSERVER']  
    • To get a reference to a named instance of the [!INCLUDEssDE].

      $DfltInstance = $Wmi.Services['MSSQL$instancename']  
    • To get a reference to the [!INCLUDEssNoVersion] Agent service on the default instance of the [!INCLUDEssDE].

      $DfltInstance = $Wmi.Services['SQLSERVERAGENT']  
    • To get a reference to the [!INCLUDEssNoVersion] Agent service on a named instance of the [!INCLUDEssDE].

      $DfltInstance = $Wmi.Services['SQLAGENT$instancename']  
    • To get a reference to the [!INCLUDEssNoVersion] Browser service.

      $DfltInstance = $Wmi.Services['SQLBROWSER']  
  4. Complete the example to start and then stop the selected service.

    # Display the state of the service.  
    $DfltInstance  
    # Start the service.  
    $DfltInstance.Start();  
    # Wait until the service has time to start.  
    # Refresh the cache.  
    $DfltInstance.Refresh();   
    # Display the state of the service.  
    $DfltInstance  
    # Stop the service.  
    $DfltInstance.Stop();  
    # Wait until the service has time to stop.  
    # Refresh the cache.  
    $DfltInstance.Refresh();   
    # Display the state of the service.  
    $DfltInstance  

See Also

Overview of SQL Server Setup Documentation
View and Read SQL Server Setup Log Files
SQL Server Configuration Manager
Start SQL Server with Minimal Configuration
Features Supported by the Editions of SQL Server 2016