--实验:对于仅有dml同步的goldengate进程,如果源端进行ddl加字段操作,如何处理对应的进程
--源端orcl
--首先检查进程状态,running状态:
[Oracle@localhost ogg]$ ./ggsci
GGSCI (localhost.localdomain) 1> info all
Program Status Group Lag at Chkpt Time Since Chkpt
MANAGER RUNNING
EXTRACT RUNNING DPUMP1 00:00:00 00:00:08
EXTRACT RUNNING EXT1 00:00:00 00:00:06
--停止抽取进程及传输进程:
GGSCI (localhost.localdomain) 2> stop *
Sending STOP request to EXTRACT DPUMP1 ...
Request processed.
Sending STOP request to EXTRACT EXT1 ...
Request processed.
GGSCI (localhost.localdomain) 3> info all
Program Status Group Lag at Chkpt Time Since Chkpt
MANAGER RUNNING
EXTRACT STOPPED DPUMP1 00:00:00 00:00:11
EXTRACT STOPPED EXT1 00:00:00 00:00:09
--目标端orcltest
--确认复制进程状态为running,并停掉进程:
GGSCI (localhost.localdomain) 8> info all
Program Status Group Lag at Chkpt Time Since Chkpt
MANAGER RUNNING
REPLICAT RUNNING REP1 00:00:00 00:00:06
GGSCI (localhost.localdomain) 9> stop *
Sending STOP request to REPLICAT REP1 ...
Request processed.
--源端orcl
--对同步的表添加一个字段
[oracle@localhost ogg]$ sqlplus / as sysdba
SQL> alter table ggs.test add new_col varchar2(10);
Table altered.
SQL> exit
--目标端orcltest
--同样添加字段:
[oracle@localhost ogg]$ sqlplus / as sysdba
SQL> alter table ggs.test add new_col varchar2(10);
Table altered.
SQL> exit
--源端orcl
--启动抽取,传输进程
[oracle@localhost ogg]$ ./ggsci
GGSCI (localhost.localdomain) 2> start *
Sending START request to MANAGER ...
EXTRACT DPUMP1 starting
Sending START request to MANAGER ...
EXTRACT EXT1 starting
GGSCI (localhost.localdomain) 4> info all
Program Status Group Lag at Chkpt Time Since Chkpt
MANAGER RUNNING
EXTRACT RUNNING DPUMP1 00:40:12 00:00:04
EXTRACT RUNNING EXT1 00:02:55 00:00:08
--目标端orcltest
--启动复制进程
[oracle@localhost ogg]$ ./ggsci
GGSCI (localhost.localdomain) 2> start *
Sending START request to MANAGER ...
REPLICAT REP1 starting
GGSCI (localhost.localdomain) 5> info all
Program Status Group Lag at Chkpt Time Since Chkpt
MANAGER RUNNING
REPLICAT RUNNING REP1 00:00:00 00:00:01
--源端orcl
--进行数据修改测试
[oracle@localhost ~]$ sqlplus / as sysdba
SQL> select count(*) from ggs.test;
COUNT(*)
----------
33
SQL> delete from ggs.test where rownum<5;
4 rows deleted.
SQL> commit;
Commit complete.
SQL> insert into ggs.test (username,user_id,account_status,default_tablespace,temporary_tablespace,created,profile,new_col)
values ('a','7','open','one','temp',sysdate,'default','test'); 2
1 row created.
SQL> commit;
Commit complete.
SQL>
--目标端orcltest
--对应的测试结果:结果正确,说明同步进程是正常的
SQL> select count(1) from ggs.test;
COUNT(1)
----------
29
SQL> select count(*) from ggs.test;
COUNT(*)
----------
30
SQL> exit