用OGG推荐的方法(即INITIAL EXTRACT)一次性抽取,初始化源库到目标库的数据
GGSCI (localdg) 1> dblogin userid system,password ORAcle_123
Successfully logged into database.
GGSCI (localdg) 2> add trandata wxuser.t_test;
2015-12-07 16:50:20 WARNING OGG-00869 No unique key is defined for table 'T_TEST'. All viable columns will be used to represent the key, but may not guarantee uniqueness. KEYCOLS may be used to define the key.
Logging of supplemental redo data enabled for table WXUSER.T_TEST.
GGSCI (localdg) 3> info trandata wxuser.t_test;
ERROR: No viable tables matched specification.
GGSCI (localdg) 4> info trandata wxuser.*
Logging of supplemental redo log data is enabled for table WXUSER.T_TEST.
Columns supplementally logged for table WXUSER.T_TEST: ID, A1, A2.
源数据库增加extract进程组einit并配置参数
GGSCI (localdg) 5> add extract einit,sourceistable
EXTRACT added.
GGSCI (localdg) 6> edit params einit
extract einit
userid system,password ORAcle_123
rmthost 192.168.40.96,mgrport 7809
rmttask replicat,group rinit
table wxuser.t_test;
GGSCI (localdg) 7> info extract *,tasks
EXTRACT EINIT Initialized 2015-12-07 16:57 Status STOPPED
Checkpoint Lag Not Available
Log Read Checkpoint Not Available
First Record Record 0
Task SOURCEISTABLE
看到Task SOURCEISTABLE
目标库增加replicat组rinit并配置参数
GGSCI (fk-db1) 1> add replicat rinit,specialrun
REPLICAT added.
GGSCI (fk-db1) 2> edit params rinit
replicat rinit
assumetargetdefs --表示是同构表(相同数据库软件之间的复制,如:oracle-oracle)
userid system,password ORAcle_123
discardfile ./dirrpt/rinit.dsc,purge
map wxuser.*,target fkuser.*;
GGSCI (fk-db1) 3> info replicat *,task
REPLICAT RINIT Initialized 2015-12-07 17:00 Status STOPPED
Checkpoint Lag 00:00:00 (updated 00:02:49 ago)
Log Read Checkpoint Not Available
Task SPECIALRUN
看到Task SPECIALRUN
INITIALEXTRACT是通过配置rmttask参数来指定的,SOURCEISTABLE表示初始化整个表,SPECIALRUN表示只抽取一次,这个是OGG初始化抽取必须配置的几个参数,注意,此处不用配置EXTTRAIL/RMTTRAIL参数
启动源库extract并查看源库extract报告
GGSCI (localdg) 10> start extract einit
Sending START request to MANAGER ...
EXTRACT EINIT starting
GGSCI (localdg) 11> view report einit
From Table WXUSER.T_TEST:
# inserts: 39
# updates: 0
# deletes: 0
# discards: 0
查看目标库replicat报告
GGSCI (fk-db1) 6> view report rinit
From Table WXUSER.T_TEST to FKUSER.T_TEST:
# inserts: 39
# updates: 0
# deletes: 0
# discards: 0
注意:用INITIAL EXTRACT进行一次性抽取初始化数据时,目标库的replicat进程不用手动启动,只要源库的extract进程start以后,自动会同步到目标库,而且此时用info all是看不到extract和replicat进程的,只能看见mgr进程
通过replicat的report信息中已经知道,数据应该已经从源库同步到目标库了,现在通过查看目标库的测试表,发现数据确实已经同步过来了
至此,初始化数据装载结束。
GGSCI (localdg) 1> dblogin userid system,password ORAcle_123
Successfully logged into database.
GGSCI (localdg) 2> add trandata wxuser.t_test;
2015-12-07 16:50:20 WARNING OGG-00869 No unique key is defined for table 'T_TEST'. All viable columns will be used to represent the key, but may not guarantee uniqueness. KEYCOLS may be used to define the key.
Logging of supplemental redo data enabled for table WXUSER.T_TEST.
GGSCI (localdg) 3> info trandata wxuser.t_test;
ERROR: No viable tables matched specification.
GGSCI (localdg) 4> info trandata wxuser.*
Logging of supplemental redo log data is enabled for table WXUSER.T_TEST.
Columns supplementally logged for table WXUSER.T_TEST: ID, A1, A2.
源数据库增加extract进程组einit并配置参数
GGSCI (localdg) 5> add extract einit,sourceistable
EXTRACT added.
GGSCI (localdg) 6> edit params einit
extract einit
userid system,password ORAcle_123
rmthost 192.168.40.96,mgrport 7809
rmttask replicat,group rinit
table wxuser.t_test;
GGSCI (localdg) 7> info extract *,tasks
EXTRACT EINIT Initialized 2015-12-07 16:57 Status STOPPED
Checkpoint Lag Not Available
Log Read Checkpoint Not Available
First Record Record 0
Task SOURCEISTABLE
看到Task SOURCEISTABLE
目标库增加replicat组rinit并配置参数
GGSCI (fk-db1) 1> add replicat rinit,specialrun
REPLICAT added.
GGSCI (fk-db1) 2> edit params rinit
replicat rinit
assumetargetdefs --表示是同构表(相同数据库软件之间的复制,如:oracle-oracle)
userid system,password ORAcle_123
discardfile ./dirrpt/rinit.dsc,purge
map wxuser.*,target fkuser.*;
GGSCI (fk-db1) 3> info replicat *,task
REPLICAT RINIT Initialized 2015-12-07 17:00 Status STOPPED
Checkpoint Lag 00:00:00 (updated 00:02:49 ago)
Log Read Checkpoint Not Available
Task SPECIALRUN
看到Task SPECIALRUN
INITIALEXTRACT是通过配置rmttask参数来指定的,SOURCEISTABLE表示初始化整个表,SPECIALRUN表示只抽取一次,这个是OGG初始化抽取必须配置的几个参数,注意,此处不用配置EXTTRAIL/RMTTRAIL参数
启动源库extract并查看源库extract报告
GGSCI (localdg) 10> start extract einit
Sending START request to MANAGER ...
EXTRACT EINIT starting
GGSCI (localdg) 11> view report einit
From Table WXUSER.T_TEST:
# inserts: 39
# updates: 0
# deletes: 0
# discards: 0
查看目标库replicat报告
GGSCI (fk-db1) 6> view report rinit
From Table WXUSER.T_TEST to FKUSER.T_TEST:
# inserts: 39
# updates: 0
# deletes: 0
# discards: 0
注意:用INITIAL EXTRACT进行一次性抽取初始化数据时,目标库的replicat进程不用手动启动,只要源库的extract进程start以后,自动会同步到目标库,而且此时用info all是看不到extract和replicat进程的,只能看见mgr进程
通过replicat的report信息中已经知道,数据应该已经从源库同步到目标库了,现在通过查看目标库的测试表,发现数据确实已经同步过来了
至此,初始化数据装载结束。