1. After the test ogg interrupt, resynchronization operation
1.1. Close the source extraction process
GGSCI (cndba) 65> info all
Program Status Group Lag at Chkpt Time Since Chkpt
MANAGER RUNNING
EXTRACT RUNNING EXT1 00:00:00 00:00:09
EXTRACT RUNNING PUMP1 00:00:00 00:00:08
GGSCI (cndba) 66> stop ext1
Sending STOP request to EXTRACT EXT1 ...
Request processed.
GGSCI (cndba) 67> stop pump1
Sending STOP request to EXTRACT PUMP1 ...
Request processed.
GGSCI (cndba) 68> info all
Program Status Group Lag at Chkpt Time Since Chkpt
MANAGER RUNNING
EXTRACT STOPPED EXT1 00:00:00 00:00:04
EXTRACT STOPPED PUMP1 00:00:00 00:00:01
1.2. Close the end goal of the process
GGSCI (cndba) 55> info all
Program Status Group Lag at Chkpt Time Since Chkpt
MANAGER RUNNING
REPLICAT RUNNING REP1 00:00:00 00:00:08
GGSCI (cndba) 56> stop rep1
Sending STOP request to REPLICAT REP1 ...
Request processed.
GGSCI (cndba) 57> info all
Program Status Group Lag at Chkpt Time Since Chkpt
MANAGER RUNNING
REPLICAT STOPPED REP1 00:00:00 00:00:01
1.3 Check the source, the target table data terminal
--源端
SQL> select * from test1;
no rows selected
--目标端
SQL> select * from test1;
no rows selected
1.4. Table source data inserted 100000
记住插入之前的时间2018-06-07 16:15:24,这个时间点很重要,extract 进程要从这个时间开始抽取
SQL> insert into test1 select level,level||'t' from dual connect by level <= 100000;
100000 rows created.
SQL> commit;
Commit complete.
SQL> select count(*) from test1;
COUNT(*)
----------
100000
如果此时开启源端extract进程,目标端replicat,数据同步不会出现问题,现在的操作就是:
1)结束当前的本地日志,重新开始一个日志
2)从当前新生成的序列重新抓取
1.5. Operation source
1.5.1. View the current tail file information
[[email protected] dirdat]# ll
total 12
drwxr-xr-x 2 root root 4096 Jun 7 15:47 backup
-rw-rw-rw- 1 oracle oinstall 1405 Jun 7 16:11 et000000
-rw-rw-rw- 1 oracle oinstall 1016 Jun 7 16:19 et000001
可以看到当前tail文件是1号文件,重启的时候会自动变成2号文件。
1.5.2. Regenerate a new tail file extraction process, delivery process from the new tail began to crawl data file
GGSCI (cndba) 70> alter extract ext1 etrollover
2018-06-07 16:33:40 INFO OGG-01520 Rollover performed. For each affected output trail of Version 10 or higher format, after starting the source extract, issue ALTER EXTSEQNO for that trail's reader (either pump EXTRACT or REPLICAT) to move the reader's scan to the new trail file; it will not happen automatically.
EXTRACT altered.
GGSCI (cndba) 71> alter extract ext1,thread 1,extseqno 2,extrba 0
EXTRACT altered.
GGSCI (cndba) 72> alter extract pump1 etrollover
2018-06-07 16:34:26 INFO OGG-01520 Rollover performed. For each affected output trail of Version 10 or higher format, after starting the source extract, issue ALTER EXTSEQNO for that trail's reader (either pump EXTRACT or REPLICAT) to move the reader's scan to the new trail file; it will not happen automatically.
EXTRACT altered.
GGSCI (cndba) 73> alter extract pump1,thread 1,extseqno 2,extrba 0
EXTRACT altered.
1.5.3. The source data from the start time until the fetch data inserted
GGSCI (cndba) 74> ALTER EXTRACT ext1, TRANLOG, BEGIN 2018-06-07 16:15:24
EXTRACT altered.
1.5.4. Restart the source process
GGSCI (cndba) 58> start ext1
Sending START request to MANAGER ...
EXTRACT EXT1 starting
GGSCI (cndba) 59> start pump1
Sending START request to MANAGER ...
EXTRACT PUMP1 starting
GGSCI (cndba) 64> info all
Program Status Group Lag at Chkpt Time Since Chkpt
MANAGER RUNNING
EXTRACT RUNNING EXT1 00:00:00 00:00:06
EXTRACT RUNNING PUMP1 00:00:00 00:00:01
1.6. Target operating end
1.6.1. Check tail file
可以看到目标端也生成了新的tail文件号,目标端从这个文件应用数据
[[email protected] dirdat]# ll
total 21484
drwxr-xr-x 2 root root 4096 Jun 7 15:48 backup
-rw-rw-rw- 1 oracle oinstall 1444 Jun 7 16:11 et000000
-rw-rw-rw- 1 oracle oinstall 0 Jun 7 16:19 et000001
-rw-rw-rw- 1 oracle oinstall 21989995 Jun 7 16:35 et000002
1.6.2. Set the target segment read process, from start to read the file No. 2
GGSCI (cndba) 74> alter REPLICAT rep1 extseqno 2, extrba 0
REPLICAT altered.
GGSCI (cndba) 75> start rep1
Sending START request to MANAGER ...
REPLICAT REP1 starting
GGSCI (cndba) 76> info all
Program Status Group Lag at Chkpt Time Since Chkpt
MANAGER RUNNING
REPLICAT RUNNING REP1 00:00:00 00:00:04
1.6.3. Check the target-side data
SQL> select count(1) from test1;
COUNT(1)
----------
100000
1.7 Command
--前滚重新生成一个新的队列文件
alter extract xxx etrollover
--从指定时间重新抓取(重新抓取数据前提:归档文件没有删除)
ALTER EXTRACT xxx, TRANLOG, BEGIN 2010-12-31 08:00
--重置抽取进程,本地文件序列号从0开始生成。
alter extract ext1,extseqno 0,extrba 0
--重置读取进程,重新从0号trial文件开始读取。
alter replicat rep1,extseqno 0,extrba 0