Using GoldenGate eventactions to customize processing

Source: Internet
Author: User

Eventactions can specify a number of keywords to trigger some events, the keywords are: IGNORE, DISCARD, ABORT, STOP, SHELL, TRACE, LOG

For Example:ggsci (ZBDBA1) 6> view param ext1extract ext1setenv (Nls_lang = American_america. ZHS16GBK) USERID Ogg,password oggddl &include MAPPED OBJTYPE ' TABLE ' &include MAPPED OBJTYPE ' Idnex ' &include MAPPED OBJTYPE ' SEQUENCE ' &include MAPPED OBJTYPE ' VIEW ' &include MAPPED OBJTYPE ' PROCEDURE ' &include MAPPED O Bjtype ' FUNCTION ' &include MAPPED OBJTYPE ' package ' &include MAPPED OBJTYPE ' materialized VIEW ' &exclude Optyp E commentddloptions addtrandata nocrossrename reportreportcount every 1 minutes,ratediscardfile./dirrpt/EXTSA. Dsc,append,megabytes 1024THREADOPTIONS maxcommitpropagationdelay 60000 iolatency 60000DBOPTIONS Allowunusedcolumnwarnlongtrans 2h,checkinterval 3Mexttrail./dirdat/safetchoptions nousesnapshot,fetchpkupdatecols , Missingrow reporttable zbdba.test; Ggsci (ZBDBA1) 7> view param ext2extract ext2passthrurmthost 192.168.56.61,mgrport 7839,compressrmttrail./dirdat/ Satable zbdba.test; Ggsci (ZBDBA2) 6> view param rep1replicatRep1assumetargetdefsuserid ogg, PASSWORD oggdiscardfile./dirdat/rep1_discard.txt,append,megabytes 5DDL INCLUDE Mappedddloptions report--batchsqldboptions deferrefconstdboptions lobwritesize 102400HANDLECOLLISIONSDDLERROR DEFAULT DISCARD retryop maxretries 5 retrydelay 20--grouptransops 1--maxtransops 1APPLYNOOPUPDATESMAP zbdba.test, TARGET Zbdba.test,filter (@STREQ (OWNER, "Zbdba"), Eventactions (IGNORE TRANS, STOP, SHELL "/ogg/hello.sh");
This specifies that when the owner field in the test table is ZBDBA city, the transaction is ignored, the replicat process is stopped, and the shell script executes.


So let's test it out:

source:sql> INSERT INTO Test (owner,table_name) VALUES (' Zbdba ', ' zbdba '); 1 row created. Sql> commit  2  ; Commit complete.

target:tail-100f ggserr.log2015-03-09 22:51:01 INFO OGG-00996 Oracle GoldenGate Delivery for Oracle, Rep1.prm:REPL ICAT REP1 started.2015-03-09 22:51:37 WARNING OGG-00869 Oracle GoldenGate Delivery for Oracle, Rep1.prm:No unique key is defined for table ' TEST '.  All viable columns'll be used to represent the key, and may not guarantee uniqueness. Keycols May is used to define the key.2015-03-09 22:51:37 INFO OGG-01286 Oracle GoldenGate Delivery for Oracle, REP1. prm:executing shell command '/ogg/hello.sh ' due to shell event for target table ZBDBA.  TEST in file/ogg/dirdat/sa000004, RBA 1314.2015-03-09 22:51:37 INFO OGG-01287 Oracle GoldenGate Delivery for Oracle, rep1.prm:Successfully executed shell command '/ogg/hello.sh '. 2015-03-09 22:51:37 WARNING OGG-01283 Oracle GoldenGate Delivery for Oracle, the rep1.prm:Stopping process due to the STOP event for target table ZBDBA. TEST in file/ogg/dirdat/sa000004, RBA 1314 STOP request pending end-of-transaction (1Records so far). 2015-03-09 22:51:37 INFO OGG-00994 Oracle GoldenGate Delivery for Oracle, Rep1.prm:REPLICAT REP1 St Opped normally.

Discovery process stops and executes script
To view a process:

Ggsci (ZBDBA2) 7> info allprogram     Status      Group       Lag at chkpt time  Since chkptmanager     RUNNING                                          Replicat    STOPPED     REP1        00:00:06      00:07:59   
To view the script:

[[email protected] ogg]$ cat Hello.sh#!/bin/bashtouch zbdba.txt[[email protected] ogg]$ ll zbdba.txt-rw-rw-rw-1 ogg Oinst All 0 Mar  9 22:51 zbdba.txt




Using GoldenGate eventactions to customize processing

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.