?
Solved

STOP/START SQL

Posted on 2006-03-21
14
Medium Priority
?
517 Views
Last Modified: 2008-01-09
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

0
Comment
Question by:boridom2006
11 Comments
 
LVL 70

Accepted Solution

by:
Scott Pletcher earned 1000 total points
ID: 16251486
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
 
LVL 18

Expert Comment

by:ShogunWade
ID: 16251528
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
 

Author Comment

by:boridom2006
ID: 16251603
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
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 
LVL 18

Expert Comment

by:ShogunWade
ID: 16251654
As Scott says,  its impossible for it to be in sql server because if sql is stopped then it cant start itsself.
0
 
LVL 6

Expert Comment

by:acampoma
ID: 16251747
do you need SQL server to be shut down completely or just have the User databases unavailable?
0
 
LVL 20

Expert Comment

by:Sirees
ID: 16251757
I agree with Scott.
0
 
LVL 7

Expert Comment

by:IT-Schubertz
ID: 16257017
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
 

Author Comment

by:boridom2006
ID: 16259833
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
 
LVL 18

Assisted Solution

by:ShogunWade
ShogunWade earned 1000 total points
ID: 16273447
"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
 

Author Comment

by:boridom2006
ID: 16274524
I agree with you, but I am dealing with a requestee that is not very flexible, for not saying not flexible at all.
0
 
LVL 18

Expert Comment

by:ShogunWade
ID: 16287072
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

Featured Post

Nothing ever in the clear!

This technical paper will help you implement VMware’s VM encryption as well as implement Veeam encryption which together will achieve the nothing ever in the clear goal. If a bad guy steals VMs, backups or traffic they get nothing.

Question has a verified solution.

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

Why is this different from all of the other step by step guides?  Because I make a living as a DBA and not as a writer and I lived through this experience. Defining the name: When I talk to people they say different names on this subject stuff l…
This shares a stored procedure to retrieve permissions for a given user on the current database or across all databases on a server.
This video shows how to set up a shell script to accept a positional parameter when called, pass that to a SQL script, accept the output from the statement back and then manipulate it in the Shell.
Viewers will learn how the fundamental information of how to create a table.
Suggested Courses

809 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