Re: Start SQLServerAgent job Synchronously
From: Wayne Snyder (wayne.nospam.snyder_at_mariner-usa.com)
Date: 08/09/04
- Next message: jez123456: "Trigger - Urgent"
- Previous message: Enric: "Re: User dbo"
- In reply to: Nathan Holmes: "Start SQLServerAgent job Synchronously"
- Messages sorted by: [ date ] [ thread ]
Date: Mon, 9 Aug 2004 08:00:48 -0400
You could also use SQLDMO, there is a job object and you could check its
completion status...
There is also a tool www.sqlsentry.com which does the kind of thing you are
looking for.
-- Wayne Snyder, MCDBA, SQL Server MVP Mariner, Charlotte, NC www.mariner-usa.com (Please respond only to the newsgroups.) I support the Professional Association of SQL Server (PASS) and it's community of SQL Server professionals. www.sqlpass.org "Nathan Holmes" <Nathan Holmes@discussions.microsoft.com> wrote in message news:91106AB0-1E28-4F2A-BB91-501BA7E8DB93@microsoft.com... > Is there a SQL command that allows you to start a SQLServerAgent job such > that control doesn't return to the caller until after the job has completed? > sp_start_job lets me start a job (self-evidently), but it's an asynchronous > call and the caller resumes processing as soon as the call is made. I want > the caller to wait until after the called job has finished. > > Background: > I have a set of SQLServerAgent jobs, each of which runs a BACKUP DATABASE > statement for a single database. I want to run several of these backups at > around the same time every day. I am assuming it is better to reduce disk > contention by ensuring that only one job runs at once than to let them all > fight it out for I/O at the same time. I thought I could do this by creating > a further 'control' job in SQLServerAgent with a number of steps to call each > backup job in turn, waiting for completion before calling the next job, but > apparently not - unless you can help me. > > Yes, I could combine the existing jobs into a single job or introduce 'best > guess' lags between the job start times, but (a) I like the one job per > database approach because it gives me a one-click way of taking an adhoc > backup and (b) I'd have to keep altering my lag times as the databases grow. > The 'start job, wait, start next job' solution seems so neat that I'd be > surprised if it can't be done. Any help would be greatly appreciated.
- Next message: jez123456: "Trigger - Urgent"
- Previous message: Enric: "Re: User dbo"
- In reply to: Nathan Holmes: "Start SQLServerAgent job Synchronously"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|