Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
 
Log in  ::  Register  ::  Not logged in
 
 
 
        
Home       Members    Calendar    Who's On


Add to briefcase

Trigger distribution job on completion of snapshot job Expand / Collapse
Author
Message
Posted Monday, September 3, 2012 3:19 AM
Grasshopper

GrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopper

Group: General Forum Members
Last Login: Tuesday, September 16, 2014 3:32 AM
Points: 24, Visits: 211
Since 30-Aug, the snapshot agent is running for more than 15mins, the interval between the snapshot & subscriber job is 15mins, time increase could possibly due to increase in data, I saw the snapshot size was near to 7 gigs which usually remained between 5-6 gigs on an average.

Since the Snapshot job didn't complete before the subscriber job started, it didn't find a complete snapshot & failed to replicate the data & became inactive.

I can very well increase the time between both the jobs, but that will just be a temp workaround.

I wanted to check how can this situation be handled. Can a triggers be set that can trigger the distribution job as soon as the snapshot jobs completes.

Apprently, i don't have any working knowledge with triggers, apprecaite if you could provide me with a script or something that I can use to make the Distribution job dependent on Snapshot.

This has become a pain for me, please give me a permanent solution.

Thanks
Asir

Post #1353406
Posted Monday, September 3, 2012 4:01 AM


Ten Centuries

Ten CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen Centuries

Group: General Forum Members
Last Login: Today @ 8:50 AM
Points: 1,337, Visits: 2,627
asir83 (9/3/2012)
Since 30-Aug, the snapshot agent is running for more than 15mins, the interval between the snapshot & subscriber job is 15mins, time increase could possibly due to increase in data, I saw the snapshot size was near to 7 gigs which usually remained between 5-6 gigs on an average.

Since the Snapshot job didn't complete before the subscriber job started, it didn't find a complete snapshot & failed to replicate the data & became inactive.

I can very well increase the time between both the jobs, but that will just be a temp workaround.

I wanted to check how can this situation be handled. Can a triggers be set that can trigger the distribution job as soon as the snapshot jobs completes.

Apprently, i don't have any working knowledge with triggers, apprecaite if you could provide me with a script or something that I can use to make the Distribution job dependent on Snapshot.

This has become a pain for me, please give me a permanent solution.

Thanks
Asir



You can use system stored procedure sp_start_job to start the subscriber job after the snapshot agent has completed. It can be done as :

1. Add a new step of type "Transact-SQL Script" in the Snapshot Agent Job
2. This new step should be the last step to execute after all previous steps have successfully executed
3. Write below command in this step:


EXECUTE msdb.dbo.sp_start_job @job_name='PutSubscriberJobNameHere'


Once this has been configured you can disable the schedule of the subscriber job so that it only runs after snapshot job has completed.



Sujeet Singh
Post #1353421
Posted Monday, September 3, 2012 5:16 AM
Grasshopper

GrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopper

Group: General Forum Members
Last Login: Tuesday, September 16, 2014 3:32 AM
Points: 24, Visits: 211
U da Man...... :)

Bet this is what I was looking for, let me try this...Thanks a lot Buddy, apprecaite ur prompt reply.
Post #1353452
Posted Tuesday, September 4, 2012 12:58 AM
Grasshopper

GrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopper

Group: General Forum Members
Last Login: Tuesday, September 16, 2014 3:32 AM
Points: 24, Visits: 211
Hey,
I have one more question, what if the subscriber is a pull subscription & the job is created on different instance?

How can we call the subscriber job remotely?


Thanks
Asir
Post #1353729
Posted Tuesday, September 4, 2012 1:17 AM


Ten Centuries

Ten CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen Centuries

Group: General Forum Members
Last Login: Today @ 8:50 AM
Points: 1,337, Visits: 2,627
asir83 (9/4/2012)
Hey,
I have one more question, what if the subscriber is a pull subscription & the job is created on different instance?

How can we call the subscriber job remotely?


Thanks
Asir


I think above said stored procedure can be executed via a linked server also. Link servers are not very good when it comes to performance but in this particular case they may be useful.



Sujeet Singh
Post #1353733
Posted Tuesday, September 4, 2012 1:30 AM
Grasshopper

GrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopper

Group: General Forum Members
Last Login: Tuesday, September 16, 2014 3:32 AM
Points: 24, Visits: 211
I see, in that case I have to provide access to MSDB, while creating Linked server.

But thanks for your suggestion, that should work as far as I see.

Thanks Man
Post #1353735
Posted Tuesday, September 4, 2012 4:44 AM
Ten Centuries

Ten CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen Centuries

Group: General Forum Members
Last Login: Tuesday, October 28, 2014 10:45 AM
Points: 1,058, Visits: 2,696
do have your servers running on different id's?.

if it is same id why access change is required?


Regards
Durai Nagarajan
Post #1353801
« Prev Topic | Next Topic »

Add to briefcase

Permissions Expand / Collapse