接上一篇 ddl filter with ddl paramster

测试二:ddl 过滤操作


ddl dml双向复制开启,所以测试用户可以在任意一个节点创建即可同步到对端

建测试用表同样也是可以同步到对端,建测试用表注意要有主键


此时node1,node2 执行

su  - oracle
cd $GGHOME
ggsci
add schematrandata tiger



调整参数后重启。调整如下:

node1:

GGSCI (node1) 1> view params eddl1

extract eddl1
userid ogg@orcc1,password ogg
TRANLOGOPTIONS EXCLUDEUSER ogg
--userid ogg, password ogg
DDL INCLUDE ALL  exclude optype drop objname tiger.*
ddloptions report
ddloptions addtrandata
ddloptions getreplicates
exttrail ./dirdat/aa
table student.*;
table tiger.*;


GGSCI (node1) 2> view params pddl1

extract pddl1
userid ogg, password ogg
rmthost node2, mgrport 7809
rmttrail ./dirdat/bb
table student.*;
table tiger.*;


GGSCI (node1) 3> view params rddl2

replicat rddl2
userid ogg,password ogg
ddl include all  exclude optype drop objname tiger.*
ddloptions report
ddloptions updatemetadata
discardfile dirrpt\rddl.dsc, purge
map student.*, target student.*;
map tiger.*, target tiger.*;


GGSCI (node1) 4>



node2:




GGSCI (node2) 2> view params eddl2

extract eddl2
userid ogg,password ogg
TRANLOGOPTIONS EXCLUDEUSER ogg
DDL INCLUDE ALL  exclude optype drop objname tiger.*
ddloptions report
ddloptions addtrandata
ddloptions getreplicates
exttrail ./dirdat/cc
table student.*;
table tiger.*;


GGSCI (node2) 3> view params pddl2

extract  pddl2
userid ogg, password ogg
rmthost node1, mgrport 7809
rmttrail ./dirdat/dd
table student.*;
table tiger.*;


GGSCI (node2) 4> view params rddl1

replicat rddl1
userid ogg, password ogg
ddl include all  exclude optype drop objname tiger.*
ddloptions report
ddloptions updatemetadata
discardfile dirrpt\rddl.dsc, purge
map student.*, target student.*;
map tiger.*, target tiger.*;


GGSCI (node2) 5>



node1上创建测试表,应为是ddl,dml双向复制,node2 自动同步




node1:

SQL> show user
USER is "TIGER"
SQL> select tname from tab;

no rows selected

SQL> create table test (id int primary key);

Table created.

SQL> c/test/tab
  1* create table tab (id int primary key)
SQL> /

node2:


SQL> select table_name from user_tables;

TABLE_NAME
------------------------------
TEST
TAB


情景一:

node2 删除tab

SQL> drop table tab;

Table dropped.

SQL> select table_name from user_tables;

TABLE_NAME
------------------------------
TEST



node1 验证:

SQL> select table_name from user_tables;

TABLE_NAME
------------------------------
TEST
TAB

日志:

2017-04-01 11:05:51  INFO    OGG-01487  Oracle GoldenGate Capture for Oracle, eddl2.prm:  DDL found, operation [drop table tab  (size 15)], start SCN [1838278], commit SCN [1838315] instance [orcc2 (1)], DDL seqno [3005], marker seqno [2041].
2017-04-01 11:05:51  INFO    OGG-00488  Oracle GoldenGate Capture for Oracle, eddl2.prm:  DDL operation excluded [exclude optype drop objname tiger.*], optype [DROP], objtype [TABLE], objowner [TIGER], objname [TAB].
2017-04-01 11:10:55  INFO    OGG-00987  Oracle GoldenGate Command Interpreter for Oracle:  GGSCI command (oracle): info all.




情景二:



node1 删除test:



SQL> /

TABLE_NAME
------------------------------
TEST
TAB

SQL> drop table test;

Table dropped.

SQL> select table_name from user_tables;

TABLE_NAME
------------------------------
TAB


node2 验证:


SQL> select table_name from user_tables;

TABLE_NAME
------------------------------
TEST


日志:


2017-04-01 11:07:57  INFO    OGG-01487  Oracle GoldenGate Capture for Oracle, eddl1.prm:  DDL found, operation [drop table test  (size 16)], start SCN [2377698], commit SCN [2377741] instance [orcc1 (1)], DDL seqno [3515], marker seqno [3081].
2017-04-01 11:07:57  INFO    OGG-00488  Oracle GoldenGate Capture for Oracle, eddl1.prm:  DDL operation excluded [exclude optype drop objname tiger.*], optype [DROP], objtype [TABLE], objowner [TIGER], objname [TEST].



情景三:


node1,node2任意一个节点建表测试,create 未在exclude范围内,应该正常复制


node1:

SQL> show user;
USER is "TIGER"
SQL> create table t1 (id int primary key);



node2:

SQL> show user;
USER is "TIGER"

SQL> create table t2 (id int primary key);

Table created.

node1:

SQL> select tname from tab;

TNAME
------------------------------
T1
T2

node2:

SQL> select tname from tab;

TNAME
------------------------------
T1
T2


标签: 暂无标签
dongxujian

写了 86 篇文章,拥有财富 384,被 13 人关注

转播转播 分享分享 分享淘帖
回复

使用道具

您需要登录后才可以回帖 登录 | 加入社区

本版积分规则

意见
反馈