goldengate ddl 配置說明

sky_dizzy001發表於2014-02-11

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/,如需轉載,請註明出處,否則將追究法律責任。

相關文章