Using GoldenGate EVENTACTIONS to customize processing
2015-03-11 09:17
337 查看
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.
发现进程停止并且执行脚本
查看进程:
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 查看脚本:
[ogg@zbdba2 ogg]$ cat hello.sh
#!/bin/bash
touch zbdba.txt
[ogg@zbdba2 ogg]$ ll zbdba.txt
-rw-rw-rw- 1 ogg oinstall 0 Mar 9 22:51 zbdba.txt
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 查看脚本:
[ogg@zbdba2 ogg]$ cat hello.sh
#!/bin/bash
touch zbdba.txt
[ogg@zbdba2 ogg]$ ll zbdba.txt
-rw-rw-rw- 1 ogg oinstall 0 Mar 9 22:51 zbdba.txt
相关文章推荐
- Bind event to element using pure Javascript
- Yii 1.1: Using CButtonColumn to customize buttons in CGridView Follow @yiiframework
- Configure Oracle GoldenGate for Oracle to Oracle Database Synchronization
- Zero Downtime Upgrade of Oracle 10g to Oracle 11g Using GoldenGate — 2
- Use the ItemDataBound event to customize the DataGrid control.
- How To Customize The Tab Bar Using iOS 5 Appearance API
- Unable to print reports as PDF files on the server using batch processing AX
- goldenGate sybase to oracle配置
- zhuanzai: AJAX: How to create a "Processing" modal window using UpdateProgress and ModalPopup ASP.net AJAX controls
- [MST] Attach Behavior to mobx-state-tree Models Using Actions
- Creating a GoldenGate Exception Handler to Trap and Log Oracle Errors
- How to handle ddl in GoldenGate environment without ddl replication?
- GoldenGate for mysql to mysql:单向同步
- Thread Basics-- using Timer to trigger Event at a specified internals
- Using the itemDoubleClick event to open nodes in a Flex Tree control
- How to display errors using Page_Error event of Page Object?
- How to invoke a JSF managed bean on a HTML DOM event using native JavaScript?
- Customize Magento using Event/Observer
- Applying Styles, Themes, and Skins ->Using Themes to Customize a Site
- How to handle ddl in GoldenGate environment without ddl replication?