OGG and firing triggers

Hi,
I am designing and implementing OGG to replicate a set of about 200 tables from a master system to two target systems. Updates to these tables only occur on the master system so this is a 1:n uni-directional situation. The master and target systems are all Oracle.
Some or all of the target tables have triggers on them. For 95% of the tables, we don't want the triggers to fire when GG replicates to the table. This is easily accomplished by using the SUPPRESSTRIGGERS subparameter of the DBOPTIONS parameter in the replicat parameter file. So, I set up one extract/pump/replicat process to replicate the data to these tables.
Of the remaining 5% of the tables, most of the time we want the triggers to fire on the target systems when data is replicated to the target table. Again this is easily accomplished by setting up another extract/pump/replicat process with DBOPTIONS NOSUPPRESSTRIGGER.
There are a couple of tables on the target systems which have more than one trigger and we want one of the triggers to fire when replicating but not the other ones. I believe that I can partly accomplish this by putting a SQLEXEC on the MAP statement for these tables which issues an ALTER TRIGGER <schema.trigger>; DISABLE. The documentation says this SQLEXEC will run before the data is replicated to the target table so the trigger will be disabled when the replication happens.
My problem is... How do I enable the trigger again once I have replicated data to the target table? I don't think it's possible to have a SQLEXEC run after the replication happens. Is that true?
I have considered simply disabling the triggers when replication starts with a standalone SQLEXEC statement that runs when replication starts and enabling them using SQLEXEC ONEXIT to enable the triggers again when replication stops. this will work but I'm not sure my customer will buy this solution.
Thanks a lot for any help you can provide.

I've figured out how to do this. Start the replicat with DBOPTIONS SUPPRESSTRIGGERS specified. Then run a standalone SQLEXEC which executes the following stored procedure call for each trigger you want to have fire: dbms_ddl.set_trigger_firing_property(<trigger_owner> '<trigger_name>', FALSE);
I have a set of eight triggers I want to fire so I created a simple stored procedure that executes this SP for each of my triggers. It could probably be done inline in the replicat parameter deck too.
Also, I have a second SP which I call using SQLEXEC ON EXIT. This disables all the triggers I enabled at the beginning.
Looking at ALL_TRIGGERS at the FIRE_ONCE column/property will tell you what state a trigger is in. Ironically, NO means the the trigger will fire and YES means it will not.

Similar Messages

  • After and before triggers

    My doubt is about the execution of triggers
    I have a table T1
    create table T1
    +(ID1 number(9,2) primary key,+
    NAME1 VARCHAR2(100)) ;
    It has following 2 rows.
    insert into t1 values (1,'sandeep')
    insert into t1 values (2,'tom')
    commit;
    I have following 4 triggers
    create or replace
    TRIGGER TRIGGER1_before_statement
    before update on T1
    begin
    dbms_output.put_line('fired before statement');
    END;
    create or replace
    trigger TRIGGER_BEFORE_EACHROW
    before update on T1 for each row
    begin
    DBMS_OUTPUT.PUT_LINE('fired before each row');
    END;
    create or replace
    TRIGGER TRIGGER_after_eachrow
    after update ON T1
    FOR EACH ROW
    begin
    DBMS_OUTPUT.PUT_LINE('fired trigger after eachrow');
    END;
    create or replace
    trigger TRIGGER1_AFTER_STATEMENT
    after update on T1
    begin
    dbms_output.put_line('fired after statement');
    END;
    i ran the following script
    SET SERVEROUTPUT ON;
    begin
    update T1 set T1.ID1=1 where T1.ID1 = 2;
    end;
    This update statement will fail because it violates the primary key constraint on the table.
    During execution of the update statement, i expect only the before statement and row triggers to fire because after triggers will be fired after execution of the statement and in this case the update execution has failed.
    But the output i am getting is
    fired before statement
    fired before each row
    fired trigger after eachrow
    which means the after TRIGGER_after_eachrow has also fired but my update statement has failed and TRIGGER_after_eachrow should fire only after updating the rows.
    Why this trigger was fired? If oracle processes all the triggers even if the triggerig statement fails, then why TRIGGER1_AFTER_STATEMENT was not fired.
    Thanks in advance.

    Hi Sandeep,
    While trying to search for the answer to your after trigger execution related issue, I got below from asktom site where I got a discussion regarding the same topic.
    http://asktom.oracle.com/pls/asktom/f?p=100:11:0::::P11_QUESTION_ID:29259877603106
    Below is the exact question post by one member and answer by tom in it.
    I thought
    Here is some sample which shows that after row statement fires event though the integrity
    constraint check should have failed first.
    Me and my colleagues are confused with the definition found at
    http://download-uk.oracle.com/docs/cd/B19306_01/server.102/b14220/triggers.htm#sthref3288
    drop table emp;
    drop table dept;
    -- Create table
    create table DEPT
      ID    NUMBER not null,
      name VARCHAR2(100)
    alter table DEPT add primary key (ID);
    create table EMP
      ID      NUMBER not null,
      NAME    VARCHAR2(100),
      DEPT_ID NUMBER
    alter table EMP
      add primary key (ID);
    alter table EMP
      add constraint EMP_DEPT_FK foreign key (DEPT_ID)
      references DEPT (ID);
    create or replace trigger EMP_AFT_INS_ROW_TRG after insert on emp  for each row
    declare
        n number;   
    begin
        select 1 into n from dept where dept.id = :new.dept_id;
    exception
        when no_data_found then
            raise_application_error(-20001, 'No such department');
    end;
    insert into dept(id, name) values (1,'First department');
    commit;
    insert into emp (id, name, dept_id) values (101, 'First employee', 1);
    commit;
    rem here I expect a foreign key violation message instead of 'No such department' application error
    insert into emp (id, name, dept_id) values (102, 'Second employee', 2);
    commit;
    Followup   September 5, 2006 - 5pm Central time zone:
    constraints technically are validated AFTER the statement executes - it is not really defined
    whether a trigger will or will not fire (and if you have logic that depends on such intricate
    ordering, we have a really big logic problem)
    but a for each row trigger - sure, because tables are allowed to violate their constraints during
    the DML, think about this:
    update emp set empno = empno+1;
    every row updated could temporarily violate uniqueness as there could be two empno =2, empno=3 and
    so on as this goes through row by row. May be its useful to you..
    Regards,
    Dipali..

  • No commit and error triggers

    Hi,
    In OWB 10.1.0.4.0 , I see a parameter NO COMMIT and ERROR TRIGGERS in mapping configuration properties - code generation options. i was not able to find any details regarding this.
    Can anyone tell me the function of these two parameters.?

    Error Trigger - Name a procedure to be fired when map fail. You may want to execute some DDL's here.
    I don't know the NO COMMIT parameter. Usualy, when you click in the parameter you can see a brief description of that parameter in the lower part of the conf. widow.
    Isn't there any for this NO COMMIT?
    Regards
    Marcos

  • Adding multiple 100% width slideshows to the top of a page and using triggers to select.  Is it possible???

    Hi!
    I am looking to create a changeable slideshow at the top of a webpage. I want to be able to select different slideshows to view at the top of the page and use triggers/buttons to select the relevant slideshow. This is for a catering site, so I would like that if the user clicks 'canapes' button the slideshow images at the top of the page will show canapes and the caption will show text about them, if they select the 'cocktails' button then a new slideshow will appear showing images of cocktails together with a relevant caption. 
    I thought this might be possible by placing slideshows within a lightbox or composition widget but seem to be banging my head against the wall! Can someone help?
    Is it possible?
    If yes, is there a youtube video to show how its done?
    Any help much appreciated.
    Martin

    Is it possible? Yes... I wouldn't do it because having all those images sitting on the one (first) page will slow the page loading times down and just piss people off but thats your main answeer.
    The compositions widgets allow you to build more complex ideas and is what I'd use to make this sort of thing in Muse...
    p.s. if you just want something fast then have a look at what some people have already made to get ideas;
    1. Templates – MuseLayers
    2. iChef | Culinary Arts Adobe Muse Template | museGrid.com
    3. RESOURCES | Adobe Muse CC

  • OGG and FLAC suppo

    Is there going to be firmware at any point that will allow for flac and ogg files to be read by the Zen Micro?

    zandrox,
    get notmad. one of the features it has is to convert ogg and flac files one the fly. you can't play those file formats on your player, but at least you can still use them without having to convert before putting them on

  • Ogg and aac

    Hi there,
    I have some ogg and aac files which appear to play fine in VLC and not importable into itunes.  what are my options for converting them?

    Hi there,
    I have some ogg and aac files which appear to play fine in VLC and not importable into itunes.  what are my options for converting them?

  • Difference Between Port Forwarding and Port Triggering.

    Hi guys,
    I'm lost! The differences between port forwarding and port triggering is driving me nuts! It all seems very subtle to me. Can anyone explain to me (in a very simple way) what exactly are their differences. Thanks in advance!!

    Port Forwarding
    The big difference between this and port triggering is that forwarding is fixed.. you forward a port and it is always forwarded.. IE available to connection.. basically the forwarded port is excluded from the fire walling abilities of the router.  Second it is static and applies to one machine only. Whereas you could set port triggering to the router and thereafter any machine on the LAN can trigger it unless its already in use.. port forwarding must be specified for each individual machine.
    Port forwarding requires you to give each PC on the network its own unique static IP address.. Although there is ssh port forwarding that can be set dynamically. Most users only have the option of static ip port forwarding.
    The real downside of port forwarding is that it can be very tricky to set up... You may have to allow a series of ports on a machine and have to do that for each machine you want to allow through. Also routers often have limited abilities and may not allow you the ability to forward a port or select the service you require.
    Port Triggering
     This is a way of Dynamically assigning a service to a port WHEN it is required by an outgoing service. The port is initially not allowed so nothing can get in and you are protected by your network.  
    A good example of this is when using Yahoo! voice .. the voice works fine for a few minutes after you connect to Yahoo! then Yahoo! sends some kind of packet that requires a response from your PC... The packet is allowed in through your router no prob but the outgoing reply is not authorized to open a port on the router and is thus blocked. 
    'ope this helps

  • External in and out triggers on pxi 6541

    I need to use both trigger-in and trigger-out events.  It appears there is only one front panel port, i.e. SMB PFI<0>.  If I use that port for the trigger-in, what options are there to get a trigger-out signal out of the box (not pxi bus)?
    Solved!
    Go to Solution.

    The PXI 6541 actually has four PFI lines which can be used for importing and exporting triggers - though as you've determined, only PFI 0 has a direct front panel connection.  The others (PFI 1-3) are accessible through the Digital Data & Control port, and thus can be easily accessed when using either the CB-2162 or SMB-2163 connector block (or any similar breakout for the DDC port):
    http://www.ni.com/pdf/manuals/370369b.pdf
    http://www.ni.com/pdf/manuals/373660d.pdf
    Hope this helps!
    James M.  |  Applications Engineer  |  National Instruments
    James M. | Applications Engineer | National Instruments

  • Hiring and firing on same day

    Hi,
    I'm SAP certified fresher.I've a question.Is it possible hiring and firing on same day? If yes how? if no why?
    Kindly help me.
    Regards,
    Prasath.

    hello.
    Yes,we can run 2 actions hiring and firing on a single day. for that check ur action type in t529a table. and check the boxes under - u( ,hiring action) and u(u0302,additional action).and for firing plz default feature msn20.and mention it in a same table t529a.
    but u can not run both d action at a time. u have to rum both a actions separately.
    regards.
    sudha.

  • Key-up and down triggers not firing

    I have a multi-record block and want to go to the previous and next records in it when the user presses the up and down arrow keys. I thought this was default behavior, but the keys didn't do anything so I tried putting key-up and key-down triggers on the block. They don't fire at all when I press the up and down arrow keys. The debug messages confirm that nothing happens at all when these keys are pressed. I tried putting form-level triggers on, and they don't fire from that block either, although they do fire from another single-record block.
    I'm thinking maybe it is just some block property that I have not set correctly, but I can't see anything obvious when looking through the properties. I have the Navigation Style set to Change Record, but have tried the other options and nothing changed. The records do cycle through using the <Tab> key.
    Any help is appreciated.
    Thanks,
    Ben
    null

    I'm not running web. I went ahead and tried setting num lock off anyway, but it didn't make any difference. Thanks for the suggestion.
    Ben
    <BLOCKQUOTE><font size="1" face="Verdana, Arial">quote:</font><HR>Originally posted by vijay kumar ([email protected]):
    Are u running ur application in web?
    Try the numeric arrow keys (set num lock off)
    <HR></BLOCKQUOTE>
    null

  • Query regarding creating a Custom Event and Firing.

    I have created a custom event,a custom listener and a custom button.
    But when I click on custom button,my event is not being fired.
    When and how do I need to invoke the fireEvent() ?
    Please can any body tell me if I have overlooked any thing ?
    Thanks,
    // 1 Custom Event
    import java.util.EventObject;
    public class MyActionEvent extends EventObject{
            public MyActionEvent(Object arg0) {
         super(arg0);
    // 2 Custom Listener
    import java.util.EventListener;
    public interface MyActionListener extends EventListener {
          public void myActionPerformed(MyActionEvent myEvent);
    // 3 Custom Button
    public class MyButton extends JButton {
        // Create the listener list
        protected javax.swing.event.EventListenerList listenerList = new javax.swing.event.EventListenerList();
          public MyButton(String str){
         super(str);
         public void addMyActionEventListener(MyActionListener listener) {
             listenerList.add(MyActionListener.class, listener);
        protected void fireMyActionEvent() {
            MyActionEvent evt = new MyActionEvent(this);
            Object[] listeners = listenerList.getListenerList();
           for (int i = 0; i < listeners.length; i = i+2) {
                 if (listeners[i] == MyActionListener.class) {
                      ((MyActionListener) listeners[i+1]).myActionPerformed(evt);
    } // end of class MyButton.
    // 4 Test my Custom Event,Listener and Button
    public class MyButtonDemo extends JPanel {
        protected MyButton b1;
        public MyButtonDemo() {
            b1 = new MyButton("Disable Button");
            b1.setToolTipText("Click this button to disable the middle button.");
            b1.addMyActionEventListener(new MyActionListener() {
         @Override
         public void myActionPerformed(MyActionEvent myEvent) {
         System.out.println("My ActionEvent....");
            add(b1);
        private static void createAndShowGUI() {
            JFrame frame = new JFrame("ButtonDemo");
            frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
            MyButtonDemo newContentPane = new MyButtonDemo();
            newContentPane.setOpaque(true);
            frame.setContentPane(newContentPane);
            //Display the window.
            frame.pack();
            frame.setVisible(true);
        public static void main(String[] args) {
            javax.swing.SwingUtilities.invokeLater(new Runnable() {
                public void run() {
                    createAndShowGUI();
    }

    Hi Stan,
    I would like to use my custom action listener rather that using the the normal actionPerformed(ActionEvent e)
    But some how this event is not being fired.
    Any suggestions to fire this?
    b1.addMyActionEventListener(new MyActionListener() {
             @Override
             public void myActionPerformed(MyActionEvent myEvent) {
         System.out.println("My ActionEvent triggered....");
    });

  • How to use multiple counters in the 6602 to measure cycle length, calculate delay and generate triggered pulse.

    Hi,
    I need to measure the cycle length of a pulse, calculate a delay based on this value, and then generate a triggered pulse with that delay value. The input and output pulses will be continuous. The best case would be to use the cycle length from one pulse in the calculated delay for the next pulse. One of my biggest problems has been getting the calculated delay value into the pulse specs.vi for the triggered output.
    This output pulse will be used to trigger an IMAQ video acquisition; therefore, the solution to this problem will be part of a larger video acquisition application. This has posed a problem, in that accessing the counters has interfe
    red with the triggered video acquisition.
    Any suggestion will be welcome.
    Thanks
    Dave

    Filipe,
    The overhead is the problem I'm trying to get around.
    Specifically, what I need to do is to generate an output pulse after a trigger pulse, which is a given percentage of the cycle length. The input pulse is from heart rate, so it will have some variance, and the output pulse will be at a stationary point in the cardiac cycle. For example, for an input pulse of 2 Hz (500 ms) the user would likely request the output pulse be delayed by 75%. Therefore, the generated pulse will have a 375ms delay after the trigger.
    In the past I have had hardware built to do this, but I am hoping I can accomplish the same thing with multiple counters on the 6602. I have been able to accomplish this with 3 counters (2 to measure period and 1 for output
    ) but the overhead prevents adequate triggering of the IMAQ video acquisition. I am hoping another method would solve this problem.
    Thanks
    Dave

  • Before and after triggers

    just can somebody clarify
    when we say
    create or replace trigger tn before/after insert/update/delete for each row/statement
    i just want to know what i can do with a before trigger which i cannot do with a after trigger and viceversa

    <BLOCKQUOTE><font size="1" face="Verdana, Arial, Helvetica">quote:</font><HR>Originally posted by sushant prabhu:
    i just want to know what i can do with a before trigger which i cannot do with a after trigger and viceversa<HR></BLOCKQUOTE>
    Before row triggers can modify column values (:new.column := value) before the row is originally written to disk. I don't think after row triggers can modify :new values. Before row triggers can't see the row's rowid, at least not for inserts, but after row triggers always can.
    Statement triggers can modify the triggering table, but row triggers can't. Statement triggers can't tell what rows are touched, but row triggers are called once per row touched and can see :old and :new values for that row.
    null

  • Interesting issue with Logical Standby and database triggers

    We have a Logical Standby that each month we export (expdp) a schema (CSPAN) that is being maintained by SQL Apply and import (impdp)it to a 'frozen copy' (eg CSPAN201104) using REMAP_SCHEMA.
    This works fine although we've noticed that because triggers on the original schema being exported have the original schema (CSPAN) hard-referenced in the definition are imported into and owned by the new 'frozen' schema but are still 'attached' to the original schema's tables.
    This is currently causing the issue where the frozen schema trigger is INVALID and causing the SQL Apply to fail. This is the error:
    'CSPAN201104.AUD_R_TRG_PEOPLE' is
    invalid and failed re-validation
    Failed SQL update "CSPAN"."PEOPLE" set "ORG_ID" = 2, "ACTIVE_IND" = 'Y', "CREATE_DT" = TO_DATE('22-JUL-08','DD-MON-RR'),"CREATOR_NM" = 'LC', "FIRST_NM" = 'Test', "LAST_PERSON" ='log'...
    Note: this trigger references the CSPAN schema (...AFTER INSERT ON CSPAN.PEOPLE...)
    I suspect that triggers on a SQL Apply Maintained schema in a Logical Standby do not need to be valid (since they do not fire) but what if they reference a SQL Apply schema but are 'owned' by a non-SQL Apply schema? This trigger references a SQL Apply table so it should not fire
    This is 10gR2 (10.2.0.4) on 64 bit Windows.
    Regards
    Graeme King

    OK, I've finally got around to actually test this and it looks like you are not quite correct Larry in this statement...
    'Since this trigger belongs to a new schema that is not controlled by SQL Apply (CSPAN201105) it will fire. But the trigger references a schema that is controlled by SQL Apply (CSPAN) so it will fail because it has to be validated.'
    My testing concludes that even though the trigger belongs to a schema CSPAN201105 (not controlled by SQL Apply) and references a schema controlled by SQL Apply - it does not fire. However it DOES need to be valid or it breaks SQL Apply.
    My testing was as follows:
    Primary DB
    Create new EMP table in CSPAN schema on Primary
    Create new table TRIGGER_LOG in CSPAN schema on Primary
    Create AFTER INSERT/UPDATE trigger on CSPAN.EMP table (that inserts into TRIGGER_LOG table)
    **All of the above replicates to Standby**
    Standby DB
    Create new table TRIGGER_LOG_STNDBY in CSPAN201105 schema on Primary
    Create new trigger in CSPAN201105 schema that fires on INSERT/UPDATE on CSPAN.EMP but that inserts into CSPAN201105.TRIGGER_LOG_STNDBY table)
    Primary DB
    Insert 4 rows into CSPAN.EMP
    Update 2 rows in CSPAN.EMP
    TRIGGER_LOG table has 6 rows as expected
    Standby DB
    TRIGGER_LOG table has 6 rows as expected
    TRIGGER_LOG_STNDBY table has **0 rows**
    Re-create trigger in CSPAN201105 schema that fires on INSERT/UPDATE on CSPAN.EMP but that inserts into CSPAN201105.TRIGGER_LOG_STNDBY table) **but with syntax error**
    Primary DB
    Update 1 row in CSPAN.EMP
    TRIGGER_LOG table has 7 rows as expected
    Standby DB
    SQL Apply is broken - ORA-04098: trigger 'CSPAN201105.TEST_TRIGGER_TRG' is invalid and failed re-validation

  • I will be working on a project to migrate from Sybase ASE (15.7) to SQL Server 2014 using Oracle golden gate........I am trying to find documentation which can guide me to use a separate box installation of OGG and how to configure it for Sybase and SQL s

    Hi,
    I need guide to install OGG on a separate box which will help me to migrate Sybase to SQL server.
    Viral Dave

    hi - just an fyi
    we have SQL Server 2012 and from my reads and understanding OGG supports SQL Server up to 2008. not to say it wouldn't work on higher versions if installed. in the link above check out the SQL Server installation chapter. before purchasing the license I would contact Oracle.
    maybe someone here has installed it on a higher version and got it to work. we are currently working on setting up OGG to work on Oracle to Oracle servers.

Maybe you are looking for

  • Lost Time Machine and Network when Network Cable Unplugged Briefly

    Hi, I rearranged my desk and unplugged time machine (airport) from my network. When I plugged it back in it had gone to default settings with no sign of my previous network. I had to set up a whole new network and set up time machine as if it was new

  • Error while converting data from CATS to CO

    Hi Experts, We are transferring the HR timesheet data to CO.while uploading the time sheet data to CO through transaction code ZAFU we are getting the following error.Any help is greatly appreciated Trans: KB21N | BTCI-Creation_DD_CO_Actual_Activity

  • Someone please help me for the love of god!!!

    I currently have a MBP unibody 15" 2.53 I have all the cables etc etc, I am trying to hook this thing up to my Samsung 46" LCD. I have tried everything and I cannot get it to sync perfectly with my TV. What am I doing wrong? Can someone please tell m

  • Maximum Memory size of Collections

    hi, can anyone please tell me how much data can be stored in a collection. I would be using an Arraylist to store objects created at runtime, but i am not sure how much data can be stored into Arraylist.?? Please reply , Thanks in advance

  • Thesaurus w/ terms in table and selecting hierarchically

    Hello all, I am developing a web application where users must be able to search within a thesaurus and select from a list of thesaurus terms. I tried to set up a prototype similar to the one found in: Oracle Text - Knowlegde base - Use of ABOUT 1. I