环境:
goldengate 12.1.2.1.0版本开始之初从datagurad的备库进行同步,抽取进程加入关键参数tranlogoptions minefromactivedg 但是涉及到支持ddl的配置和注册抽取进程的步骤只能在dg的主库上执行。 下面是我在dg的主库上安装部署好了goldengte(安装ogg、配置支持ddl,注册抽取进程)后,欧博然后在dg从库上的部署ogg的步骤。 1.停掉从库的复制进程,欧博娱乐并删除dirdat目录下的内容
2.主库停掉并删除主库的抽取进程
3.主库创建抽取和投递进程 extract dpep userid goldengate, password AACAAAAAAAAAAAKAPATACEHBIGQGCFZCCDIGAEMCQFFBZHVC ,ENCRYPTKEY DEFAULT RmtHost 192.168.56.166, MgrPort 7819, Compress RmtTrail ./dirdat/ep gettruncates Passthru table hxl.*;
4.抽取进程 ---extep参数如下: extract extep userid goldengate, password AACAAAAAAAAAAAKAPATACEHBIGQGCFZCCDIGAEMCQFFBZHVC ,ENCRYPTKEY DEFAULT SETENV (ORACLE_SID="dg12c") SETENV ( NLS_LANG = AMERICAN_AMERICA.ZHS16GBK) exttrail ./dirdat/ep BR BRINTERVAL 20M numfiles 5000 warnlongtrans 3h, checkinterval 10m TRANLOGOPTIONS LOGRETENTION ENABLED --TRANLOGOPTIONS AltArchiveLogDest /u01/app/oracle/archive_log/ tranlogoptions minefromactivedg --TRANLOGOPTIONS ASMUSER sys@asmtns_rac01, ASMPASSWORD oracle --TRANLOGOPTIONS DBLOGREADER --DDL parameter DDL & EXCLUDE INSTR 'shrink space CHECK' & INCLUDE MAPPED OBJTYPE 'TABLE' & INCLUDE MAPPED OBJTYPE 'INDEX' & INCLUDE MAPPED OBJTYPE 'SEQUENCE' & INCLUDE MAPPED OBJTYPE 'VIEW' & INCLUDE MAPPED OBJTYPE 'PROCEDURE' & INCLUDE MAPPED OBJTYPE 'FUNCTION' & INCLUDE MAPPED OBJTYPE 'PACKAGE' --DDLOPTIONS ADDTRANDATA REPORT table hxl.tb_ogg_test;
6.删除掉主库上./dirdat目录下的ep开头的文件 [oracle@localhost dirdat]$ cd /goldengate12c/dirdat [oracle@localhost dirdat]$ rm ep*
7.启动主库的抽取进程
---------------------------------从库操作------------------------- 1.停掉监听器并杀掉ogg目标库用户下的进程 lsnrctl stop Select Distinct 'alter system kill session ' || '''' || b.sid || ',' ||b.SERIAL# || ''';' kill_command, b.Username From Gv$sql a, Gv$session b, Gv$session_Wait c, Gv$latchholder d, Gv$locked_Object e, (Select lk.inst_id,Lk.Sid, Lk.Type, Lt.Name Lock_Name From Gv$lock Lk, Gv$lock_Type Lt Where Lk.Type = Lt.Type And lk.inst_id = lt.inst_id Group By lk.inst_id,Lk.Sid, Lk.Type, Lt.Name) f, (Select Addr, inst_id, program, Sum(Pga_Used_Mem) Pga_Used_Mem, Sum(Pga_Alloc_Mem) Pga_Alloc_Mem, Sum(Pga_Freeable_Mem) Pga_Freeable_Mem, Sum(Pga_Max_Mem) Pga_Max_Mem From Gv$process Group By Addr, inst_id, program) g, Gv$sort_Usage h --Gv$session_Longops Sl Where a.Sql_Id = b.Sql_Id And b.Sid = c.Sid And b.Sid = d.Sid(+) And b.Sid = e.Session_Id(+) And b.Sid = f.Sid(+) And b.Paddr = g.Addr(+) And b.Saddr = h.Session_Addr(+) --And b.Sid = Sl.Sid(+) And b.Status = 'ACTIVE' And b.Username In ('ogg目标库业务用户');
2.从库停掉并删除复制进程 3.配置从库复制进程 >edit params repep
这里先不启动 replicat repep userid goldengate, password AACAAAAAAAAAAAKAPATACEHBIGQGCFZCCDIGAEMCQFFBZHVC ,ENCRYPTKEY DEFAULT DiscardFile ./dirrpt/repep.dsc, append, Megabytes 200 gettruncates AllowNoopUpdates ASSUMETARGETDEFS DBOPTIONS SUPPRESSTRIGGERS DBOPTIONS DEFERREFCONST HANDLECOLLISIONS MAP hxl.tb_ogg_test ,TARGET hxl.tb_ogg_test; DDLERROR 10655 IGNORE DDLERROR 10636 IGNORE
4.数据初始化
CURRENT_SCN
该脚本内容如下: dblink_dg主库 这里是连接主库的dblink,若是连接备库的tns会报如下错误
Connected to: Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production With the Partitioning, OLAP, Data Mining and Real Application Testing options FLASHBACK automatically enabled to preserve database integrity. Starting "GOLDENGATE"."SYS_IMPORT_TABLE_03": goldengate/******** network_link=dblink_dg12c FLASHBACK_SCN=2166813 directory=DATA_PUMP_DIR EXCLUDE=STATISTICS cluster=n tables=hxl.tb_ogg_test parallel=40 table_exists_action=replace ORA-39126: Worker unexpected fatal error in KUPW$WORKER.MAIN [INSERT INTO SYS.KU$_LIST_FILTER_TEMP_2@dblink_dg12c (process_order,duplicate,object_schema,object_name,base_process_order,parent_process_order) SELECT process_order,duplicate,object_schema,object_name,base_process_order,parent_process_order FROM "GOLDENGATE"."SYS_IMPORT_TABLE_03" WHERE process_order = :1] ORA-08176: consistent read failure; rollback data not available ORA-02063: preceding line from ORA11G ORA-02063: preceding 2 lines from DBLINK_DG12C ORA-06512: at "SYS.DBMS_SYS_ERROR", line 95 ORA-06512: at "SYS.KUPW$WORKER", line 9715 ----- PL/SQL Call Stack ----- object line object handle number name 0xc2a6e0e8 21979 package body SYS.KUPW$WORKER 0xc2a6e0e8 9742 package body SYS.KUPW$WORKER 0xc2a6e0e8 1878 package body SYS.KUPW$WORKER 0xc26cf850 2 anonymous block Job "GOLDENGATE"."SYS_IMPORT_TABLE_03" stopped due to fatal error at Wed Apr 7 23:34:41 2021 elapsed 0 00:00:01
d.启动从库的监听器
|