How do you stop a SQL Server database?
How to stop and start SQL Server servicesBy: Daniel Farina | Updated: 2020-02-06 | Comments (2) | Related: More > Database Administration Show
Free MSSQLTips Webinar: How to Avoid Worst Practices as a SQL Server DBALearn from 20 years of experience about how to turn SQL Server Worst Practices such as database corruption, security, scaling, monitoring, cloud cost management, and SQL Agent monitoring into Best Practices to properly manage your database environment. ProblemThere are often times that you need to stop and start SQL Server services, so in this tip we will look at various methods of doing this. SolutionHandling SQL Server services can be a challenging task for people other than experienced SQL Server DBAs. If you are a DBA you may think that I am exaggerating, but I have seen along my career cases of sysadmins and even SQL Server developers that don’t know how to start and stop SQL Server services. In most of the cases, they don’t know which of the SQL Server related services is the one they need to start. Five Different Methods To Start, Stop, And Restart SQL Server ServicesHomeTools & technologiesFive Different Methods To Start, Stop, And Restart SQL Server Services When we install the SQL Server, it also installs the following services:
In this article, we are going to learn the following methods to manage SQL Server services:
Let us examine all these methods. Three different ways to change the status of SQL ServicesBelow are examples of how to Start, Pause, Stop, and Restart the SQL Services using SQL Server Configuration Manager, the Command Prompt, and SQL Server Management Studio. While these tasks can be completed with SQL PowerShell and T-SQL statements, I chose the prior three methods because I felt they were easier to use when it came to applying these commands to named instances. (Warning: While it is possible to start and stop the services using the services.msc, it is against best practices and may lead to database corruption.) Local server administrators group membership is required by default to Start, Pause, Stop, or Restart services using SQL Server Configuration Manager, SQL Server Management Studio, or the Command Prompt using net commands. In situations where admin access to the OS has been lost, or granting server administrator privileges is not preferred, please consult you Systems Administrator and consider the alternatives presented in the following article: How to Start or Stop SQL Services without OS Admin Rights. Using SQL Server Configuration ManagerBest Practice: Use the SQL Server Configuration Manager when making any changes to the SQL Services. It ensures that all of the changes made to the SQL Services get propagated to all of the necessary registry entries and applies any necessary permissions when changing the account the service is running under. SQL Server Configuration Manager also provides a validation check if changes are made to the service account used to start SQL Server Service. This prevents an invalid account being assigned to the SQL Server Service which will block the service from starting. To use the SQL Server Configuration Manager, select the appropriate file for your SQL Server version and Run as Administrator: SQL Server 2016 C:\Windows\SysWOW64\SQLServerManager13.msc Example of SQL Server Configuration Manager with a default instance (MSSQLSERVER) and a named instance (Development). Using the Command Prompt with net CommandsCaution: While it is possible to change the service’s status through the command prompt, it is best practices to use the SQL Server Configuration Manager. Run the Command Prompt as the local administrator For Named instances Use the same Command Prompt commands, but replace MSSQLSERVER with the instance name (i.e. net start “SQL Server (Development)” ). Using SQL Server Management StudioExample of SQL Server Management Studio connected to the default instance and the “Development” named instance. There are some limitations to using SSMS for managing the state of the SQL Services, so again I highly recommend using SQL Server Configuration Manager when making changes. StartingSQL Server Configuration Manager
Command Prompt with net Commands
SQL Server Management Studio
PausingA special note about Pausing the SQL Server Service
Command Prompt with net Commands
SQL Server Management Studio
ResumingSQL Server Configuration Manager
Command Prompt with net Commands
SQL Server Management Studio
StoppingSQL Server Configuration Manager
Command Prompt with net Commands
SQL Server Management Studio
RestartingSQL Server Configuration Manager
Command Prompt with net Commands
For Named Instances
SQL Server Management Studio
|