September 18, 2008 at 6:20 am
Hallo,
I have a maintenance plan that backs up some databases, but before that, it must call a batch job. This job is called via the 'Operating System (CmdExec)' type job. Problem is that the maintenance plan does not wait for the job task to be finished before starting the backup task. I have tried to use start /wait command in the CmdExec job, but it does not help. The precedence constraint said well that the backup task must wait for the job task to be suceeded. I don't see any setting that indicates that the job task can be said 'suceeded' before the batch is actually completely finished.
Any idea?
I use SQL Server 2005 SP2, entreprise edition
Thanks,
Bruno
September 18, 2008 at 6:34 am
I don't know that you can have the cmdexec tasks wait for completion as it really just fires off the batch and reports complete if there were no errors with the syntax. Since it is firing off a job, you could write some t-sql in the next step to look for that job being completed (or more appropriately, not running) before moving on to the backup step. You could then use the waitfor loop in order to ensure that the job was completed.
I'm sure someone will have something more elegant than what I offered though. 🙂
David
@SQLTentmaker“He is no fool who gives what he cannot keep to gain that which he cannot lose” - Jim Elliot
September 19, 2008 at 1:39 am
Hallo,
Thank you for your answer.
Maybe I just miss some experience with it, but I thought it was quite usual to have some custom tasks (via a batch job) to be done before doing e.g. a backup. A maintenance plan with a CmdExec job task followed by a backup task is apparently not the right technique. What is then for this kind of problems, the usual technique to be used within SQL Server.
Regards,
Bruno
Viewing 3 posts - 1 through 3 (of 3 total)
You must be logged in to reply to this topic. Login to reply