Oracle GoldenGate系統之----雙向同步資料表
1、防止資料迴圈
在EXTRACT程式中忽略REPLICAT的事務,一般排除提取使用者的操作,並且與需要同步的使用者分開
如USERID SCOTT,PASSWORD TIGER
TRANLOGOPTIONS EXCLUDEUSER SCOTT
2、防止資料衝突
一般要從應用層面解決,避免操作相同的資料。
以下是配置步驟和引數。假設是A、B兩個庫之間的同步配置。
從A到B
-- 管理程式配置
GGSCI (dgrac) 1> edit param mgr
PORT 7801
DYNAMICPORTLIST 7802-7820
AUTOSTART ER *
AUTORESTART ER *,RETRIES 3,WAITMINUTES 2,RESETMINUTES 60
STARTUPVALIDATIONDELAY 5
PURGEOLDEXTRACTS ./dirdat/*,USECHECKPOINTS,MINKEEPDAYS 7
-- EXTRACT配置
GGSCI (dgrac) 2> add extract exts1,tranlog,begin now
EXTRACT added.
GGSCI (dgrac) 3> edit param exts1
extract exts1
setenv(NLS_LANG=AMERICAN_AMERICA.ZHS16GBK)
userid tiger
tranlogoptions excludeuser scott
exttrail /u01/app/ogg/dirdat/l1
table lrj.s1;
GGSCI (dgrac) 4> add exttrail /u01/app/ogg/dirdat/l1,extract exts1
EXTTRAIL added.
-- PUMP配置
GGSCI (dgrac) 5> add extract pumps1 ,exttrailsource /u01/app/ogg/dirdat/l1,begin now
EXTRACT added.
GGSCI (dgrac) 6> edit param pumps1
extract pumps1
setenv(NLS_LANG="AMERICAN_AMERICA.ZHS16GBK")
userid scott tiger
rmthost 192.168.56.101,mgrport 7801
rmttrail /u01/app/ogg/dirdat/s1
PASSTHRU
table lrj.s1;
GGSCI (dgrac) 7> add rmttrail /u01/app/ogg/dirdat/s1,extract pumps1
RMTTRAIL added.
-- REPLICAT配置
GGSCI (dgrac) 8> edit param reps1
replicat reps1
setenv(NLS_LANG=AMERICAN_AMERICA.ZHS16GBK)
userid scott, password tiger
assumetargetdefs
reperror default,discard
discardfile /u01/app/ogg/dirout/reps1.dsc,append,megabytes 100
map lrj.s1,target lrj.s1,&
colmap(usedefaults,"ENAME" = "USERNAME"),&
-- 解決衝突,更新記錄不存在時插入,但只插入更新的列,其他列為空,還是要人工處理
RESOLVECONFLICT (UPDATEROWMISSING, (DEFAULT, OVERWRITE));
HANDLECOLLISIONS
-- 啟動所有程式
GGSCI (dgrac) 9> start mgr
MGR is already running.
GGSCI (dgrac) 10> info all
Program Status Group Lag at Chkpt Time Since Chkpt
MANAGER RUNNING
EXTRACT RUNNING EXTS1 00:00:00 00:00:09
EXTRACT RUNNING PUMPS1 00:00:00 00:00:07
REPLICAT RUNNING REPS1 00:00:00 00:00:05
從B到A
-- 管理程式配置
GGSCI (dg) 1> edit param mgr
PORT 7801
DYNAMICPORTLIST 7802-7820
AUTOSTART ER *
AUTORESTART ER *,RETRIES 3,WAITMINUTES 2,RESETMINUTES 60
STARTUPVALIDATIONDELAY 5
PURGEOLDEXTRACTS ./dirdat/*,USECHECKPOINTS,MINKEEPDAYS 7
-- EXTRACT配置
GGSCI (dg) 2> add extract exts1,tranlog,begin now
EXTRACT added.
GGSCI (dg) 3> edit param exts1
extract exts1
setenv(NLS_LANG=AMERICAN_AMERICA.ZHS16GBK)
userid tiger
tranlogoptions excludeuser scott
exttrail /u01/app/ogg/dirdat/l1
table lrj.s1;
GGSCI (dg) 4> add exttrail /u01/app/ogg/dirdat/l1,extract exts1
EXTTRAIL added.
-- PUMP配置
GGSCI (dg) 5> add extract pumps1 ,exttrailsource /u01/app/ogg/dirdat/l1,begin now
EXTRACT added.
GGSCI (dg) 6> edit param pumps1
extract pumps1
setenv(NLS_LANG="AMERICAN_AMERICA.ZHS16GBK")
userid scott@ tiger
rmthost 192.168.56.131,mgrport 7801
rmttrail /u01/app/ogg/dirdat/s1
PASSTHRU
table lrj.s1;
GGSCI (dg) 7> add rmttrail /u01/app/ogg/dirdat/s1,extract pumps1
RMTTRAIL added.
-- REPLICAT配置
GGSCI (dg) 8> edit param reps1
replicat reps1
setenv(NLS_LANG=AMERICAN_AMERICA.ZHS16GBK)
userid scott, password tiger
assumetargetdefs
reperror default,discard
discardfile /u01/app/ogg/dirout/reps1.dsc,append,megabytes 100
map lrj.s1,target lrj.s1,&
colmap(usedefaults,"ENAME" = "USERNAME"),&
RESOLVECONFLICT (UPDATEROWMISSING, (DEFAULT, OVERWRITE));
HANDLECOLLISIONS
-- 啟動所有程式
GGSCI (dg) 9> start mgr
MGR is already running.
GGSCI (dg) 10> info all
Program Status Group Lag at Chkpt Time Since Chkpt
MANAGER RUNNING
EXTRACT RUNNING EXTS1 00:00:00 00:00:09
EXTRACT RUNNING PUMPS1 00:00:00 00:00:07
REPLICAT RUNNING REPS1 00:00:00 00:00:05
資料測試
B端插入:
02:44:09 * from s1
02:44:12 2 /
EMPNO USERNAME JOB MGR HIREDATE SAL COMM DEPTNO
---------- ---------- --------- ---------- ------------ ---------- ---------- ----------
7369 SMITH CLERK 7902 17-DEC-80 1000 100 20
7499 ALLEN SALESMAN 7698 20-FEB-81 1800 400 30
7521 WARD SALESMAN 7698 22-FEB-81 1450 600 30
7566 JONES MANAGER 7839 02-APR-81 3175 100 20
7654 MARTIN SALESMAN 7698 28-SEP-81 1450 1500 30
7698 BLAKE MANAGER 7839 01-MAY-81 3050 100 30
7782 CLARK MANAGER 7839 09-JUN-81 2650 100 10
7788 SCOTT ANALYST 7566 19-APR-87 3200 100 20
7839 KING PRESIDENT 17-NOV-81 5200 100 10
7844 TURNER SALESMAN 7698 08-SEP-81 1700 100 30
7876 ADAMS CLERK 7788 23-MAY-87 1300 100 20
7900 JAMES CLERK 7698 03-DEC-81 1150 100 30
7902 FORD ANALYST 7566 03-DEC-81 3200 100 20
7934 MILLER CLERK 7782 23-JAN-82 1500 100 10
2000 yojan
15 rows selected.
02:45:41 into s1(empno,username,sal) values(4000,'GZITECH',2000);
1 row created.
02:45:46 ;
Commit complete.
A端檢視:
02:45:50 * from s1;
EMPNO USERNAME JOB MGR HIREDATE SAL COMM DEPTNO
---------- ---------- --------- ---------- ------------ ---------- ---------- ----------
7369 SMITH CLERK 7902 17-DEC-80 1000 100 20
7499 ALLEN SALESMAN 7698 20-FEB-81 1800 400 30
7521 WARD SALESMAN 7698 22-FEB-81 1450 600 30
7566 JONES MANAGER 7839 02-APR-81 3175 100 20
7654 MARTIN SALESMAN 7698 28-SEP-81 1450 1500 30
7698 BLAKE MANAGER 7839 01-MAY-81 3050 100 30
7782 CLARK MANAGER 7839 09-JUN-81 2650 100 10
7788 SCOTT ANALYST 7566 19-APR-87 3200 100 20
7839 KING PRESIDENT 17-NOV-81 5200 100 10
7844 TURNER SALESMAN 7698 08-SEP-81 1700 100 30
7876 ADAMS CLERK 7788 23-MAY-87 1300 100 20
7900 JAMES CLERK 7698 03-DEC-81 1150 100 30
7902 FORD ANALYST 7566 03-DEC-81 3200 100 20
7934 MILLER CLERK 7782 23-JAN-82 1500 100 10
2000 yojan
4000 GZITECH 2000
16 rows selected.
A端插入:
09:34:18 into s1(empno,ename,job) values(3000,'WAILON','CLERK');
1 row created.
09:34:40 ;
Commit complete.
B端檢視:
09:34:42 * from s1;
EMPNO USERNAME JOB MGR HIREDATE SAL COMM DEPTNO
---------- ---------- --------- ---------- ------------ ---------- ---------- ----------
7369 SMITH CLERK 7902 17-DEC-80 1000 100 20
7499 ALLEN SALESMAN 7698 20-FEB-81 1800 400 30
7521 WARD SALESMAN 7698 22-FEB-81 1450 600 30
7566 JONES MANAGER 7839 02-APR-81 3175 100 20
7654 MARTIN SALESMAN 7698 28-SEP-81 1450 1500 30
7698 BLAKE MANAGER 7839 01-MAY-81 3050 100 30
7782 CLARK MANAGER 7839 09-JUN-81 2650 100 10
7788 SCOTT ANALYST 7566 19-APR-87 3200 100 20
7839 KING PRESIDENT 17-NOV-81 5200 100 10
7844 TURNER SALESMAN 7698 08-SEP-81 1700 100 30
7876 ADAMS CLERK 7788 23-MAY-87 1300 100 20
7900 JAMES CLERK 7698 03-DEC-81 1150 100 30
7902 FORD ANALYST 7566 03-DEC-81 3200 100 20
7934 MILLER CLERK 7782 23-JAN-82 1500 100 10
2000 yojan
3000 WAILON CLERK
4000 GZITECH 2000
17 rows selected.
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/17172228/viewspace-1062732/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- oracle 資料透過goldengate 實時同步到kafka訊息佇列中OracleGoKafka佇列
- [資料整合/資料同步] 基於資料庫增量日誌的資料同步方案 : Flink CDC/Debezium/DataX/Canal/Oracle Goldengate/Kettle/Sqoop資料庫OracleGoOOP
- 資料結構之雙向連結串列資料結構
- ogg在異構資料庫實時雙向同步中如何防止資料死迴圈同步資料庫
- 【SQL】Oracle資料庫通過job定期重建同步表資料SQLOracle資料庫
- Oracle GoldenGate同步服務歸檔空間維護OracleGo
- 資料結構與演算法(三) -- 線性表之雙向連結串列資料結構演算法
- Java學習筆記:資料結構之線性表(雙向連結串列)Java筆記資料結構
- 資料庫同步利器 otter 雙A同步配置資料庫
- Python內建資料結構之雙向佇列Python資料結構佇列
- React學習筆記之雙向資料繫結React筆記
- JS雙向資料繫結JS
- About the Oracle GoldenGate TrailOracleGoAI
- ORACLE GoldenGate Initial LoadOracleGo
- 從單向到雙向資料繫結
- 0 到 1 掌握:Vue 核心之資料雙向繫結Vue
- GoldenGate 12c 在原有同步程式中新增同步表的操作步驟Go
- GoldenGate異種資料庫之間的複製Go資料庫
- 使用oracle的logminer同步資料Oracle
- Vue資料雙向繫結原理Vue
- vue雙向資料繫結原理Vue
- 原生js雙向資料繫結JS
- Python教程:Python內建資料結構之雙向佇列!Python資料結構佇列
- Oracle GoldenGate安裝(一)OracleGo
- Oracle GoldenGate安裝(二)OracleGo
- Oracle GoldenGate安裝(三)OracleGo
- Oracle GoldenGate 18.1釋出OracleGo
- 通用許可權系統之資料庫表設計資料庫
- Oracle Goldengate是如何保證資料有序和確保資料不丟失的?OracleGo
- 信創雲盤,解決雙系統切換的資料交換同步問題
- Vue 中雙向繫結 Vs 單向資料流Vue
- Python技術分享:內建資料結構之雙向佇列Python資料結構佇列
- Python培訓:Python內建資料結構之雙向佇列Python資料結構佇列
- 支付系統之非同步通知非同步
- 雙向資料繫結是什麼
- 資料結構——雙向連結串列資料結構
- 雙向資料繫結實現原理
- javascript實現雙向資料繫結JavaScript
- 原生 Redis 跨資料中心雙向同步最佳化實踐Redis