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
Solved

SQL Server - Schedule Job to Stop and Restart service

Posted on 2014-12-01
3
578 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
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 48

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

Optimizing Cloud Backup for Low Bandwidth

With cloud storage prices going down a growing number of SMBs start to use it for backup storage. Unfortunately, business data volume rarely fits the average Internet speed. This article provides an overview of main Internet speed challenges and reveals backup best practices.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Managing Columnstore Indexes 2 38
Webservices in T-SQL 3 34
Query group by data in SQL Server - cursor? 3 47
SQL trigger 5 21
I have written a PowerShell script to "walk" the security structure of each SQL instance to find:         Each Login (Windows or SQL)             * Its Server Roles             * Every database to which the login is mapped             * The associated "Database User" for this …
SQL Server engine let you use a Windows account or a SQL Server account to connect to a SQL Server instance. This can be configured immediatly during the SQL Server installation or after in the Server Authentication section in the Server properties …
Established in 1997, Technology Architects has become one of the most reputable technology solutions companies in the country. TA have been providing businesses with cost effective state-of-the-art solutions and unparalleled service that is designed…
A short tutorial showing how to set up an email signature in Outlook on the Web (previously known as OWA). For free email signatures designs, visit https://www.mail-signatures.com/articles/signature-templates/?sts=6651 If you want to manage em…

856 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