How can I run the snapshot agent of a publication from within a custom job in
one step?
I have a snapshot publication that will execute on demand. A custom job will
initiate this process, but the custom job needs to be able to wait until the
snapshot agent is finished as it will do many other things after. I know I
can start the snapshot agent by using the sp_start_job sproc but this will
simply start the process and will not wait until it finishes.
One option I know I have is to copy the 3 steps below which are inside the
auto-generated snapshot job and add them to my custom job as 3 steps.
StepName
1.Snapshot Agent startup message.
2.Run agent.
3.Detect nonlogged agent shutdown.
However, I would prefer to perform all of this in one step to simplify
things which is why I am asking if any of you know if this is even possible.
Thanks for any assistance you can provide.
P.S - FYI, I am using snapshot replication for this w/ SQL Server 2005.
- Johnny
Johnny,
I have achieved the same result by appending my step to the end of the
snapshot job's steps, which is essentially the same as what you suggest.
This was the only way I could ensure the correct order of processing, apart
from polling the state of the job. So, I'd recommend you reproducing the job
steps in your new task.
Cheers,
Paul Ibison SQL Server MVP, www.replicationanswers.com
(recommended sql server 2000 replication book:
http://www.nwsu.com/0974973602p.html)
|||Thanks Paul. This confirms reproducing the steps is the best way to go. This
will end up being a 10+ step job.
Johnny
"Paul Ibison" wrote:
> Johnny,
> I have achieved the same result by appending my step to the end of the
> snapshot job's steps, which is essentially the same as what you suggest.
> This was the only way I could ensure the correct order of processing, apart
> from polling the state of the job. So, I'd recommend you reproducing the job
> steps in your new task.
> Cheers,
> Paul Ibison SQL Server MVP, www.replicationanswers.com
> (recommended sql server 2000 replication book:
> http://www.nwsu.com/0974973602p.html)
>
>
No comments:
Post a Comment