GoldenGate表异构的解决方法

首先必须创建一个数据定义文件,本例中,数据定义文件在源端生成

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/196700/viewspace-766403/,如需转载,请注明出处,否则将追究法律责任。

user_pic_default.png
请登录后发表评论 登录
全部评论
<%=items[i].createtime%>

<%=items[i].content%>

<%if(items[i].items.items.length) { %>
<%for(var j=0;j
<%=items[i].items.items[j].createtime%> 回复

<%=items[i].items.items[j].username%>   回复   <%=items[i].items.items[j].tousername%><%=items[i].items.items[j].content%>

<%}%> <%if(items[i].items.total > 5) { %>
还有<%=items[i].items.total-5%>条评论 ) data-count=1 data-flag=true>点击查看
<%}%>
<%}%>
<%}%>

转载于:http://blog.itpub.net/196700/viewspace-766403/

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值