February 21, 2019 at 11:00 am
Hello,
We have two snapshot replication job running from two different server (domain).
UAT - Snapshot 1
DEV - Snapshot 2.
We need to run Snapshot job 2 on DEV only when Snapshot 1 completes on UAT. Both servers are configured through linked server using SQL account. Can anyone please help?
Thanks for your help in advance.
February 21, 2019 at 11:07 am
I had to do something similar. I ended up having job2 (that's dependant on job1) scheduled to run at frequent intervals, the first step would test the latest row on a table. If the row was from job1, job2 would run, if it wasn't it would not go on to the next step. When job2 started it would write a row to the table so it wouldn't run again until job1 had run again.
February 21, 2019 at 11:18 am
one other option is for the job that does the first snapshot to start the second job on the other server as the last step on the job.
February 21, 2019 at 11:20 am
frederico_fonseca - Thursday, February 21, 2019 11:18 AMone other option is for the job that does the first snapshot to start the second job on the other server as the last step on the job.
Would it be possible for you to provide any script for that?
February 21, 2019 at 11:38 am
EasyBoy - Thursday, February 21, 2019 11:20 AMfrederico_fonseca - Thursday, February 21, 2019 11:18 AMone other option is for the job that does the first snapshot to start the second job on the other server as the last step on the job.Would it be possible for you to provide any script for that?
Sorry - don't have any that I can supply.
February 21, 2019 at 11:56 am
EasyBoy - Thursday, February 21, 2019 11:20 AMfrederico_fonseca - Thursday, February 21, 2019 11:18 AMone other option is for the job that does the first snapshot to start the second job on the other server as the last step on the job.Would it be possible for you to provide any script for that?
You need to setup a linked server to execute a job on another server. Or use Powershell. Or use sqlcmd. Or use SSIS, etc
For a linked server, you would need to enable RPC for the linked server and setup the security context to support executing the job.
Then you would just call it using:
EXEC LinkedServerName.msdb.dbo.sp_start_job 'YourJobNameOnLinkedServer'
Sue
February 21, 2019 at 12:40 pm
Sue_H - Thursday, February 21, 2019 11:56 AMEasyBoy - Thursday, February 21, 2019 11:20 AMfrederico_fonseca - Thursday, February 21, 2019 11:18 AMone other option is for the job that does the first snapshot to start the second job on the other server as the last step on the job.Would it be possible for you to provide any script for that?
You need to setup a linked server to execute a job on another server. Or use Powershell. Or use sqlcmd. Or use SSIS, etc
For a linked server, you would need to enable RPC for the linked server and setup the security context to support executing the job.
Then you would just call it using:
EXEC LinkedServerName.msdb.dbo.sp_start_job 'YourJobNameOnLinkedServer'Sue
Thanks for your quick help. It works for me.
Just add at last step of the first job
EXEC LinkedServerName.msdb.dbo.sp_start_job 'YourJobNameOnLinkedServer'
Viewing 7 posts - 1 through 6 (of 6 total)
You must be logged in to reply to this topic. Login to reply