Oracle 19C OGG基礎運維-07減少複製表

chenoracle發表於2020-04-11

Oracle 19C OGG基礎運維-07減少複製表 

場景一:源端extract程式和目標端replicat程式引數檔案中透過*來匹配所有表。

場景二:源端extract程式和目標端replicat程式引數檔案中沒有透過*來匹配所有表,而是指定了固定的表。


場景一:源端extract程式和目標端replicat程式引數檔案中透過*來匹配所有表。

例如:

源端:

extract程式

GGSCI (cjcos01 as c##ogg@cjcdb/CJCPDB) 87> edit param ext_01

GGSCI (cjcos01 as c##ogg@cjcdb/CJCPDB) 88> view param ext_01

extract ext_01

userid c##ogg@cjcdb,password oracle

GETUPDATEBEFORES

GETTRUNCATES

BR BRINTERVAL 2H

CACHEMGR CACHESIZE 500MB

WARNLONGTRANS 2H,CHECKINTERVAL 5M

NUMFILES 4000

EOFDELAYCSECS 10

LOGALLSUPCOLS

TRANLOGOPTIONS INTEGRATEDPARAMS (max_sga_size 200, parallelism 2)

discardfile ./dirrpt/jcms.dsc,append, megabytes 200

exttrail ./dirdat/ex

DDL INCLUDE ALL

DDLOPTIONS ADDTRANDATA, REPORT

TABLE cjcpdb.cjc.*;

---TABLE cjcpdb.cjc.emp;

---TABLE cjcpdb.cjc.dept;

---TABLE cjcpdb.cjc.bonus;

---TABLE cjcpdb.cjc.salgrade;

---TABLE cjcpdb.cjc.dummy;

---TABLE cjcpdb.cjc.t1;

pump程式

GGSCI (cjcos01 as c##ogg@cjcdb/CJCPDB) 89> edit param pump_01

GGSCI (cjcos01 as c##ogg@cjcdb/CJCPDB) 90> view param pump_01

extract pump_01

dynamicresolution

setenv (NLS_LANG=AMERICAN_AMERICA.AL32UTF8)

userid c##ogg@cjcdb,password oracle

rmthost 192.168.31.100,mgrport 7809,compress

rmttrail ./dirdat/dp

TABLE cjcpdb.cjc.*;

---TABLE cjcpdb.cjc.emp;

---TABLE cjcpdb.cjc.dept;

---TABLE cjcpdb.cjc.bonus;

---TABLE cjcpdb.cjc.salgrade;

---TABLE cjcpdb.cjc.dummy;

---TABLE cjcpdb.cjc.t1;

目標端:

replicat程式

GGSCI (cjcos02) 48> edit param rep_01

GGSCI (cjcos02) 49> view param rep_01

replicat rep_01

setenv (NLS_LANG=AMERICAN_AMERICA.AL32UTF8)

userid ogg@chenpdb,password oracle

assumetargetdefs

reperror default,discard

discardfile ./dirrpt/replzl.dsc,append,megabytes 50

DDL INCLUDE MAPPED

DDLOPTIONS REPORT

DDLERROR 942 IGNORE

MAP cjcpdb.cjc.*, TARGET chenpdb.chen.*;

---MAP cjcpdb.cjc.emp, TARGET chenpdb.chen.emp;

---MAP cjcpdb.cjc.dept, TARGET chenpdb.chen.dept;

---MAP cjcpdb.cjc.bonus, TARGET chenpdb.chen.bonus;

---MAP cjcpdb.cjc.salgrade, TARGET chenpdb.chen.salgrade;

---MAP cjcpdb.cjc.dummy, TARGET chenpdb.chen.dummy;

---MAP cjcpdb.cjc.t1, TARGET chenpdb.chen.t1;

減少複製表操作:

1 在源端修改extract程式的引數,排除不復制的表。

例如 不復制t1表

源端:

extract引數

GGSCI (cjcos01 as c##ogg@cjcdb/CJCPDB) 97> edit param ext_01

GGSCI (cjcos01 as c##ogg@cjcdb/CJCPDB) 98> view param ext_01

extract ext_01

userid c##ogg@cjcdb,password oracle

GETUPDATEBEFORES

GETTRUNCATES

BR BRINTERVAL 2H

CACHEMGR CACHESIZE 500MB

WARNLONGTRANS 2H,CHECKINTERVAL 5M

NUMFILES 4000

EOFDELAYCSECS 10

LOGALLSUPCOLS

TRANLOGOPTIONS INTEGRATEDPARAMS (max_sga_size 200, parallelism 2)

discardfile ./dirrpt/jcms.dsc,append, megabytes 200

exttrail ./dirdat/ex

DDL INCLUDE ALL

DDLOPTIONS ADDTRANDATA, REPORT

tableexclude cjcpdb.cjc.t1;

TABLE cjcpdb.cjc.*;

---TABLE cjcpdb.cjc.emp;

---TABLE cjcpdb.cjc.dept;

---TABLE cjcpdb.cjc.bonus;

---TABLE cjcpdb.cjc.salgrade;

---TABLE cjcpdb.cjc.dummy;

---TABLE cjcpdb.cjc.t1;

pump引數

GGSCI (cjcos01 as c##ogg@cjcdb/CJCPDB) 99> edit param pump_01

GGSCI (cjcos01 as c##ogg@cjcdb/CJCPDB) 100> view param pump_01

extract pump_01

dynamicresolution

setenv (NLS_LANG=AMERICAN_AMERICA.AL32UTF8)

userid c##ogg@cjcdb,password oracle

rmthost 192.168.31.100,mgrport 7809,compress

rmttrail ./dirdat/dp

tableexclude cjcpdb.cjc.t1;

TABLE cjcpdb.cjc.*;

---TABLE cjcpdb.cjc.emp;

---TABLE cjcpdb.cjc.dept;

---TABLE cjcpdb.cjc.bonus;

---TABLE cjcpdb.cjc.salgrade;

---TABLE cjcpdb.cjc.dummy;

---TABLE cjcpdb.cjc.t1;

2 在目標端修改extract程式的引數,排除不復制的表。

目標端:

在map語句上一行新增:mapexclude cjcpdb.cjc.t1;

GGSCI (cjcos02) 53> edit param rep_01

GGSCI (cjcos02) 54> view param rep_01

replicat rep_01

setenv (NLS_LANG=AMERICAN_AMERICA.AL32UTF8)

userid ogg@chenpdb,password oracle

assumetargetdefs

reperror default,discard

discardfile ./dirrpt/replzl.dsc,append,megabytes 50

DDL INCLUDE MAPPED

DDLOPTIONS REPORT

DDLERROR 942 IGNORE

mapexclude cjcpdb.cjc.t1;

MAP cjcpdb.cjc.*, TARGET chenpdb.chen.*;

---MAP cjcpdb.cjc.emp, TARGET chenpdb.chen.emp;

---MAP cjcpdb.cjc.dept, TARGET chenpdb.chen.dept;

---MAP cjcpdb.cjc.bonus, TARGET chenpdb.chen.bonus;

---MAP cjcpdb.cjc.salgrade, TARGET chenpdb.chen.salgrade;

---MAP cjcpdb.cjc.dummy, TARGET chenpdb.chen.dummy;

---MAP cjcpdb.cjc.t1, TARGET chenpdb.chen.t1;

3 在源端系統上首先驗證所需歸檔日誌存在

檢視指定程式詳細資訊

GGSCI (cjcos01 as c##ogg@cjcdb/CJCPDB) 79> Info ext_01, detail

檢視程式的檢查點資訊

GGSCI (cjcos01 as c##ogg@cjcdb/CJCPDB) 80> Info ext_01, showch

4 重啟extract和replicat程式

源端:停止

stop pump_01

stop ext_01 

目標端:停止

stop rep_01 

源端:啟動

start pump_01 

start ext_01 

目標端:啟動

start rep_01 

5 更新t1表,檢視資料庫是否同步

源端:  

SQL> conn cjc/cjc@cjcpdb 

SQL> insert into t1 values(80,'CHEN','AAA');

SQL> insert into t1 values(90,'JCH','BBB');

SQL> commit; 

SQL> select * from t1;

    DEPTNO DNAME   LOC

---------- -------------- -------------

10 ACCOUNTING   NEW YORK

20 RESEARCH   DALLAS

30 SALES   CHICAGO

40 OPERATIONS   BOSTON

50 DBA   DUNHUA

60 CJC   DAPUCHAI

70 CHEN    AAA

80 CHEN    AAA

90 JCH   BBB

9 rows selected.

目標端:t1表資料已不在同步

SQL> select * from t1;

    DEPTNO DNAME   LOC

---------- -------------- -------------

10 ACCOUNTING   NEW YORK

20 RESEARCH   DALLAS

30 SALES   CHICAGO

40 OPERATIONS   BOSTON

50 DBA   DUNHUA

60 CJC   DAPUCHAI

70 CHEN    AAA

7 rows selected.

場景二:源端extract程式和目標端replicat程式引數檔案中沒有透過*來匹配所有表,而是指定了固定的表。

例如:

源端:

extract引數

GGSCI (cjcos01 as c##ogg@cjcdb/CJCPDB) 73> edit param ext_01

GGSCI (cjcos01 as c##ogg@cjcdb/CJCPDB) 74> view param ext_01

extract ext_01

userid c##ogg@cjcdb,password oracle

GETUPDATEBEFORES

GETTRUNCATES

BR BRINTERVAL 2H

CACHEMGR CACHESIZE 500MB

WARNLONGTRANS 2H,CHECKINTERVAL 5M

NUMFILES 4000

EOFDELAYCSECS 10

LOGALLSUPCOLS

TRANLOGOPTIONS INTEGRATEDPARAMS (max_sga_size 200, parallelism 2)

discardfile ./dirrpt/jcms.dsc,append, megabytes 200

exttrail ./dirdat/ex

DDL INCLUDE ALL

DDLOPTIONS ADDTRANDATA, REPORT

---TABLE cjcpdb.cjc.*;

TABLE cjcpdb.cjc.emp;

TABLE cjcpdb.cjc.dept;

TABLE cjcpdb.cjc.bonus;

TABLE cjcpdb.cjc.salgrade;

TABLE cjcpdb.cjc.dummy;

TABLE cjcpdb.cjc.t1;

pump引數

GGSCI (cjcos01 as c##ogg@cjcdb/CJCPDB) 75> edit param pump_01

GGSCI (cjcos01 as c##ogg@cjcdb/CJCPDB) 76> view param pump_01

extract pump_01

dynamicresolution

setenv (NLS_LANG=AMERICAN_AMERICA.AL32UTF8)

userid c##ogg@cjcdb,password oracle

rmthost 192.168.31.100,mgrport 7809,compress

rmttrail ./dirdat/dp

---TABLE cjcpdb.cjc.*;

TABLE cjcpdb.cjc.emp;

TABLE cjcpdb.cjc.dept;

TABLE cjcpdb.cjc.bonus;

TABLE cjcpdb.cjc.salgrade;

TABLE cjcpdb.cjc.dummy;

TABLE cjcpdb.cjc.t1;

目標端:

replicat引數

GGSCI (cjcos02) 43> edit param rep_01

GGSCI (cjcos02) 44> view param rep_01

replicat rep_01

setenv (NLS_LANG=AMERICAN_AMERICA.AL32UTF8)

userid ogg@chenpdb,password oracle

assumetargetdefs

reperror default,discard

discardfile ./dirrpt/replzl.dsc,append,megabytes 50

DDL INCLUDE MAPPED

DDLOPTIONS REPORT

DDLERROR 942 IGNORE

---MAP cjcpdb.cjc.*, TARGET chenpdb.chen.*;

MAP cjcpdb.cjc.emp, TARGET chenpdb.chen.emp;

MAP cjcpdb.cjc.dept, TARGET chenpdb.chen.dept;

MAP cjcpdb.cjc.bonus, TARGET chenpdb.chen.bonus;

MAP cjcpdb.cjc.salgrade, TARGET chenpdb.chen.salgrade;

MAP cjcpdb.cjc.dummy, TARGET chenpdb.chen.dummy;

MAP cjcpdb.cjc.t1, TARGET chenpdb.chen.t1;

減少複製表操作:

1 在源端系統上首先驗證所需歸檔日誌存在

檢視 ext_01程式詳細資訊

GGSCI (cjcos01 as c##ogg@cjcdb/CJCPDB) 79> Info ext_01, detail

檢視 ext_01程式的檢查點資訊

GGSCI (cjcos01 as c##ogg@cjcdb/CJCPDB) 80> Info ext_01, showch

2 在源端停止extract程式

GGSCI (cjcos01 as c##ogg@cjcdb/CJCPDB) 81> stop ext_01

GGSCI (cjcos01 as c##ogg@cjcdb/CJCPDB) 81> stop pump_01

3 在目標端停止replicat程式程式

GGSCI (cjcos02) 45> stop rep_01

4 源端:直接註釋掉該表所在table行即可

例如

源端:

extract程式

GGSCI (cjcos01 as c##ogg@cjcdb/CJCPDB) 73> edit param ext_01

GGSCI (cjcos01 as c##ogg@cjcdb/CJCPDB) 74> view param ext_01

extract ext_01

userid c##ogg@cjcdb,password oracle

GETUPDATEBEFORES

GETTRUNCATES

BR BRINTERVAL 2H

CACHEMGR CACHESIZE 500MB

WARNLONGTRANS 2H,CHECKINTERVAL 5M

NUMFILES 4000

EOFDELAYCSECS 10

LOGALLSUPCOLS

TRANLOGOPTIONS INTEGRATEDPARAMS (max_sga_size 200, parallelism 2)

discardfile ./dirrpt/jcms.dsc,append, megabytes 200

exttrail ./dirdat/ex

DDL INCLUDE ALL

DDLOPTIONS ADDTRANDATA, REPORT

---TABLE cjcpdb.cjc.*;

TABLE cjcpdb.cjc.emp;

TABLE cjcpdb.cjc.dept;

TABLE cjcpdb.cjc.bonus;

TABLE cjcpdb.cjc.salgrade;

TABLE cjcpdb.cjc.dummy;

---TABLE cjcpdb.cjc.t1;

pump程式 

GGSCI (cjcos01 as c##ogg@cjcdb/CJCPDB) 75> edit param pump_01

GGSCI (cjcos01 as c##ogg@cjcdb/CJCPDB) 76> view param pump_01

extract pump_01

dynamicresolution

setenv (NLS_LANG=AMERICAN_AMERICA.AL32UTF8)

userid c##ogg@cjcdb,password oracle

rmthost 192.168.31.100,mgrport 7809,compress

rmttrail ./dirdat/dp

---TABLE cjcpdb.cjc.*;

TABLE cjcpdb.cjc.emp;

TABLE cjcpdb.cjc.dept;

TABLE cjcpdb.cjc.bonus;

TABLE cjcpdb.cjc.salgrade;

TABLE cjcpdb.cjc.dummy;

---TABLE cjcpdb.cjc.t1;

5 目標端:直接註釋掉該表所在MAP行即可

例如: 

目標端:

replicat程式

GGSCI (cjcos02) 43> edit param rep_01

GGSCI (cjcos02) 44> view param rep_01

replicat rep_01

setenv (NLS_LANG=AMERICAN_AMERICA.AL32UTF8)

userid ogg@chenpdb,password oracle

assumetargetdefs

reperror default,discard

discardfile ./dirrpt/replzl.dsc,append,megabytes 50

DDL INCLUDE MAPPED

DDLOPTIONS REPORT

DDLERROR 942 IGNORE

---MAP cjcpdb.cjc.*, TARGET chenpdb.chen.*;

MAP cjcpdb.cjc.emp, TARGET chenpdb.chen.emp;

MAP cjcpdb.cjc.dept, TARGET chenpdb.chen.dept;

MAP cjcpdb.cjc.bonus, TARGET chenpdb.chen.bonus;

MAP cjcpdb.cjc.salgrade, TARGET chenpdb.chen.salgrade;

MAP cjcpdb.cjc.dummy, TARGET chenpdb.chen.dummy;

---MAP cjcpdb.cjc.t1, TARGET chenpdb.chen.t1;

6 目標端啟動replicat程式 

start rep_01 

7 源端啟動extract程式

start pump_01 

start ext_01 

8 更新t1表,檢視資料庫是否同步

源端: 

SQL> conn cjc/cjc@cjcpdb 

SQL> insert into t1 values(70,'CHEN','AAA');

SQL> insert into t1 values(80,'JCH','BBB');

SQL> commit; 

SQL> select * from t1; 

    DEPTNO DNAME   LOC

---------- -------------- -------------

10 ACCOUNTING   NEW YORK

20 RESEARCH   DALLAS

30 SALES   CHICAGO

40 OPERATIONS   BOSTON

50 DBA   DUNHUA

60 CJC   DAPUCHAI

70 CHEN    AAA

80 JCH   BBB

8 rows selected.

目標端:t1表不在同步

SQL> select * from t1; 

    DEPTNO DNAME   LOC

---------- -------------- -------------

10 ACCOUNTING   NEW YORK

20 RESEARCH   DALLAS

30 SALES   CHICAGO

40 OPERATIONS   BOSTON

50 DBA   DUNHUA

60 CJC   DAPUCHAI

6 rows selected.

歡迎關注我的微信公眾號"IT小Chen",共同學習,共同成長!!!

來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/29785807/viewspace-2685564/,如需轉載,請註明出處,否則將追究法律責任。

相關文章