Using GoldenGate EVENTACTIONS to customize processing

EVENTACTIONS 可以指定一些关键字来触发一些事件,关键字有:IGNORE, DISCARD, ABORT, STOP, SHELL, TRACE, LOG

For Example:
GGSCI (zbdba1) 6> view param ext1

EXTRACT EXT1
setenv ( NLS_LANG = AMERICAN_AMERICA.ZHS16GBK )
USERID ogg,PASSWORD ogg
DDL &
INCLUDE MAPPED OBJTYPE 'TABLE' &
INCLUDE MAPPED OBJTYPE 'IDNEX' &
INCLUDE MAPPED OBJTYPE 'SEQUENCE' &
INCLUDE MAPPED OBJTYPE 'VIEW' &
INCLUDE MAPPED OBJTYPE 'PROCEDURE' &
INCLUDE MAPPED OBJTYPE 'FUNCTION' &
INCLUDE MAPPED OBJTYPE 'PACKAGE' &
INCLUDE MAPPED OBJTYPE 'MATERIALIZED VIEW' &
EXCLUDE OPTYPE COMMENT
DDLOPTIONS ADDTRANDATA NOCROSSRENAME REPORT
REPORTCOUNT EVERY 1 MINUTES,RATE
DISCARDFILE ./dirrpt/EXTSA.DSC,APPEND,MEGABYTES 1024
THREADOPTIONS MAXCOMMITPROPAGATIONDELAY 60000 IOLATENCY 60000
DBOPTIONS ALLOWUNUSEDCOLUMN
WARNLONGTRANS 2H,CHECKINTERVAL 3M
exttrail ./dirdat/sa
FETCHOPTIONS NOUSESNAPSHOT,FETCHPKUPDATECOLS,MISSINGROW REPORT
table zbdba.test;

GGSCI (zbdba1) 7> view param ext2

EXTRACT EXT2
passthru
RMTHOST 192.168.56.61,MGRPORT 7839,COMPRESS
RMTTRAIL ./dirdat/sa
table zbdba.test;

GGSCI (zbdba2) 6> view param rep1

REPLICAT rep1
ASSUMETARGETDEFS
USERID ogg, PASSWORD ogg
discardfile ./dirdat/rep1_discard.txt,append,megabytes 5
DDL INCLUDE MAPPED
DDLOPTIONS REPORT
--BATCHSQL
DBOPTIONS DEFERREFCONST
DBOPTIONS LOBWRITESIZE 102400
HANDLECOLLISIONS
DDLERROR DEFAULT DISCARD RETRYOP MAXRETRIES 5 RETRYDELAY 20
--grouptransops 1
--maxtransops 1
APPLYNOOPUPDATES
MAP zbdba.test, TARGET zbdba.test,FILTER (@STREQ (OWNER, "ZBDBA" )), EVENTACTIONS ( IGNORE TRANS , STOP, SHELL "/ogg/hello.sh" );

这里指定当test表中的owner字段为ZBDBA市,就忽略事务,停止replicat进程,执行shell脚本。

那么我们来测试一下:

Source:
SQL> insert into test(owner,table_name) values('ZBDBA','zbdba');

1 row created.

SQL> commit
  2  ;

Commit complete.
Target:
tail -100f ggserr.log
2015-03-09 22:51:01  INFO    OGG-00996  Oracle GoldenGate Delivery for Oracle, rep1.prm:  REPLICAT 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 will be used to represent the key, but may not guarantee uniqueness.  KEYCOLS may be 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, rep1.prm:  Stopping process due to STOP event for target table ZBDBA.TEST in file /ogg/dirdat/sa000004, RBA 1314        STOP request pending end-of-transaction (1 records so far).
2015-03-09 22:51:37  INFO    OGG-00994  Oracle GoldenGate Delivery for Oracle, rep1.prm:  REPLICAT REP1 stopped normally.

发现进程停止并且执行脚本

查看进程:

GGSCI (zbdba2) 7> info all

Program     Status      Group       Lag at Chkpt  Time Since Chkpt

MANAGER     RUNNING
REPLICAT    STOPPED     REP1        00:00:06      00:07:59   

查看脚本:

[[email protected] ogg]$ cat hello.sh
#!/bin/bash
touch zbdba.txt

[[email protected] ogg]$ ll zbdba.txt
-rw-rw-rw- 1 ogg oinstall 0 Mar  9 22:51 zbdba.txt
时间: 2024-10-10 15:25:40

Using GoldenGate EVENTACTIONS to customize processing的相关文章

Goldengate进程的合并与拆分规范

Goldengate抽取进程的合并与拆分原则 1.    文档综述 1.1.  文档说明 本文档描述了对GoldenGate的抽取进程进行拆分和合并的基本原则和详细步骤.  1.2.  读者范围 本文档主要容灾相关人员.纳入数据级容灾范围的应用系统相关人员使用,在Goldengate实施.运维的整个生命周期中,必须严格遵循本系列文档. 1.3.  术语说明 序号 完整说法 缩略说法 1 GoldenGate GG或OGG         2.      抽取进程的拆分 2.1.  拆分原则  

Processing Images

https://developer.apple.com/library/content/documentation/GraphicsImaging/Conceptual/CoreImaging/ci_tasks/ci_tasks.html#//apple_ref/doc/uid/TP30001185-CH3-TPXREF101 Processing images means applying filters-an image filter is a piece of software that

Step by Step for configuration of sending customize IDOC/自定义IDOC发送配置

<div style="width: 600px; max-width: 100%; margin-bottom:5px;"><a href="https://docs.com/gan-gavin/6042/idoc-step-by-step-for-configuration-of-sending" title="自定义IDOC配置/Step by Step for configuration of sending customize

济南的雨和Oracle GoldenGate 的Bug

济南现在在下雨(2014.11.28  03:16am ),可是,我现在的心情,用齐秦的歌来形容,是最恰当不过了---"无情的雨,轻轻把我打醒,让我的泪,像雨水一样冰" 刚刚确认了一个生产环境中ogg的bug(该bug跟ddl有关),出现bug的ogg版本为: Oracle GoldenGate Capture for Oracle Version 11.2.1.0.25 19181440 19358139 AIX 5L, ppc, 64bit (optimized), Oracle

使用 Oracle GoldenGate 在 Microsoft SQL Server 和 Oracle Database 之间复制事务

使用 Oracle GoldenGate 在 Microsoft SQL Server 和 Oracle Database 之间复制事务 作者:Nikolay Manchev 分步构建一个跨这些平台的简单事务复制示例. 2011 年 8 月发布 大多数关注数据复制的 Oracle 技术专家都熟悉 Oracle Streams.在 2009 年之前,Streams 一直是推荐使用的最流行的 Oracle 数据分发技术. 2009 年 7 月,Oracle 收购了 GoldenGate 这一数据库复

使用Goldengate 实现Oracle for Oracle 单向数据同步

实验环境 数据源端:  host1 ip 192.168.199.163 数据目标端: host2 ip 192.168.199.104 两台机器都安装 http://lqding.blog.51cto.com/9123978/1694971 文中描述安装配置好了Goldengate . 要实现数据的同步,Oracle源端必须满足如下设置 Oracle需要运行在归档模式下 SQL> startup mount  ORACLE instance started. Total System Glob

Oracle Goldengate参数整理

转自:http://blog.csdn.net/lemontree1123/article/details/46603549 manager参数: AUTOSTART:指定在mgr启动时自动启动那些进程. AUTOSTART ER * AUTOSTART extract extsz AUTORESTART:指定在mgr可以定时重启那些进程.可以在网络中断等故障恢复后自动重起,避免人工干预. AUTORESTART ER *, WAITMINUTES 5, RETRIES 3 DYNAMICPOR

Zero Downtime Upgrade of Oracle 10g to Oracle 11g Using GoldenGate — 4

Target Side Setup Install OGG on Target Side Creates required directories for OGG [[email protected] ggs]$ ./ggsci Oracle GoldenGate Command Interpreter for Oracle Version 11.2.1.0.23 18709404 OGGCORE_11.2.1.0.0OGGBP_PLATFORMS_140523.1046_FBO Linux,

goldengate一些參数整理

manager參数: AUTOSTART:指定在mgr启动时自己主动启动那些进程. AUTOSTART ER * AUTOSTART extract extsz AUTORESTART:指定在mgr能够定时重新启动那些进程. 能够在网络中断等故障恢复后自己主动重起.避免人工干预. AUTORESTART ER *, WAITMINUTES 5, RETRIES 3 DYNAMICPORTLIST:指定GoldenGate能够使用那些port接受extract发送过来的数据. DYNAMICPOR