使用 Direct Initial Load 初始化 GoldenGate 同步数据

http://click.aliyun.com/m/1000005960/Direct Initial load 操作步骤较多,文章中仅对关键步骤进行讲解说明详细操作步骤可以通过以下链接下载课程对应视频:https://share.weiyun.com/f9e06940c89cb00785c7514a3f326d10

3.1 两端同时创建表

CREATE TABLE sky.t1(id NUMBER);--创建主键注意两边都要创建alter table sky.t1 add primarykey(id);--增加附加日志ggsicdblogin userid goldengate,passwordgoldengate;add trandata sky.*

3.2 模拟数据插入脚本 

SQLPLUS 下执行如下语句模拟不断执行数据插入

beginfori in90000..10000000loopinsert into sky.t1 values(i);commit;if mod(i,100) =0thendbms_lock.sleep(3);endif;end loop;end;

3.3 源端进程配置

增加源端 CDC 进程

ADD EXTRACT cdcext1,TRANLOG,BEGIN NOWADD RMTTRAIL./dirdat/zz,EXTRACT cdcext1

增加源端 CDC 进程配置文件

EXTRACT cdcext1SETENV(NLS_LANG=AMERICAN_AMERICA.ZHS16GBK)USERID goldengate, PASSWORD goldengate

RMTHOST 192.168.56.120, MGRPORT 7809RMTTRAIL ./dirdat/zz

TABLE sky.t1

增加源端的 INIT 进程

add extract initext,source is table

增加源端 INIT 进程配置文件

extract initextuserid goldengate,password goldengatermthost192.168.56.120,mgrport7809rmttask replicat,group initreptable sky.t1;

3.4 目标端进程配置

增加目标端 CDC 进程

add replicat cdcrep1,exttrail./dirdat/zz nodbcheckpoint

增加目标端 CDC 进程配置文件

REPLICAT cdcrep1HANDLECOLLISIONSASSUMETARGETDEFSUSERID goldengate,PASSWORDgoldengateMAP sky.t1,TARGET sky.t1;

注意进程中关键的侧参数 HANDLECOLLISIONS。

增加目标端 INIT 进程

add replicat initrep,specialrun

增加目标端 INIT 进程配置文件

replicat initrepASSUMETARGETDEFSDISCARDFILE./dirrpt/repint1.dsc,APPEND,MEGABYTES100userid goldengate,password goldengateMAP sky.t1,TARGET sky.t1;

3.5 同步过程

源端数据库执行数据生成 SQL 语句

你可能感兴趣的:(使用 Direct Initial Load 初始化 GoldenGate 同步数据)