SQL Server Forums
Profile | Register | Active Topics | Members | Search | Forum FAQ
 
Register Now and get your question answered!
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 SQL Server 2008 Forums
 SQL Server Administration (2008)
 How to run A SQL Job Of Restart Of Server, SQL Ser
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

David92595
Starting Member

USA
8 Posts

Posted - 12/20/2012 :  14:54:20  Show Profile  Reply with Quote
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
Flowing Fount of Yak Knowledge

USA
7174 Posts

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

ovc
Starting Member

Romania
35 Posts

Posted - 01/02/2013 :  17:07:12  Show Profile  Reply with Quote
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
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
SQL Server Forums © 2000-2009 SQLTeam Publishing, LLC Go To Top Of Page
This page was generated in 0.08 seconds. Powered By: Snitz Forums 2000