ITPub博客

首页 > 数据库 > Oracle > goldengate ddl 配置说明

goldengate ddl 配置说明

原创 Oracle 作者:sky_dizzy001 时间:2014-02-11 09:11:27 0 删除 编辑

GoldenGate的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执行脚本,如果不进入目录下脚本执行会报错(由于脚本中子脚本嵌套使用相对路径的问题所造成)。
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同步不能再只映射单表了,对整个模式下的对象都有效。

在实际测试中,由于我在同一个数据库中进行映射,而且映射表结构不一致,导致进程报了一系列的错误。这个时候需要把通过脚本创建的GG对象中的数据清空,安装目录下只提供了清除对象的脚本,可以如下操作:首先要求把所有的GG进程停掉,包括mgr进程
SQL>@ddl_disable.sql  --首先使DDL触发器失效
SQL>@ddl_remove.sql
SQL>@marker_remove.sql
role_setup.sql没有对应的清除脚本,但是这块不影响配置信息的清除
然后重新再创建脚本。

1) Configure Extract with DDL capture:
EXTRACT ggs_ext
USERID gg01, PASSWORD gg01
EXTTRAIL ./dirdat/et
-- Capture DDL for tables only, but not changes to indexes or sequences in the same schema because they wouldn’t hurt the DML replication.

DDL INCLUDE MAPPED, OBJTYPE 'TABLE'

DDLOPTIONS REPORT, ADDTRANDATA
TABLE gg01.customers;
TABLE gg01.products;

 

goldengate支持上的oracle对象:
Supported Oracle objects and operations for DDL replication
All Oracle GoldenGate topology configurations are supported for Oracle DDL replication.
Active-active (bi-directional) replication of Oracle DDL is supported between two (and only
two) databases that contain identical metadata.
Oracle GoldenGate supports all DDL operations up to 2 MB in size on the following objects:
clusters
functions
indexes
packages
procedure
tables
tablespaces
roles
sequences
synonyms
triggers
types
views
materialized views
users

 

OGG DDL功能限制:
1.需关闭回收站功能:
Oracle recycle bin

Because of a known issue in Oracle 10g, the Oracle recycle bin must be turned off to
support Oracle GoldenGate DDL replication. If the recycle bin is enabled, the Oracle
GoldenGate DDL trigger session receives implicit recycle bin DDL operations that cause
the trigger to fail.

When you install the Oracle GoldenGate DDL support objects, the script prompts you to
permit it to purge the recycle bin, and then it will do so automatically if permission is
granted. However, you still must disable the recycle bin manually.

To turn off the recycle bin:

●    Oracle 10g Release 2 and later: Set the RECYCLEBIN initialization parameter to OFF.

●    Oracle 10g Release 1: Set the _RECYCLEBIN initialization parameter to FALSE.

Consult the database documentation for the correct syntax.


 

2.DDL语句长度小于2MB
DDL statement length
Oracle GoldenGate measures the length of a DDL statement in bytes, not in characters.
The supported length is approximately 2 MB, allowing for some internal overhead that can
vary in size depending on the name of the affected object and its DDL type, among other
characteristics. If the DDL is longer than the supported size, Extract will issue a warning
and ignore the DDL operation.

 

3.系统配置:
1).源表结构和目标表结构必须一致
2).复制段必须使用ASSUMETARGETDEFS参数。如果使用 SOURCEDEFS参数(表结构不一致使用此参数),则将导致复制端进程ABENDED。

来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/29468144/viewspace-1079270/,如需转载,请注明出处,否则将追究法律责任。

请登录后发表评论 登录
全部评论

注册时间:2014-02-01

  • 博文量
    27
  • 访问量
    129564