Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Trigger invocation during replication

Status
Not open for further replies.

forjim

Programmer
Feb 8, 2006
2
0
0
US
I have insert/update triggers defined on two tables tableA and tableB. I want both trigger to be invoked during replication. Also I want tableA to be replicated first because trigger from tableB depends on data from tableA.

Right now, both tables are being replicated without triggers invocation.

What is the solution for getting these triggers invoked during replication with tableA first and tableB later?

Thanks for your time and reply...
Sam
 
Sam,

It's possible to define both tables in differnet subscription sets. Then using event based replication you can post an event on IBMSNAP_SUB_EVENT table. First for A, when your satisfied A has finished, then post an event for B.

I'm a little unsure about your overall approach, as I don't know if triggers fire, on replicated tables. I see no reason why not, its just I have not done it.

Also, is the Table which you replicate over, going to be suitable for your table b trigger, if it's just a point in time, as some states on A, may well be lost, when you try to replicate B through.

Not knowing your full requiremnets I am wondering can you not just event based replicate both subsription sets, without firing the triggers? Or do the triggers need to remain o nthe target for some other purpose.

Cheers
Greg

 
Hi Greg

We have two databases A and B. There is replication setup from A to B during normal business work. However if there
is something wrong, then they have setup a cold start replication which basically copies everything from A to B.
I have two tables tableA and tableB on both databases A and B. Also I have triggers for both these tables.

When the cold start replication happens, it copies data in tableB with load and tableA with import. The trigger gets fired for import but not for load. So i asked dba to change tableB for import. According to him, the order of import isn't fixed. But i want to make sure tableA is imported first.

how can i do this?

thanks in advance
Thanks
Sam
 
Sam,

I'm surprised by this. I was under the impressions from my current system that replication refreshes the total contents of the all target tables, when using CAPTURE COLD. Not sure why it would do one in a certain way and the other in a different way.

I feel you can accomplish this timing issue with 2 event based subscription sets, where perhaps you only post an event when you go to cold start mode. Then once your happy the first has replicated, you post another event to replicate the second table.

Ask your DBA to look into event based replication, over and above what your current normal processing is doing.

Try looking around here for further info


Cheers
Greg
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top