SQL server Service start/stop using batch processing (SC)

Source: Internet
Author: User
Tags mssqlserver

So let some non-windows Services such as SQL server do not start up, and then use batch processing to start it when it is used:

First, set the SQL server-related Service Startup Type in "Control Panel> Administrative Tools> Services" to manual (Services starting with SQL Server), and create a new text document, change the suffix to "bat ". Add the batch processing command below:

1. Start SQL SERVER. batCopy codeThe Code is as follows: @ echo. Service Startup ......
@ Echo off
@ SC start MSSQLSERVER
@ SC start SQLSERVERAGENT
@ SC start MSSQLServerOLAPService
@ SC start msftesql
@ SC start MsDtsServer
@ SC start SQLWriter
@ Echo off
@ Echo. started!
@ Pause

2. Stop SQL SERVER. batCopy codeThe Code is as follows: @ echo. The service is stopped ......
@ Echo off
@ SC stop SQLSERVERAGENT
@ SC stop MSSQLServerOLAPService
@ SC stop msftesql
@ SC stop MsDtsServer
@ SC stop SQLWriter
@ SC stop MSSQLSERVER
@ Echo off
@ Echo. Stopped!
@ Pause

The specific usage of the SC (server control) command can be viewed using the "SC-help" command, or you can search online. After these two batch files are created, when SQL Server 2005 is run, run "start SQL SERVER. bat "indicates the batch processing file. When you exit, execute" Stop SQL SERVER. bat ", very convenient.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.