STOP/START SQL

I need to schedule and submit a job from SQL server, to shut down SQL and wait for 60 minutes until some other tasks get performed on the server, then startup SQL after a wait of 60 minutes, and send an email to several users if SQL did not start up successfully.

Any assistance will be appreciated.

Thanks,
Amber

boridom2006Asked:
Who is Participating?
 
Scott PletcherSenior DBACommented:
The shutdown can be done from w/i SQL, but the start up will have to be done via Windows.  Since SQL isn't up, it can't run a job to start itself :-) .
0
 
ShogunWadeCommented:
concur with scott.

An approach may be to schedule a batch file or VBA script to NET STOP sql server then WAIT then NET START  sql

0
 
boridom2006Author Commented:
I have the script to do it using NET STOP/START, but got requested to find out if there is a way in which it can be done using only SQL Server jobs only.  Any idea?

Regards,
Amber
0
Ultimate Tool Kit for Technology Solution Provider

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy now.

 
ShogunWadeCommented:
As Scott says,  its impossible for it to be in sql server because if sql is stopped then it cant start itsself.
0
 
acampomaCommented:
do you need SQL server to be shut down completely or just have the User databases unavailable?
0
 
SireesCommented:
I agree with Scott.
0
 
IT-SchubertzCommented:
Hi,

maybe you don't need to shut down SQL Server completely, but only stop the usage of several databases?
if yes, you can create a SQL Batch job that detaches your database, waits and then attaches the db again

sp_detach and sp_attach are the keywords to search for in BOL

HTH

Andy
0
 
boridom2006Author Commented:
Hi,
Thanks for all of your inputs.  It really sounds impossible for me as well, but the request I received was to completely shutdown all instances of sql server.  I have an idea that may work.  I will create an instance of sql only for administrative purpose, and from there will run a job to stop all other instances.  Does someone have an answer for the last portion of my question?  "send an email to several users if SQL did not start up successfully".  In other words, everytime I NET START one instance, need to check the status of the instance, and send email notifying if there was an instance that did not startup.

Regards,
Amber

0
 
ShogunWadeCommented:
"I will create an instance of sql only for administrative purpose, and from there will run a job to stop all other instances."

Personally, I would go back to the requestee and explain the predicament and discuss alternative options like VB Script scheduled via Windows Scheduler.    Installing an additional instance of SQL for administrative purposes seems to me like a huge resource drain.



0
 
boridom2006Author Commented:
I agree with you, but I am dealing with a requestee that is not very flexible, for not saying not flexible at all.
0
 
ShogunWadeCommented:
Ok, In that case I dont see any other option but i would ensure you explain to the client / requestee that performance on his box will diminnish by having to have a second instance of sql on there.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.