GoldenGate表異構的解決方法

shilei1發表於2019-06-27

首先必須建立一個資料定義檔案,本例中,資料定義檔案在源端生成
1. 建立一個引數檔案
    edit param rep1.defs
    
    defsfile ./dirdef/rep1.defs
    userid ggs, password ggs
    table scott.*;

  注意分號不可少,否則資料定義檔案生成的時候會出錯
2. 使用GoldenGate工具gendef 生成資料定義檔案
  這個工具是一個EXE檔案,所以必須在命令列下執行
  c:\ggs>defgen paramfile rep1.defs

***********************************************************************
        Oracle GoldenGate Table Definition Generator for Oracle
      Version 11.2.1.0.1 OGGCORE_11.2.1.0.1_PLATFORMS_120423.0230
      Windows x64 (optimized), Oracle 11g on Apr 23 2012 05:48:41

Copyright (C) 1995, 2012, Oracle and/or its affiliates. All rights reserved.


                    Starting at 2013-07-10 16:10:03
***********************************************************************

Operating System Version:
Microsoft Windows 7 , on x64
Version 6.1 (Build 7601: Service Pack 1)

Process id: 4704

***********************************************************************
**            Running with the following parameters                  **
***********************************************************************
defsfile ./dirdef/rep1.defs

Source Context :
  SourceModule            : [defgen.main]
  SourceID                : [defgen/defgen.c]
  SourceFunction          : [create_defgen_file]
  SourceLine              : [795]
  ThreadBacktrace         : [8] elements
                          : [c:\ggs\gglog.dll(??1CContextItem@@UEAA@XZ+0x313f) [
0x00000001801075AF]]
                          : [c:\ggs\gglog.dll(?_MSG_ERR_STARTUP_FILE_EXISTS@@YAP
EAVCMessage@@PEAVCSourceContext@@PEBD1W4MessageDisposition@CMessageFactory@@@Z+0
xda) [0x000000018001F47A]]
                          : [c:\ggs\defgen.exe(<_msg_err_startup_file_exists>
PEAVCMessage@@PEAVCSourceContext@@PEBD1W4MessageDisposition@CMessageFactory@@@Z+
0xda) [0x0000000140004418]]
                          : [c:\ggs\defgen.exe(<_msg_err_startup_file_exists>
PEAVCMessage@@PEAVCSourceContext@@PEBD1W4MessageDisposition@CMessageFactory@@@Z+
0xda) [0x00000001400057B0]]
                          : [c:\ggs\defgen.exe(<_msg_err_startup_file_exists>
PEAVCMessage@@PEAVCSourceContext@@PEBD1W4MessageDisposition@CMessageFactory@@@Z+
0xda) [0x00000001400064F6]]
                          : [c:\ggs\defgen.exe(CommonLexerNewSSD+0x2be0) [0x0000
00014007F1B0]]
                          : [C:\Windows\system32\kernel32.dll(BaseThreadInitThun
k+0xd) [0x00000000773D652D]]
                          : [C:\Windows\SYSTEM32\ntdll.dll(RtlUserThreadStart+0x
21) [0x000000007750C521]]

2013-07-10 16:10:03  ERROR   OGG-00037  DEFSFILE file ./dirdef/rep1.defs already
 exists.

2013-07-10 16:10:03  ERROR   OGG-01668  PROCESS ABENDING.

c:\ggs>defgen paramfile rep1.defs

***********************************************************************
        Oracle GoldenGate Table Definition Generator for Oracle
      Version 11.2.1.0.1 OGGCORE_11.2.1.0.1_PLATFORMS_120423.0230
      Windows x64 (optimized), Oracle 11g on Apr 23 2012 05:48:41

Copyright (C) 1995, 2012, Oracle and/or its affiliates. All rights reserved.


                    Starting at 2013-07-10 16:11:51
***********************************************************************

Operating System Version:
Microsoft Windows 7 , on x64
Version 6.1 (Build 7601: Service Pack 1)

Process id: 6384

***********************************************************************
**            Running with the following parameters                  **
***********************************************************************
defsfile ./dirdef/rep1.defs
userid ggs, password ***
table scott.*;
Expanding wildcard scott.*:

Retrieving definition for SCOTT.BONUS

2013-07-10 16:12:03  WARNING OGG-00869  No unique key is defined for table 'BONU
S'. All viable columns will be used to represent the key, but may not guarantee
uniqueness.  KEYCOLS may be used to define the key.
Retrieving definition for SCOTT.DEMO
Retrieving definition for SCOTT.DEPT
Retrieving definition for SCOTT.EMP
Retrieving definition for SCOTT.SALGRADE

2013-07-10 16:12:03  WARNING OGG-00869  No unique key is defined for table 'SALG
RADE'. All viable columns will be used to represent the key, but may not guarant
ee uniqueness.  KEYCOLS may be used to define the key.
Retrieving definition for SCOTT.TEST_DDL

2013-07-10 16:12:03  WARNING OGG-00869  No unique key is defined for table 'TEST
_DDL'. All viable columns will be used to represent the key, but may not guarant
ee uniqueness.  KEYCOLS may be used to define the key.



Definitions generated for 6 tables in ./dirdef/rep1.defs


檔案生成之後,將檔案拷貝到目標端的ggs安裝目錄下的dirdef目錄,
檔名是rep1.defs

在目標端的replicat程式組引數檔案中加入一行
map scott.demo, target scott.demo , colmap(usedefaults, salary=wages);

其中wages是源端的列名

源端demo表定義:

CREATE TABLE "SCOTT"."DEMO" 
   ("ID" NUMBER, 
"ENAME" VARCHAR2(10 BYTE), 
"WAGES"NUMBER, 
PRIMARY KEY ("ID")
  USING INDEX PCTFREE 10 INITRANS 2 MAXTRANS 255 
  STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645
  PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT)
  TABLESPACE "USERS"  ENABLE, 
SUPPLEMENTAL LOG GROUP "GGS_74569" ("ID") ALWAYS
   )

目標端demo表定義:

CREATE TABLE "SCOTT"."DEMO" 
   ("ID" NUMBER, 
"ENAME" VARCHAR2(10 BYTE), 
"SALARY"NUMBER, 
PRIMARY KEY ("ID")
  USING INDEX PCTFREE 10 INITRANS 2 MAXTRANS 255 
  STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645
  PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT)
  TABLESPACE "USERS"  ENABLE, 
SUPPLEMENTAL LOG GROUP "GGS_74569" ("ID") ALWAYS
   )

啟動extract, replicat程式,測試結果OK。
 

來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/29819001/viewspace-1672254/,如需轉載,請註明出處,否則將追究法律責任。

GoldenGate表異構的解決方法
請登入後發表評論 登入
全部評論

相關文章