veridata实验例(5)更改主键列值,update操作将被分成两个语句
续接“veridata实验举例(4)验证veridata查找出updata、delete操作导致的不同步现象”。地址:点击打开链接
环境:
Item | Source System | Target System |
Platform | Red Hat Enterprise Linux Server release 5.4 | Red Hat Enterprise Linux Server release 5.4 |
Hostname | gc1 | gc2 |
Database | Oracle 10.2.0.1 | Oracle 11.2.0.1 |
Character Set | ZHS16GBK | ZHS16GBK |
ORACLE_SID | PROD | EMREP |
Listener Name/Port | LISTENER/1521 | LISTENER/1521 |
Goldengate User | ogg | ogg |
1、模拟实验环境,使gc1、gc2数据不同步,对gc2上主键列作update操作
GGSCI(gc1) 7> stop RORA_1
Sending STOP request to REPLICAT RORA_1 ...
Request processed.
GGSCI(gc1) 8> info all
Program Status Group Lag Time Since Chkpt
MANAGER RUNNING
EXTRACT RUNNING EORA_1 00:00:00 00:00:01
EXTRACT RUNNING PORA_1 00:00:00 00:00:05
REPLICAT STOPPED RORA_1 00:00:00 00:00:01
gc2:
SQL>update TCUSTMER set CUST_CODE='NEW' WHERENAME='ROCKY FLYER INC.'; --gc2上updata操作
SQL>commit;
SQL>select * from TCUSTMER where CUST_CODE='NEW';
CUST_CODE NAME CITY ST
---------- -------------------------------------------------- --
NEW ROCKY FLYER INC. SHANGHAI CO
gc1:
SQL>select * from TCUSTMER where CUST_CODE='NEW'; --gc1查询。没有同步更改,查询不到
no rows selected
SQL>select * from TCUSTMER where CUST_CODE='JANE'; --gc1上保留的依旧是原数据
CUST_CODE NAME CITY ST
---------- -------------------------------------------------- --
JANE ROCKY FLYER INC. SHANGHAI CO
2、执行veridata显示结果,例如以下:
--veridata捕捉到的不是update操作,而是将其拆分成了insert操作、delete操作
小结:
由上可知,当update主键所在的列时,veridata无法捕获出这是update操作。而是通过对照两张表。将update操作拆分成insert操作、delete操作。
3、处理同步
GGSCI(gc1) 10> start RORA_1
Sending START request to MANAGER ...
REPLICAT RORA_1 starting
GGSCI(gc1) 11> info all
Program Status Group Lag Time Since Chkpt
MANAGER RUNNING
EXTRACT RUNNING EORA_1 00:00:00 00:00:02
EXTRACT RUNNING PORA_1 00:00:00 00:00:00
REPLICAT RUNNING RORA_1 00:12:48 00:00:02
SQL> select * from TCUSTMER where CUST_CODE='NEW';
CUST_CODE NAME CITY ST
---------- -------------------------------------------------- --
NEW ROCKY FLYER INC. SHANGHAI CO
********************未完待续**************************
声明:
原创作品。出自 “深蓝的blog” 博客。同意转载,转载时请务必注明出处(http://blog.csdn.net/huangyanlong)。
关于涉及版权事宜。作者有权追究法律责任。
版权声明:本文博主原创文章,博客,未经同意不得转载。