Dela via


Stopping Services

You can stop an instance of Microsoft SQL Server locally from the server or remotely from a client or another server. If you stop an instance of SQL Server without pausing it, all server processes are terminated immediately. Stopping an instance of SQL Server prevents new connections and disconnects current users.

The following table describes the available methods for stopping an instance of SQL Server.

Method

Description

SQL Server Configuration Manager

Stops a local or remote instance of SQL Server or a SQL Server Agent service.

SQL Server Management Studio 

Stops a local or remote instance of SQL Server or a SQL Server Agent service.

SHUTDOWN statement

Stops an instance of SQL Server when executed within sqlcmd or another query tool. Using the WITH NOWAIT statement stops an instance of SQL Server immediately.

net commands

Stops an instance of SQL Server either remotely or locally, if you are running the Microsoft Windows 2000 or Windows Server 2003 operating systems. To stop a named instance of SQL Server, enter net stop mssql$instancename from the command prompt.

Control Panel

Stops an instance of SQL Server by using the Services application in Control Panel.

CTRL+C

Stops an instance of SQL Server if it was started as a program from the command prompt.

When you stop an instance of SQL Server, the server performs the following services before it shuts down:

  • Disables logins (except for system administrators)

  • Waits for all Transact-SQL statements or stored procedures currently executing to finish

    Note

    To bring the system to an immediate halt, you can issue the SHUTDOWN WITH NOWAIT statement from the sqlcmd or osql utility.

Before you stop an instance of SQL Server, you can broadcast a message to warn users of an impending shutdown. In the message, include the time the instance of SQL Server will be stopped so that users can finish their tasks. For more information, see How to: Broadcast a Shutdown Message (Command Prompt).