If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Database Server Software > DB2 > Trigger invocation during replication

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 02-09-06, 00:02
forjim forjim is offline
Registered User
 
Join Date: Feb 2006
Posts: 2
Trigger invocation during replication

I am trying to replicate two tables from host A to host B.

I have defined after insert/update triggers on these two tables tableA and tableB. I want these triggers for these two tables to be invoked during replication. Also I want tableA to be replicated first as triggers for tableB depends on data from tableA.

The replication works fine, but triggers are not invoked at all.

Please let me know the solution for this problem.

Thanks in advance
Sam
Reply With Quote
  #2 (permalink)  
Old 02-09-06, 02:48
przytula przytula is offline
Registered User
 
Join Date: Nov 2004
Posts: 374
triggers

triggers are independent from replication
if an insert /update occures, the trigger should fire.
apply is executing insert-delete-update statements
if you mean after sql statements defined by replication, these are regular statements and not triggers, that fire after the apply finishes a cycle.
if you want to keep the sequence of operation as on source, there is a setting in apply - transaction based... this will respect the order
__________________
Best Regards, Guy Przytula
DB2/ORA/SQL Services
DB2 DBA & Advanced DBA Certified
DB2 Dprop Certified
http://users.skynet.be/przytula/dbss.html
Reply With Quote
  #3 (permalink)  
Old 02-09-06, 09:36
forjim forjim is offline
Registered User
 
Join Date: Feb 2006
Posts: 2
triggers in replication

Acctually the replication uses load mechanism for tableB and import mechanism for tableA. So the trigger gets fired for tableA, but not for
tableB (because load doesn't fire trigger). However I want both triggers
to get fired and also I want to replicate tableA first and tableB first.
So that trigger for tableA fires first as trigger from tableB depends on
data from tableA.

I will appreciate if you can provide a solution for my requirement.

Thanks in advance
Reply With Quote
  #4 (permalink)  
Old 02-09-06, 10:12
sathyaram_s sathyaram_s is offline
Super Moderator
 
Join Date: Aug 2001
Location: UK
Posts: 4,534
You should be able to put the trigger logic into a SQL stmt or a Stored Proc and run after each subscription-set processing cycle.

HTH

Sathyaram

Quote:
Originally Posted by forjim
Acctually the replication uses load mechanism for tableB and import mechanism for tableA. So the trigger gets fired for tableA, but not for
tableB (because load doesn't fire trigger). However I want both triggers
to get fired and also I want to replicate tableA first and tableB first.
So that trigger for tableA fires first as trigger from tableB depends on
data from tableA.

I will appreciate if you can provide a solution for my requirement.

Thanks in advance
__________________
Visit the new-look IDUG Website , register to gain access to the excellent content.
Reply With Quote
  #5 (permalink)  
Old 02-09-06, 10:21
przytula przytula is offline
Registered User
 
Join Date: Nov 2004
Posts: 374
trigger

whenever apply applies the modifications, it uses regular statements
is this the initial load ?
do the initial load manually with import and let apply keep the tables maintained
__________________
Best Regards, Guy Przytula
DB2/ORA/SQL Services
DB2 DBA & Advanced DBA Certified
DB2 Dprop Certified
http://users.skynet.be/przytula/dbss.html
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On