以下是我的配置和构建过程
---------------------------------环境---------------------------------
source node :10.138.60.22
mysql version : 5.6.15
os user : oracle
db user : mysync
db name : sdb
os version : centos 6.5
goldengate uncompressed path : /usr/ogg
target node :10.100.12.12
oracle version : 11.0.2.0.3
os user : oracle
db user: mysync
os version : centos 6.5
goldengate uncompressed path : /usr/ogg
goldengate version :12.1.2.1
---------------------------------环境---------------------------------
---------------------------------安装---------------------------------
1、在源端和目标端都安装goldengate
[oracle@* ~]$ cd /usr/ogg/
[oracle@* ogg]$ ./ggsci
GGSCI (*) 1> create subdirs
---------------------------------安装---------------------------------
---------------------------------初始化配置---------------------------------
######source node######
1、配置mgr
GGSCI > dblogin sourcedb sdb@10.138.60.22:3306,userid mysync,password MySync
GGSCI > edit param mgr
port 8899
dynamicportlist 8910-8920, 8930
AUTOSTART ER *
AUTORESTART ER *, RETRIES 4, WAITMINUTES 4
STARTUPVALIDATIONDELAY 5
PURGEOLDEXTRACTS /usr/ogg/dirdat/*, USECHECKPOINTS, MINKEEPHOURS 2
2、配置初始化extract
GGSCI > add extract extinit0, sourceistable
GGSCI > edit param extinit0
extract extinit0
dboptions host 10.138.60.22, connectionport 3306
sourcedb sdb@10.138.60.22:3306,userid mysync,password MySync
rmthost 10.100.12.12, mgrport 8899
rmttask replicat, group repinit0
table sdb.*;
3、配置 defgen
GGSCI> edit params defgen
defsfile ./dirdef/source.def, purge
sourcedb sdb@10.138.60.22:3306,userid mysync,password MySync
sdb.t1;
4、构建source.def 文件并传输到目标端
[oracle@* ~]$ cd /usr/ogg/
[oracle@* ogg]$ ./defgen paramfile ./dirprm/defgen.prm
[oracle@* ogg]$ scp dirdef/source.def oracle@10.100.12.12:/usr/ogg/dirdef/sdb
######source node######
$$$$$$target node$$$$
1、配置mgr
GGSCI> dblogin userid mysync,password mysync
GGSCI> edit params mgr
port 8899
dynamicportlist 8910-8920, 8930
AUTOSTART ER *
AUTORESTART ER *, RETRIES 4, WAITMINUTES 4
STARTUPVALIDATIONDELAY 5
PURGEOLDEXTRACTS /usr/ogg/dirdat/*, USECHECKPOINTS, MINKEEPHOURS 2
2、配置 checkpointtable
GGSCI> add checkpointtable mysync.rep_checkpoint
3、配置 初始化 replicat
GGSCI> add replicat repinit0, exttrail /usr/ogg/dirdat/e0, checkpointtable mysync.rep_checkpoint
GGSCI> edit param repinit0
replicat repinit0
userid mysync, password mysync
sourcedefs ./dirdef/sdb/source.def
discardfile ./dirrpt/repinit0.dsc, purge
map sdb.t1, target mysync.t1;
$$$$$$target node$$$$
---------------------------------初始化配置---------------------------------
---------------------------------同步配置---------------------------------
######source node######
1、配置同步extract
GGSCI> add extract v203app,tranlog,begin now
GGSCI> edit param v203app
extract v203app
dboptions host 10.138.60.22,connectionport 3306
sourcedb sdb@10.138.60.22:3306,userid mysync,password MySync
rmthost 10.100.12.12,mgrport 8899
rmttrail /usr/ogg/dirdat/e0
tranlogoptions altlogdest /var/lib/mysql/binary-log.index
table sdb.*;
2、配置 remote trail
GGSCI> add rmttrail /usr/ogg/dirdat/e0,extract v203app
######source node######
$$$$$$target node$$$$
1、配置同步 replicat
GGSCI> add replicat r203papp, exttrail /usr/ogg/dirdat/e0, checkpointtable mysync.rep_checkpoint
GGSCI> edit param r203papp
replicat r203papp
userid mysync, password mysync
handlecollisions
assumetargetdefs
sourcedefs /usr/ogg/dirdef/sdb/source.def
discardfile /usr/ogg/dirrpt/r203papp.dsc, purge
map sdb.t1, target mysync.t1;
$$$$$$target node$$$$
---------------------------------同步配置---------------------------------
---------------------------------开始同步---------------------------------
$$$$$$target node$$$$
GGSCI> start replicat r203papp
$$$$$$target node$$$$
######source node######
GGSCI> start extract v203app
######source node######
---------------------------------开始同步---------------------------------
---------------------------------测试同步---------------------------------
######source node######
insert into t1 (c1,c2,c3,c4,c5,c6) values (1,'a',0,'a',now(),'a');
commit;
######source node######
$$$$$$target node$$$$
%%%%%%error message1%%%%%%
in target ggserr.log
error ogg-01163 oracle goldengate delivery for oracle, r203papp.prm: bad column length (8) specified for column c3 in table sdb.t1, maximum allowable length is 4.
action:modify table t1 definition on the target node
alter table t1 modify c3 varchar(20);
%%%%%%error message1%%%%%%
restarted replicat r204papp but met another error
%%%%%%error message2%%%%%%
Sending START request to MANAGER ...
ERROR: Cannot create process '/usr/ogg/replicat'. Child process is no longer alive
.
WARNING OGG-01742 Command sent to MGR MGR returned with an ERROR response.
%%%%%%error message2%%%%%%
$$$$$$target node$$$$
---------------------------------测试同步---------------------------------
---------------------------------原端表定义语句---------------------------------
create table t1 (
c1 bigint(20) not null unique auto_increment,
c2 varchar(30) not null unique,
c3 int(20) default 0 not null ,
c4 varchar(11) not null unique,
c5 timestamp not null default current_timestamp,
c6 varchar(20) not null
) engine=innodb default charset=utf8;
alter table t1 add constraint pk_t1_c1 primary key (c1);
create index idx_t1_c3 on t1(c3);
---------------------------------原端表定义语句---------------------------------
---------------------------------目标端表定义语句---------------------------------
create table t1 (
c1 number(20) not null unique,
c2 varchar(30) not null unique,
c3 number(20) default 0 not null ,
c4 varchar(11) not null unique,
c5 timestamp default sysdate not null,
c6 varchar(20) not null
) ;
alter table t1 add constraint pk_t1_c1 primary key (c1);
create index idx_t1_c3 on t1(c3);
---------------------------------目标端表定义语句---------------------------------
现在卡在错误信息那边,请教论坛的里的大神,究竟该怎么做才可以正常同步?