How do you stop a SQL database?
When we install the SQL Server, it also installs the following services: Show
In this article, we are going to learn the following methods to manage SQL Server services:
Let us examine all these methods. SQL Server Configuration ManagerSQL Server Configuration Manager is a tool for SQL Server services managing, included in the SQL Server software package. When we install SQL Server, this manager gets installed automatically. To manage the services, launch the SQL Server configuration manager and Right-click on MSSQLSERVER. In a dialog box, you will see the options to start, stop, and restart the services. Picture 1. Using SQL Server Configuration Manager to manage SQL Server servicesIf the process timeout or any other error occurs, it informs the user about the problems: Picture 2. A warning box produced by the SQL Server Configuration ManagerError details are available in Event Viewer or ErrorLog of the SQL Server. You can use SQL Server Management Studio can restart services. Launch SSMS -> Connect to the SQL Server instance -> Right-click on Hostname. It opens a context menu with the start, stop, pause, and restart options: Picture 3. Managing SQL Server services with SSMSServices MMC (Microsoft Management Console)To manage SQL Server settings with Services MMC (Microsoft Management Console), do the following: Open Control Panel -> Administrative tools -> Click on Services -> Find MSSQLSERVER -> Right-click on it. In a dialog box that opens after right-clicking, you get the options to start, stop, and restart the services: Picture 4. Managing options in Services MMCAlternatively, you can run the Services.msc command to open Services MMC. PowerShell CommandsTo start and stop any service, use Start-Service and Stop-Service command. Launch PowerShell and execute the following command to start the services: PS C:\WINDOWS\system32> Start-Service MSSQLSERVERTo view the SQL Server service status, open SQL Server Configuration Manager and click on SQL Server Service: The following command stops the service: PS C:\WINDOWS\system32> Stop-Service -Force MSSQLSERVER Picture 5. The result of executing the Stop-Service PowerShell commandFinally, the command to restart the SQL Server service is as follows: PS C:\WINDOWS\system32> Restart-Service -Force MSSQLSERVERManage services in Ubuntu LinuxIn Ubuntu Linux, we must use the systemctl command to manage SQL Server service. It is a Linux command for controlling the service manager and systemd system. To illustrate this option, I have installed SQL Server 2019 on Ubuntu Linux. Note: The root user must be used to manage the services. If you log in as a different user, execute the following command in the terminal: nisarg@LinuxSQL01:~$ sudo -iRun the below command to stop the service: root@LinuxSQL01:~# systemctl stop mssql-server.service Picture 6. The stop command execution on LinuxWe do not receive any feedback on the terminal to verify the service status. Thus, to check it, run the command: root@LinuxSQL01:~# systemctl status mssql-server. service Picture 7. Checking the service status on LinuxThe following command starts the SQL Services: root@LinuxSQL01:~# systemctl start mssql-server.service Picture 8. Execution of the start services command on LinuxTo view the status, run the below command: root@LinuxSQL01:~# systemctl status mssql-server.service Picture 9. View the SQL Server services status on LinuxThe following command is used to restart the service: root@LinuxSQL01:~# systemctl restart mssql-server.service Picture 10. Restart the SQL Server services on LinuxThe Windows Server failover cluster managerManaging SQL Server services on the stand-alone instance and in the failover cluster environment is different. We can use any of the above methods, but, according to Microsoft’s best practices, we should use the Windows Failover Cluster Manager. When we install an SQL Server on a clustered environment, an SQL Server role is created. We can view this role: Open the Failover Cluster Manager -> Click on Roles -> Right-click on the MSSQLSERVER role. A context menu opens. Hover on Move and select Best Possible Node: Picture 11. Viewing the SQL Server role and moving resources in the failover cluster environmentOnce resources are moved to the secondary node, open the SQL Server Configuration Manager to verify that the service has been stopped on SQL01 Node. As you can see, it’s done correctly: Picture 12. Confirming that the service has been stoppedSummaryThis article presented five different methods to manage SQL Server services using different means and in different environments. (Visited 1,166 times, 1 visits today) Tags: database administration, database management, sql server services Last modified: September 18, 2021Prerequisites
When you start the SQL Server you actually start the Windows service SQL Server and the corresponding process sqlservr.exe. In addition to starting the server, you also need to start the SQL Server Agent to be able to schedule and execute jobs within the SQL Server Management Studio. Other services offered by the SQL Server are not required in the SAP environment and should therefore not be started. Overview of SQL Server Services
Note You can view a list of all installed services and their current status in the Windows Services application. You can start the SQL Server using the SQL Server Services manager or the SQL Server Management Studio. Procedure
Page 2 |