详解DDL同步配置
详解DDL同步配置
在配置DDL同步之前,建议先动手配置DML的同步环境,如果你还不会配置GoldenGate–DML环境,可以参考Oracle GoldenGate for Oracle 11g(Solaris 10 x86-64) to Oracle 10g(CentOS 4.8) configuration这篇博文。
DDL复制与DML复制的机制原理是完全不同的,DDL基于trigger,DML基于捕获日志,二者的数据捕获是没有任何关系的。也就是说DDL和DML复制是相互独立,DDL启动后无论DML复制是否运行都不会影响DDL复制的正常工作,反过来说DDL的启动或者停止也不会影响到DML。它们只是在extract启动时根据SCN号进行排序,没有其他任何联系。DDL复制只是简单的SQL复制,通过trigger捕获DDL抓取原始的SQL语句发送到目标端重新执行一遍。为了清楚分别源端和目标端机器红色字体代表源端操作蓝色字体代表目标端操作分别在源端和目标端安装GoldenGate 10,此过程省略,不知道如何安装的请看Oracle GoldenGate for Oracle 11g(Solaris 10 x86-64) to Oracle 10g(CentOS 4.8) configuration这篇博文。
关闭源端数据库的recyclebin
[oracle@gg01 ~]$ sqlplus / as sysdbaSQL*Plus: Release 10.2.0.1.0 - Production on Sun Jan 15 12:49:39 2012
Copyright (c) 1982, 2005, Oracle. All rights reserved.
Connected to:Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - ProductionWith the Partitioning, OLAP and Data Mining options
SYS@gg01:~>show parameter recyclebin
NAME TYPE VALUE recyclebin string onSYS@gg01:~>alter system set recyclebin=off;
System altered.
SYS@gg01:~>show parameter recyclebin
NAME TYPE VALUE recyclebin string OFF
创建DDL复制用户
SYS@gg01:~>create user ggadmin identified by ggadmin default tablespace users;
User created.
SYS@gg01:~>grant dba to ggadmin;
Grant succeeded.
SYS@gg01:~>
编辑ogg的globals参数,指定DDL用户
GGSCI (gg01) 3> view params ./GLOBALS
ggschema ggadmin
安装DDL对象,运行marker_setup.sql脚本,提示输入OGG用户,这里是之前定义的ggadmin
SYS@gg01:~>@marker_setup
Marker setup script
You will be prompted for the name of a schema for the GoldenGate database objects.NOTE: The schema must be created prior to running this script.NOTE: Stop all DDL replication before starting this installation.
Enter GoldenGate schema name:ggadmin
Marker setup table script complete, running verification script...Please enter the name of a schema for the GoldenGate database objects:Setting schema name to GGADMIN
MARKER TABLEOK
MARKER SEQUENCEOK
Script complete.SYS@gg01:~>
运行ddl_setup.sql脚本,提示输入用户:ggadmin
SYS@gg01:~>@ddl_setup
Golde