Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2008 Forums
 SQL Server Administration (2008)
 How to run A SQL Job Of Restart Of Server, SQL Ser

Author  Topic 

David92595
Starting Member

8 Posts

Posted - 2012-12-20 : 14:54:20
Basics: I'm running a SQL Server 2008 R2

I am trying to run a SQL job or maintenance plan on the startup (restart) of a SQL Server.
I’m trying to automate a Database Shrink job, which has to have exclusive access to the database to run. Realistically, the only time this happens is when the server is restarted, so I’m looking for a way to run a job on restart.

As always, any help is greatly appreciated
Thank you,

David92595

sodeep
Master Smack Fu Yak Hacker

7174 Posts

Posted - 2012-12-20 : 16:34:27
Cross posting
http://social.msdn.microsoft.com/Forums/en/transactsql/thread/78af1c31-4ef1-4518-a40e-4e5477d6f67b
Go to Top of Page

ovc
Starting Member

35 Posts

Posted - 2013-01-02 : 17:07:12
why would you plan such a horrible job and not use an alternative?
Is the transaction log or the database files themselves to big?
If you want exclusive access to one database you can try to use
alter database set single_user (with rollback immediate)
Go to Top of Page
   

- Advertisement -