Solved

SQL Server - Schedule Job to Stop and Restart service

Posted on 2014-12-01
3
648 Views
Last Modified: 2014-12-02
Hi..
How can I schedule a job to STOP and RESTART the sql server.
Having issues and would like to stop and restart at midnight.
thx
0
Comment
Question by:JElster
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
3 Comments
 
LVL 143

Accepted Solution

by:
Guy Hengel [angelIII / a3] earned 250 total points
ID: 40474084
you cannot do that from within sql server / sql server agent.
this could only be done from OS level, using NET STOP and NET START commands (specifying the relevant server names)

however, the real question here is : why do you want to do that?
in 99.99% of the cases the reason why people want to do is because they are just trying to cure some symptoms not knowing the issue and the correct solutions for the (often even a non-)issue
0
 
LVL 69

Assisted Solution

by:Scott Pletcher
Scott Pletcher earned 250 total points
ID: 40474131
You can use a SQL job to stop SQL.

But you can't use a SQL job to start SQL, because SQL jobs require that SQL be up and running to process the job :-).

You could theoretically have the job that stops SQL create an NT job to start SQL in <nn> minutes after the current time, then stop SQL.  You need to allow enough time for SQL to stop -- which can vary slightly -- or put some type of loop in the NT job.
0
 
LVL 50

Expert Comment

by:Vitor Montalvão
ID: 40475365
So, you are having issues and want to restart the service every night. What about trying to find the main problem and resolve it?
Soon you'll need to restart it in the middle of the day also and I think you won't want that, right?
0

Featured Post

On Demand Webinar: Networking for the Cloud Era

Did you know SD-WANs can improve network connectivity? Check out this webinar to learn how an SD-WAN simplified, one-click tool can help you migrate and manage data in the cloud.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Hi all, It is important and often overlooked to understand “Database properties”. Often we see questions about "log files" or "where is the database" and one of the easiest ways to get general information about your database is to use “Database p…
If you have heard of RFC822 date formats, they can be quite a challenge in SQL Server. RFC822 is an Internet standard format for email message headers, including all dates within those headers. The RFC822 protocols are available in detail at:   ht…
This video Micro Tutorial shows how to password-protect PDF files with free software. Many software products can do this, such as Adobe Acrobat (but not Adobe Reader), Nuance PaperPort, and Nuance Power PDF, but they are not free products. This vide…
In this video we outline the Physical Segments view of NetCrunch network monitor. By following this brief how-to video, you will be able to learn how NetCrunch visualizes your network, how granular is the information collected, as well as where to f…

724 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question