SUPPRESSTRIGGERS:该参数是suppress triggers两个单词合并而来,可以理解为抑制触发器。当我们做OracleGoldengate初始化时,灾备端的复制进程Replicat启动之前必须要做的一个步骤就是禁用触发器(为什么要这么做暂不讨论)。常用的做法是在灾备端sqlplus中执行语句来禁止触发器,例如:
SQL> declare
v_sql varchar2(2000);
CURSOR c_trigger IS SELECT 'alter trigger '||owner||'.'||trigger_name||' disable' from dba_triggers where owner in ('EPM_HA','XEPMA_HA','EPM_SEC','EPM_DE_HA','EPM_LOADC_HA','EPM_IC_HA','EPM_CP','FLOW_HA','EPM_HIS_HA','EPM_ERP_HA','EPM_BANK_HA','SYSODM','EPC_HA','EPSA_HA','EPM_RPT_HA');
BEGIN
OPEN c_trigger;
LOOP
FETCH c_trigger INTO v_sql;
EXIT WHEN c_trigger%NOTFOUND;
execute immediate v_sql;
end loop;
close c_trigger;
end;
/
如果使用SUPPRESSTRIGGERS参数就简单的多,只需要在目标端添加DBOPTIONS SUPPRESSTRIGGERS。该参数支持Oraclean10.2.0.5和11.2.0.2或更高版本,不支持11.1版本,需要注意。还有一点需要注意的时USERID,SOURCEDB参数在要写在DBOPTIONS SUPPRESSTRIGGERS之前。
GGSCI> EDIT PARAMS rt1
REPLICAT rt1
SETENV (NLS_LANG = "American_America.UTF8")
USERID oggadmin, PASSWORD AACAAAAAAAAAAAIARFBCXDACYBXIVCND, ENCRYPTKEY default
DBOPTIONS SUPPRESSTRIGGERS
GETTRUNCATES
REPORT AT 06:00
REPORTCOUNT EVERY 30 MINUTES, RATE
REPORTROLLOVER AT 02:00
REPERROR DEFAULT, ABEND
--HANDLECOLLISIONS
ALLOWNOOPUPDATES
DISCARDFILE ./dirrpt/repsa.dsc, APPEND, MEGABYTES 1024M
DISCARDROLLOVER AT 02:00
ASSUMETARGETDEFS
MAP snow.*, TARGET snow.*;
最近出差,搞总局数据同步的事情,采用ogg实现数据同步,然后在目标端源表上建触发器,进行数据增量加工,一切准备就绪,等待实施完成,快2周了该回家了。但是晚上下班后进行部署,ogg断了,数据不能同步,惨吧!
同事提醒:OGG12中默认禁用trigger,如果需要使用TRIGGER请配置参数(目标端复制进程配置)
DBOPTIONS NOSUPPRESSTRIGGERS
============================================================================
SUPPRESSTRIGGERS | NOSUPPRESSTRIGGERS
Valid for nonintegrated Replicat for Oracle. Controls whether or not triggers are fired during the Replicat session.
Provides an alternative to manually disabling triggers. (Integrated Replicat does not require disabling of triggers on the target system.)
SUPPRESSTRIGGERS
is the default and prevents triggers from firing on target objects that are configured for replication with Oracle GoldenGate.
SUPPRESSTRIGGERS
is valid for Oracle 11.2.0.2 and later 11gR2 versions. SUPPRESSTRIGGERS
is not valid for 11gR1.
To allow a specific trigger to fire, you can use the following SQLEXEC
statement in the Replicat parameter file, where trigger_owner
is the owner of the trigger and trigger_name
is the name of the trigger.
SQLEXEC 'dbms_ddl.set_trigger_firing_property(trigger_owner "trigger_name", FALSE);'
Note:
Once thisSQLEXEC
is executed with FALSE
, the trigger will continue to fire until the command is run again with a setting of TRUE
.NOSUPPRESSTRIGGERS
allows target triggers to fire. To use [NO]SUPPRESSTRIGGERS
, the Replicat user must have the privileges granted through the dbms_goldengate_auth.grant_admin_privilege
package. This procedure is part of the Oracle database installation. See the database documentation for more information.
The USERID
or USERIDALIAS
parameter must precede a DBOPTIONS
statement that contains SUPPRESSTRIGGERS
or NOSUPPRESSTRIGGERS
.