如何将表中,漏掉同步的数据进行同步。
测试:
(1)保持源端进程开启,关闭目标端进程,在源端进行数据写入完成后,再开启目标端进程,观察数据是否会同步:
源端: SQL> insert into ogg_src.togg(id,name,type) values(1015,'sywu','user'); SQL> insert into ogg_src.togg(id,name,type) values(1016,'sywu','user'); SQL> insert into ogg_src.togg(id,name,type) values(1017,'sywu','user'); SQL> insert into ogg_src.togg(id,name,type) values(1018,'sywu','user'); 4 row created. 目标端:当前服务停止: GGSCI (ORACLEOGG2) 24> info all Program Status Group Lag at Chkpt Time Since Chkpt MANAGER STOPPED REPLICAT STOPPED RSYDB001 00:00:00 00:03:24 目标端:开启线程,并查看(结果显示数据已同步) GGSCI (ORACLEOGG2) 25> start mgr Manager started. GGSCI (ORACLEOGG2) 26> info all Program Status Group Lag at Chkpt Time Since Chkpt MANAGER RUNNING REPLICAT RUNNING RSYDB001 00:35:17 00:00:00 GGSCI (ORACLEOGG2) 27> stats rsydb001 Sending STATS request to REPLICAT RSYDB001 ... Start of Statistics at 2019-06-21 16:32:30. Replicating from OGG_SRC.TOGG to OGG_TRG.TOGG: *** Total statistics since 2019-06-21 16:32:23 *** Total inserts 4.00 Total updates 0.00 Total deletes 0.00 Total upserts 0.00 Total discards 0.00 Total operations 4.00 *** Daily statistics since 2019-06-21 16:32:23 *** Total inserts 4.00 Total updates 0.00 Total deletes 0.00 Total upserts 0.00 Total discards 0.00 Total operations 4.00 *** Hourly statistics since 2019-06-21 16:32:23 *** Total inserts 4.00 Total updates 0.00 Total deletes 0.00 Total upserts 0.00 Total discards 0.00 Total operations 4.00 *** Latest statistics since 2019-06-21 16:32:23 *** Total inserts 4.00 Total updates 0.00 Total deletes 0.00 Total upserts 0.00 Total discards 0.00 Total operations 4.00 End of Statistics.
查询两端数据数量
SQL> select count(*) from ogg_src.togg; COUNT(*) ---------- 1013 SQL> select count(*) from ogg_trg.togg; COUNT(*) ---------- 1013
(2)关闭源端进程,保持目的端进程开启,在源端进行数据写入完成后,再开启源端进程,观察数据是否会同步:
关闭源端进程: GGSCI (ORACLEOGG1) 80> stop mgr GGSCI (ORACLEOGG1) 81> stop esydb001 GGSCI (ORACLEOGG1) 82> stop psydb001 源端插入数据: SQL> insert into ogg_src.togg(id,name,type) values(1019,'sywu','user'); 1 row created. 开启源端进程,并查看信息: GGSCI (ORACLEOGG1) 84> start mgr Manager started. GGSCI (ORACLEOGG1) 85> info all Program Status Group Lag at Chkpt Time Since Chkpt MANAGER RUNNING EXTRACT RUNNING ESYDB001 00:00:00 00:00:00 EXTRACT STOPPED PSYDB001 00:00:00 00:01:34 GGSCI (ORACLEOGG1) 86> info all Program Status Group Lag at Chkpt Time Since Chkpt MANAGER RUNNING EXTRACT RUNNING ESYDB001 00:00:00 00:00:04 EXTRACT STOPPED PSYDB001 00:00:00 00:01:38 GGSCI (ORACLEOGG1) 87> info all Program Status Group Lag at Chkpt Time Since Chkpt MANAGER RUNNING EXTRACT RUNNING ESYDB001 00:00:00 00:00:08 EXTRACT RUNNING PSYDB001 00:00:00 00:01:42 GGSCI (ORACLEOGG1) 88> stats esydb001 Sending STATS request to EXTRACT ESYDB001 ... Start of Statistics at 2019-06-21 16:46:06. Output to /data/u01/app/oracle/product/ogg_src/dirdat/es: Extracting from OGG_SRC.TOGG to OGG_SRC.TOGG: *** Total statistics since 2019-06-21 16:45:53 *** Total inserts 1.00 Total updates 0.00 Total deletes 0.00 Total upserts 0.00 Total discards 0.00 Total operations 1.00 *** Daily statistics since 2019-06-21 16:45:53 *** Total inserts 1.00 Total updates 0.00 Total deletes 0.00 Total upserts 0.00 Total discards 0.00 Total operations 1.00 *** Hourly statistics since 2019-06-21 16:45:53 *** Total inserts 1.00 Total updates 0.00 Total deletes 0.00 Total upserts 0.00 Total discards 0.00 Total operations 1.00 *** Latest statistics since 2019-06-21 16:45:53 *** Total inserts 1.00 Total updates 0.00 Total deletes 0.00 Total upserts 0.00 Total discards 0.00 Total operations 1.00 End of Statistics. GGSCI (ORACLEOGG1) 89> stats psydb001 Sending STATS request to EXTRACT PSYDB001 ... Start of Statistics at 2019-06-21 16:46:13. Output to /data/u01/app/oracle/product/ogg_trg/dirdat/ps: Extracting from OGG_SRC.TOGG to OGG_SRC.TOGG: *** Total statistics since 2019-06-21 16:46:03 *** Total inserts 1.00 Total updates 0.00 Total deletes 0.00 Total upserts 0.00 Total discards 0.00 Total operations 1.00 *** Daily statistics since 2019-06-21 16:46:03 *** Total inserts 1.00 Total updates 0.00 Total deletes 0.00 Total upserts 0.00 Total discards 0.00 Total operations 1.00 *** Hourly statistics since 2019-06-21 16:46:03 *** Total inserts 1.00 Total updates 0.00 Total deletes 0.00 Total upserts 0.00 Total discards 0.00 Total operations 1.00 *** Latest statistics since 2019-06-21 16:46:03 *** Total inserts 1.00 Total updates 0.00 Total deletes 0.00 Total upserts 0.00 Total discards 0.00 Total operations 1.00 查看目标端信息:(原数量是4,现在变为5,说明有数据传输) GGSCI (ORACLEOGG2) 30> stats rsydb001 Sending STATS request to REPLICAT RSYDB001 ... Start of Statistics at 2019-06-21 16:51:32. Replicating from OGG_SRC.TOGG to OGG_TRG.TOGG: *** Total statistics since 2019-06-21 16:32:23 *** Total inserts 5.00 Total updates 0.00 Total deletes 0.00 Total upserts 0.00 Total discards 0.00 Total operations 5.00 *** Daily statistics since 2019-06-21 16:32:23 *** Total inserts 5.00 Total updates 0.00 Total deletes 0.00 Total upserts 0.00 Total discards 0.00 Total operations 5.00 *** Hourly statistics since 2019-06-21 16:32:23 *** Total inserts 5.00 Total updates 0.00 Total deletes 0.00 Total upserts 0.00 Total discards 0.00 Total operations 5.00 *** Latest statistics since 2019-06-21 16:32:23 *** Total inserts 5.00 Total updates 0.00 Total deletes 0.00 Total upserts 0.00 Total discards 0.00 Total operations 5.00 查看目标端数量:(原数量是1013,现在为1014) SQL> select count(*) from ogg_trg.togg; COUNT(*) ---------- 1014
(3)关闭源端、目的端进程,在源端进行数据写入完成后,再目的端进程、开启源端,观察数据是否会同步:
根据测试,开启后,数据仍然进行同步
GGSCI (ORACLEOGG1) 115> stats esydb001 Sending STATS request to EXTRACT ESYDB001 ... Start of Statistics at 2019-06-22 16:11:36. Output to /data/u01/app/oracle/product/ogg_src/dirdat/es: Extracting from OGG_SRC.TOGG to OGG_SRC.TOGG: *** Total statistics since 2019-06-22 16:11:21 *** Total inserts 1.00 Total updates 0.00 Total deletes 0.00 Total upserts 0.00 Total discards 0.00 Total operations 1.00 *** Daily statistics since 2019-06-22 16:11:21 *** Total inserts 1.00 Total updates 0.00 Total deletes 0.00 Total upserts 0.00 Total discards 0.00 Total operations 1.00 *** Hourly statistics since 2019-06-22 16:11:21 *** Total inserts 1.00 Total updates 0.00 Total deletes 0.00 Total upserts 0.00 Total discards 0.00 Total operations 1.00 *** Latest statistics since 2019-06-22 16:11:21 *** Total inserts 1.00 Total updates 0.00 Total deletes 0.00 Total upserts 0.00 Total discards 0.00 Total operations 1.00 End of Statistics. GGSCI (ORACLEOGG1) 116> stats psydb001 Sending STATS request to EXTRACT PSYDB001 ... Start of Statistics at 2019-06-22 16:11:40. Output to /data/u01/app/oracle/product/ogg_trg/dirdat/ps: Extracting from OGG_SRC.TOGG to OGG_SRC.TOGG: *** Total statistics since 2019-06-22 16:11:29 *** Total inserts 1.00 Total updates 0.00 Total deletes 0.00 Total upserts 0.00 Total discards 0.00 Total operations 1.00 *** Daily statistics since 2019-06-22 16:11:29 *** Total inserts 1.00 Total updates 0.00 Total deletes 0.00 Total upserts 0.00 Total discards 0.00 Total operations 1.00 *** Hourly statistics since 2019-06-22 16:11:29 *** Total inserts 1.00 Total updates 0.00 Total deletes 0.00 Total upserts 0.00 Total discards 0.00 Total operations 1.00 *** Latest statistics since 2019-06-22 16:11:29 *** Total inserts 1.00 Total updates 0.00 Total deletes 0.00 Total upserts 0.00 Total discards 0.00 Total operations 1.00 End of Statistics. GGSCI (ORACLEOGG2) 35> stats rsydb001 Sending STATS request to REPLICAT RSYDB001 ... No active replication maps. GGSCI (ORACLEOGG2) 36> stats rsydb001 Sending STATS request to REPLICAT RSYDB001 ... Start of Statistics at 2019-06-22 16:11:56. Replicating from OGG_SRC.TOGG to OGG_TRG.TOGG: *** Total statistics since 2019-06-22 16:11:35 *** Total inserts 1.00 Total updates 0.00 Total deletes 0.00 Total upserts 0.00 Total discards 0.00 Total operations 1.00 *** Daily statistics since 2019-06-22 16:11:35 *** Total inserts 1.00 Total updates 0.00 Total deletes 0.00 Total upserts 0.00 Total discards 0.00 Total operations 1.00 *** Hourly statistics since 2019-06-22 16:11:35 *** Total inserts 1.00 Total updates 0.00 Total deletes 0.00 Total upserts 0.00 Total discards 0.00 Total operations 1.00 *** Latest statistics since 2019-06-22 16:11:35 *** Total inserts 1.00 Total updates 0.00 Total deletes 0.00 Total upserts 0.00 Total discards 0.00 Total operations 1.00 End of Statistics. SQL> select count(*) from ogg_src.togg; COUNT(*) ---------- 1015 SQL> select count(*) from ogg_trg.togg; COUNT(*) ---------- 1015wu
文章评论