标签:
创建目录
mkdir -p /opt/ogg
chmod -R 777 /opt/ogg
chown -R oracle:oinstall /opt/ogg
?
ogg用户????
useradd -g oinstall -G dba ggate
?
配置goldengate用户变量
su – ggate
export ORACLE_BASE=/u01/app/oracle
export ORACLE_HOME=$ORACLE_BASE/product/11.2.0/dbhome_1
export ORACLE_SID=prm
export LD_LIBRARY_PATH=$ORACLE_HOME/lib:/u01/app/oracle/ggate
export GGATE=/opt/ogg
export LD_LIBRARY_PATH=$ORACLE_HOME/lib:/lib:/usr/lib
export PATH=$PATH:$ORACLE_HOME/bin:$GGATE
????图形化安装方法中,在software location部分选择环境变量中GGATE的值,不过要注意给GGATE目录适当的权限;
????Database Location部分就是ORACLE_HOME的值。
创建目录
mkdir -p /opt/ogg
chmod -R 755 /opt/ogg
chown -R oracle:oinstall /opt/ogg
?
ogg用户????
useradd -g oinstall -G dba ggate
配置goldengate用户变量
su – ggate
export ORACLE_BASE=/u01/app/oracle
export ORACLE_HOME=$ORACLE_BASE/product/11.2.0/dbhome_1
export ORACLE_SID=prm
export LD_LIBRARY_PATH=$ORACLE_HOME/lib:/u01/app/oracle/ggate
export GGATE=/opt/ogg
export LD_LIBRARY_PATH=$ORACLE_HOME/lib:/lib:/usr/lib
export PATH=$PATH:$ORACLE_HOME/bin:$GGATE
????图形化安装方法中,在software location部分选择环境变量中GGATE的值,不过要注意给GGATE目录适当的权限;
????Database Location部分就是ORACLE_HOME的值。
开启归档
修改之前 创建参数文件做备份
?
create pfile=‘/home/oracle/initdemo.ora‘ from spfile;
alter system set log_archive_dest=‘/arch/prm‘ scope=spfile; --修改归档的路径
---alter system set db_recovery_file_dest=‘‘ scope=spfile; --关闭闪回
shutdown immediate;
startup mount;
alter database archivelog;
archive log list;
alter database open;
实际生产应用中,最好同时打开ORACLE的强制日志模式,以防止源数据库因直接路径加载忽略redo生成而导致这部分数据无法同步:
SQL> select force_logging from v$database;
SQL> Alter database force logging;
?
Oracle数据库需要开启归档日志,并开启最小附加日志模式。
SQL> select supplemental_log_data_min from v$database; --查看是否开启了最小附加日志模式
SQL> alter database add supplemental log data; --开启最小附加日志模式
?
千万不要小看这步日志设置,其实在GoldenGate的配置中,这步是最容易出错的环节。如果开启DDL复制做冗灾备份,最好直接在数据库级别打开补全日志:
SQL> alter database add supplemental log data (primary key,unique,foreign key) columns;
检查一下,全是YES就OK了(整个数据库级别补全)
SQL> select supplemental_log_data_min,
supplemental_log_data_pk,supplemental_log_data_ui from v$database;
SQL>?show?parameter?recyclebin??
SQL>?alter?system?set?recyclebin=off scope=spfile;
SQL>shutdown immediate;
SQL>startup;
SQL>?show?parameter?recyclebin
?
alter?system?set?undo_retention=86400;??
创建表空间、用户、赋予dba权限
create tablespace ogg datafile ‘/u01/app/oracle/oradata/prm/ogg01.dbf‘ size 1024M;
create user ggate identified by ggate default tablespace ogg temporary tablespace temp;
grant connect,resource,unlimited tablespace to ggate;
grant connect,resource,dba to ggate;
grant execute on utl_file to ggate;
grant select any dictionary,select any table to ggate;
grant alter any table to ggate;
grant flashback any table to ggate;
grant execute on DBMS_FLASHBACK to ggate;
grant insert any table to ggate;
grant delete any table to ggate;
grant update any table to ggate;
?
运行DDL同步需要的脚本
cd $GGATE
@marker_setup.sql;
@ddl_setup.sql;
@role_setup.sql;
grant GGS_GGSUSER_ROLE to ggate;
@ddl_enable.sql;
?
安装性能优化包。
SQL> @?/rdbms/admin/dbmspool
?
ddl_pin将触发器用到的plsql包放进内存中
cd $GGATE??
SQL>?@ddl_pin?ggate
?
光开启最小附加日志模式还不够,还需要打开表级的补全日志,可以在GoldenGate中使用add trandata命令强制重做日志记录主键值,以保证在目标端能成功复制:
GGSCI> dblogin userid ggate,password ggate --GoldenGate中登录OARCLE数据库
GGSCI>add trandata sender.* --表名可以使用通配符
GGSCI> add trandata coss3.per_test,nokey,cols(sampletime, objectid)
--无主键指定字段补全的示例
?
也可以在数据库中打开:
SQL> alter table <tablename> add supplemental log data (primary key) columns;
?
?
?
示例:
GGSCI(node1) 1> dblogin userid ogg,password oracle
GGSCI(node1) 2> add trandata SCOTT.DEPT
?
GGSCI(node1) 1> edit param mgr
(粘贴下面这段配置)
PORT 8839
--DYNAMICPORTLIST 8000-9000
--AUTOSTART ER *
AUTORESTART EXTRACT *,RETRIES 5,WAITMINUTES 3
PURGEOLDEXTRACTS ./dirdat/*,usecheckpoints, minkeepdays 3
--PURGEDDLHISTORY MINKEEPDAYS 3, MAXKEEPDAYS 5, FREQUENCYMINUTES 30
--PURGEMARKERHISTORY MINKEEPDAYS 3, MAXKEEPDAYS 5, FREQUENCYMINUTES 30
LAGREPORTHOURS 1
LAGINFOMINUTES 30
LAGCRITICALMINUTES 45
GGSCI?(node1)?>?edit?params?./GLOBALS??
GGSCHEMA?ggate
?
GGSCI(node1) 2> start mgr
Managerstarted.
GGSCI(node1) 3> info all
Program Status Group Lag at Chkpt Time Since Chkpt
MANAGER RUNNING
增加EXTRAIL
GGSCI(node1)> add extract extnd, tranlog, begin now
EXTRACT added.
?
修改EXTRAIL参数
GGSCI (GOLDENGATE1) 4> edit params extnd
EXTRACT extnd
SETENV (NLS_LANG = "AMERICAN_AMERICA.UTF8")
SETENV (ORACLE_HOME = "/u01/app/oracle/product/11.2.0/dbhome_1")
SETENV (ORACLE_SID = "prm")
USERID ggate, PASSWORD ggate
EXTTRAIL ./dirdat/nd
DISCARDFILE ./dirdat/extnd.dsc,APPEND,MEGABYTES 5
TRANLOGOPTIONS ALTARCHIVELOGDEST /arch/prm
TRANLOGOPTIONS ALTARCHIVEDLOGFORMAT %t_%s_%r.dbf
DDL INCLUDE ALL
DDLOPTIONS ADDTRANDATA
FETCHOPTIONS, USESNAPSHOT, NOUSELATESTVERSION, MISSINGROW REPORT
STATOPTIONS REPORTFETCH
WARNLONGTRANS 1H, CHECKINTERVAL 5M
TABLE sender.*;
?
添加该extract对应的trail文件,用来存储抽取的数据。单个文件大小设置为100MB
GGSCI(node1)> add exttrail ./dirdat/nd, extract extnd, megabytes 100
EXTTRAIL added.
增加PUMP
GGSCI(node1)>add extract dpend, exttrailsource ./dirdat/nd, begin now
EXTRACT added.
?
修改PUMP参数
GGSCI(node1)> edit params dpend
EXTRACT dpend
SETENV (NLS_LANG = "AMERICAN_AMERICA.UTF8")
USERID ggate, PASSWORD ggate
RMTHOST 192.168.80.166, MGRPORT 8809
RMTTRAIL ./dirdat/nd
DISCARDFILE ./dirdat/dpend.dsc,APPEND,MEGABYTES 5
TABLE sender.*;
?
添加RMTRAILS
GGSCI(node1)> add rmttrail ./dirdat/nd, extract dpend, megabytes 100
RMTTRAIL added.
创建表空间、用户、赋予dba权限
create tablespace ogg datafile ‘/u01/app/oracle/oradata/prm/ogg01.dbf‘ size 1024M;
create user ggate identified by ggate default tablespace ogg temporary tablespace temp;
grant connect,resource,unlimited tablespace to ggate;
grant connect,resource,dba to ggate;
grant execute on utl_file to ggate;
grant select any dictionary,select any table to ggate;
grant alter any table to ggate;
grant flashback any table to ggate;
grant execute on DBMS_FLASHBACK to ggate;
grant insert any table to ggate;
grant delete any table to ggate;
grant update any table to ggate;
?
运行DDL同步需要的脚本
@$GGATE/marker_setup.sql;
@$GGATE/ddl_setup.sql;
@$GGATE/role_setup.sql;
grant GGS_GGSUSER_ROLE to ggate;
@$GGATE/ddl_enable.sql;
?
安装性能优化包。
SQL> @?/rdbms/admin/dbmspool
?
ddl_pin将触发器用到的plsql包放进内存中??
SQL>?@ddl_pin?ggate
?
GGSCI(node2) 1> edit param mgr
(粘贴下面这段配置)
PORT 8839
--DYNAMICPORTLIST 8000-9000
--AUTOSTART ER *
AUTORESTART EXTRACT *,RETRIES 5,WAITMINUTES 3
PURGEOLDEXTRACTS ./dirdat/*,usecheckpoints, minkeepdays 3
--PURGEDDLHISTORY MINKEEPDAYS 3, MAXKEEPDAYS 5, FREQUENCYMINUTES 30
--PURGEMARKERHISTORY MINKEEPDAYS 3, MAXKEEPDAYS 5, FREQUENCYMINUTES 30
LAGREPORTHOURS 1
LAGINFOMINUTES 30
LAGCRITICALMINUTES 45
GGSCI (node2)> edit params ./GLOBALS
GGSCHEMA ggate
CHECKPOINTTABLE ggate.chkpoint
需要先退出ggsci
GGSCI (node2)> dblogin userid ggate, password ggate
Successfully logged into database.
?
GGSCI (node2)> add checkpointtable ggate.chkpoint
Successfully created checkpoint table goldengate.chkpoint.
?
增加目标端REP
GGSCI (node2)> add replicat repnd, exttrail ./dirdat/nd, checkpointtable ggate.chkpoint
REPLICAT added.
?
修改REP参数
GGSCI (node2)> edit params repnd
REPLICAT repnd
ASSUMETARGETDEFS
USERID ggate, PASSWORD ggate
DISCARDFILE ./dirrpt/repnd.dsc,APPEND,MEGABYTES 5
DDL INCLUDE ALL
DDLOPTIONS REPORT
BATCHSQL
DBOPTIONS DEFERREFCONST
DBOPTIONS LOBWRITESIZE 102400
DDLERROR DEFAULT DISCARD RETRYOP MAXRETRIES 5 RETRYDELAY 20
MAP sender.* , TARGET sender.* ;
start?mgr?
start extnd
start dpend
?
start?mgr?
start repnd
?
源数据库上创建数据
conn sender/oracle
create table t1 (id number CONSTRAINT id_nn NOT NULL,
name VARCHAR2(40),
PRIMARY KEY (id)
);
insert into t1 values (1,‘aaa‘);
insert into t1 values (2,‘bbb‘);
insert into t1 values (3,‘ccc‘);
insert into t1 values (4,‘ddd‘);
?
create table t2 (id number CONSTRAINT id_nm NOT NULL,
addr VARCHAR2(40),
PRIMARY KEY (id)
);
insert into t2 values (1,‘word‘);
insert into t2 values (2,‘now‘);
insert into t2 values (3,‘values‘);
insert into t2 values (4,‘beijing‘);
?
测试时使用语句
insert into t1 values (5,‘eee‘)
insert into t1 values (6,‘fff‘)
insert into t1 values (7,‘ggg‘)
?
create table t3 as select * from t1 where 1=0;
create table t4 as select * from t1;
alter table t2 rename to t4;
管理进程:mgr
参数:
GGSCI(node1) 1> edit param mgr
(粘贴下面这段配置)
PORT 8839
--DYNAMICPORTLIST 8000-9000
--AUTOSTART ER *
AUTORESTART EXTRACT *,RETRIES 5,WAITMINUTES 3
PURGEOLDEXTRACTS ./dirdat/*,usecheckpoints, minkeepdays 3
--PURGEDDLHISTORY MINKEEPDAYS 3, MAXKEEPDAYS 5, FREQUENCYMINUTES 30
--PURGEMARKERHISTORY MINKEEPDAYS 3, MAXKEEPDAYS 5, FREQUENCYMINUTES 30
LAGREPORTHOURS 1
LAGINFOMINUTES 30
LAGCRITICALMINUTES 45
?
GLOBALS:
GGSCI?(node1)?>?edit?params?./GLOBALS??
GGSCHEMA?ggate
?
?
抽取进程:extnd
参数:
增加EXTRAIL
GGSCI(node1)> add extract extnd, tranlog, begin now
EXTRACT added.
?
修改EXTRAIL参数
GGSCI (GOLDENGATE1) 4> edit params extnd
EXTRACT extnd
SETENV (NLS_LANG = "AMERICAN_AMERICA.UTF8")
SETENV (ORACLE_HOME = "/u01/app/oracle/product/11.2.0/dbhome_1")
SETENV (ORACLE_SID = "prm")
USERID ggate, PASSWORD ggate
EXTTRAIL ./dirdat/nd
DISCARDFILE ./dirdat/extnd.dsc,APPEND,MEGABYTES 5
TRANLOGOPTIONS ALTARCHIVELOGDEST /arch/prm
TRANLOGOPTIONS ALTARCHIVEDLOGFORMAT %t_%s_%r.dbf
DDL INCLUDE ALL
DDLOPTIONS ADDTRANDATA
FETCHOPTIONS, USESNAPSHOT, NOUSELATESTVERSION, MISSINGROW REPORT
STATOPTIONS REPORTFETCH
WARNLONGTRANS 1H, CHECKINTERVAL 5M
TABLE sender.*;
?
添加该extract对应的trail文件,用来存储抽取的数据。单个文件大小设置为100MB
GGSCI(node1)> add exttrail ./dirdat/nd, extract extnd, megabytes 100
EXTTRAIL added.
?
?
传输进程:dpend
参数:
增加PUMP
GGSCI(node1)>add extract dpend, exttrailsource ./dirdat/nd, begin now
EXTRACT added.
?
修改PUMP参数
GGSCI(node1)> edit params dpend
EXTRACT dpend
SETENV (NLS_LANG = "AMERICAN_AMERICA.UTF8")
USERID ggate, PASSWORD ggate
RMTHOST 192.168.80.166, MGRPORT 8809
RMTTRAIL ./dirdat/nd
DISCARDFILE ./dirdat/dpend.dsc,APPEND,MEGABYTES 5
TABLE sender.*;
?
添加RMTRAILS
GGSCI(node1)> add rmttrail ./dirdat/nd, extract dpend, megabytes 100
RMTTRAIL added.
管理进程:mgr
参数:
GGSCI(node2) 1> edit param mgr
(粘贴下面这段配置)
PORT 8839
--DYNAMICPORTLIST 8000-9000
--AUTOSTART ER *
AUTORESTART EXTRACT *,RETRIES 5,WAITMINUTES 3
PURGEOLDEXTRACTS ./dirdat/*,usecheckpoints, minkeepdays 3
--PURGEDDLHISTORY MINKEEPDAYS 3, MAXKEEPDAYS 5, FREQUENCYMINUTES 30
--PURGEMARKERHISTORY MINKEEPDAYS 3, MAXKEEPDAYS 5, FREQUENCYMINUTES 30
LAGREPORTHOURS 1
LAGINFOMINUTES 30
LAGCRITICALMINUTES 45
?
GLOBALS:
GGSCI (node2)> edit params ./GLOBALS
GGSCHEMA ggate
CHECKPOINTTABLE ggate.chkpoint
?
?
复制进程:repnd
参数:
增加目标端REP
GGSCI (node2)> add replicat repnd, exttrail ./dirdat/nd, checkpointtable ggate.chkpoint
REPLICAT added.
?
修改REP参数
GGSCI (node2)> edit params repnd
REPLICAT repnd
ASSUMETARGETDEFS
USERID ggate, PASSWORD ggate
DISCARDFILE ./dirrpt/repnd.dsc,APPEND,MEGABYTES 5
DDL INCLUDE ALL
DDLOPTIONS REPORT
BATCHSQL
DBOPTIONS DEFERREFCONST
DBOPTIONS LOBWRITESIZE 102400
DDLERROR DEFAULT DISCARD RETRYOP MAXRETRIES 5 RETRYDELAY 20
MAP sender.* , TARGET sender.* ;
确认源库处于归档模式
????因为现源端数据库是之前目标端数据库rman初始化过来的,所以这部分忽略
确认源库为FORCE_LOGGIN
????因为现源端数据库是之前目标端数据库rman初始化过来的,所以这部分忽略
确认源库打开辅助日志
????因为现源端数据库是之前目标端数据库rman初始化过来的,所以这部分忽略
?
源库关闭回收站
????因为现源端数据库是之前目标端数据库rman初始化过来的,所以这部分忽略
保证字符集一致
????因为现源端数据库是之前目标端数据库rman初始化过来的,所以这部分忽略
UNDO设置
????因为现源端数据库是之前目标端数据库rman初始化过来的,所以这部分忽略
安装DDL_OBJETS
????因为现源端数据库是之前目标端数据库rman初始化过来的,所以这部分忽略
PURGEOLDEXTRACTS ./dirdat/*, USECHECKPOINTS, MINKEEPFILES 10
----这个之前配置过 忽略
PURGEOLDEXTRACTS ./dirdat/*, USECHECKPOINTS, MINKEEPFILES 10
----这个之前配置过 忽略
GGSCI (node1)> edit params ./GLOBALS
GGSCHEMA ggate
CHECKPOINTTABLE ggate.chkpoint
GGSCI (node1)>exit
GGSCI (node1)> dblogin userid ggate, password ggate
GGSCI (node1)> add checkpointtable ggate.chkpoint
GGSCI (node1)>exit
增加EXTRACT
add extract extd2, tranlog, begin now
?
修改配置:
GGSCI (node1)> edit params extd2
EXTRACT extd2
SETENV (NLS_LANG = "AMERICAN_AMERICA.UTF8")
SETENV (ORACLE_HOME = "/u01/app/oracle/product/11.2.0/dbhome_1")
SETENV (ORACLE_SID = "prm")
USERID ggate, PASSWORD ggate
TRANLOGOPTIONS EXCLUDEUSER ggate
IGNOREREPLICATES
EXTTRAIL ./dirdat/et
DISCARDFILE ./dirdat/extd2.dsc,APPEND,MEGABYTES 5
TRANLOGOPTIONS ALTARCHIVELOGDEST /arch/prm
TRANLOGOPTIONS ALTARCHIVEDLOGFORMAT %t_%s_%r.dbf
DDL INCLUDE ALL
DDLOPTIONS ADDTRANDATA
FETCHOPTIONS, USESNAPSHOT, NOUSELATESTVERSION, MISSINGROW REPORT
STATOPTIONS REPORTFETCH
WARNLONGTRANS 1H, CHECKINTERVAL 5M
TABLE sender.*;
?
添加该extract对应的trail文件,用来存储抽取的数据。单个文件大小设置为100MB
GGSCI (node2)> add exttrail ./dirdat/et,extract extd2,megabytes 100
GGSCI (node1)>edit param EXTND
TRANLOGOPTIONS?EXCLUDEUSER?ggate?
IGNOREREPLICATES
?
去掉以下两行 不然启动不起来
TRANLOGOPTIONS ALTARCHIVELOGDEST /arch/prm
TRANLOGOPTIONS ALTARCHIVEDLOGFORMAT %t_%s_%r.dbf
?
增加PUMP
GGSCI (node2)>add extract dpnd2, exttrailsource ./dirdat/et, begin now
?
修改配置:
GGSCI (node2)> edit params dpnd2
EXTRACT dpnd2
SETENV (NLS_LANG = "AMERICAN_AMERICA.UTF8")
USERID ggate, PASSWORD ggate
RMTHOST 192.168.80.160, MGRPORT 8809
RMTTRAIL ./dirdat/et
DISCARDFILE ./dirdat/dpnd2.dsc,APPEND,MEGABYTES 5
TABLE sender.*;
?
添加远程TRAIL文件:
GGSCI (node2)> add rmttrail ./dirdat/et, extract dpnd2, megabytes 100
增加目标端REP进程
GGSCI (node1)> add replicat repnd2, exttrail ./dirdat/et, checkpointtable ggate.chkpoint
?
?
修改配置参数:
GGSCI (node1)> edit params repnd2
REPLICAT repnd2
ASSUMETARGETDEFS
USERID ggate, PASSWORD ggate
DISCARDFILE ./dirrpt/repnd2.dsc,APPEND,MEGABYTES 5
DDL INCLUDE ALL
DDLOPTIONS REPORT
BATCHSQL
DBOPTIONS DEFERREFCONST
DBOPTIONS LOBWRITESIZE 102400
DDLERROR DEFAULT DISCARD RETRYOP MAXRETRIES 5 RETRYDELAY 20
MAP sender.* , TARGET sender.* ;
GGSCI (node2)>exit
GGSCI (node2)> dblogin userid ggate, password ggate
GGSCI (node2)> add trandata sender.*
GGSCI (node2)>exit
SQL>?select?current_scn?from?v$database;
1297690
停止两端所有近程
GGSCI (node1)> stop EXTND
GGSCI (node1)> stop DPEND
GGSCI (node1)> stop mgr
?
GGSCI (node2)> stop repnd
GGSCI (node2)> stop mgr
重启两端所有进程
node1:
start mgr
start EXTND
start DPEND
start repnd2,?aftercsn?1297690
?
?
node2:
start mgr
start repnd
strat extd2
start dpnd2
测试时使用语句
insert into t1 values (6,‘fff‘);
insert into t1 values (7,‘ggg‘);
insert into t1 values (7,‘hhh‘);
insert into t1 values (8,‘eee‘);
insert into t1 values (9,‘fff‘);
insert into t1 values (10,‘ggg‘);
?
create table t5 as select * from t1 where 1=0;
create table t4 as select * from t1;
conn / as sysdba
alter system switch logfile;
create tablespace test01 datafile ‘/u01/app/oracle/oradata/prm/test01.dbf‘ size 5m;
?
create table t6 as select * from t1;
alter table t6 rename to t7;
conn / as sysdba
alter system switch logfile;
drop tablespace test01 including contents and datafiles;
?
?
alter table t7 rename to t6;
?
?
?
GoldenGate的DDL同步只支持两边一致的数据库,限制条件较多(如不能进行字段映射、转换等),具体可以参考官方文档。DDL的抓取不是通过日志抓取来捕获的,而是通过触发器来实现,所以对源数据库的性能影响要比单纯的数据抓取要大很多,可谓屏弃了GoldenGate的优势。尽量不要使用GoldenGate的DDL复制功能,在大多数业务系统中,实际上不会有频繁的数据库结构变动,完全可以通过手工的方式进行维护。确实有大量DDL操作的环境,如果可以,还是推荐物理DG之类的替换方案;确实要使用GoldenGate的DDL复制,那么请详细参考官方文档的限制和说明。
--以上主要为个人意见,有不同看法的请无视
?
开启DDL复制的基本配置步骤为:
(1)关闭ORACLE的回收站功能。
(2)选择一个数据库schema存放支持DDL的GoldenGate对象,运行相应创建脚本。
(3)编辑globals参数文件。
(4)修改extl和repl的配置文件
?
?
具体操作步骤:
(1)关闭数据库回收站:
SQL>alter system set recyclebin=off scope=both;
?
(2)编辑globals参数文件:
GGSCI>edit param ./globals
添加以下内容后保存:
GGSCHEMA ddw --标明支持DDL的GG对象存放在哪个schema下
?
(3)执行创建脚本:
首先需要命令行进入GG安装目录下,然后再运行sqlplus执行脚本,如果不进入目录下脚本执行会报错(应该是由于GG脚本中子脚本嵌套使用相对路径的问题所造成)。
SQL>@marker_setup.sql --提示输入目标schema
SQL>@ddl_setup.sql --提示输入目标schema,输入initialsetup最后输入yes
SQL>@role_setup.sql
SQL>grant GGS_GGSUSER_ROLE to ddw; --不进行该步赋权后面起进程会报错
SQL>@ddl_enable.sql --使触发器生效
?
(4)修改提取进程和复制进程的配置文件,分别加入ddl include all属性。
此时repl必须指定assumetargetdefs属性,这表明只有两边数据库结构一致的情况下才可以启用DDL复制。另外,开启DDL同步不能再只映射单表了,对整个模式下的对象都有效。
加入DDL复制之后,数据复制的lag明显增加了。
?
?
清除数据库中DDL复制的设置
在实际测试中,由于我在同一个数据库中进行映射,映射表结构不一致,导致进程报了一系列的错误。这个时候需要把通过脚本创建的GG对象中的数据清空,安装目录下只提供了清除对象的脚本,可以如下操作:
首先要求把所有的GG进程停掉,包括mgr进程
SQL>@ddl_disable.sql --首先使DDL触发器失效
SQL>@ddl_remove.sql
SQL>@marker_remove.sql
role_setup.sql没有对应的清除脚本,但是这块不影响配置信息的清除
然后重新再创建脚本。
?
标签:
原文地址:http://www.cnblogs.com/junnor/p/4307228.html