• defgen工具


    构造defgen档
    由于 Oracle 和 SQL Server 中的数据类型不同。所以您必须建立数据类型转换。GoldenGate 提供了一个名为 DEFGEN 的专用工具。用于生成数据定义,当源表和目标表中的定义不同一时候,Oracle GoldenGate 进程将引用该专用工具。在执行 DEFGEN 之前,须要为其创建一个參数文件,指定该工具应检查哪些表以及在检查表之后存放类型定义文件的位置。

    能够在 GGSCI 内使用 EDIT PARAMS 命令创建这样一个參数文件。


    cd $GGS_HOME/dirprm  && vi defgen.prm
    defsfile ./dirdef/defgen.def purge
    userid ggmgr,password oracle
    table ggmgr.t1;   #这里必须有分号

    purge(默认)与append选一个,append就是往已经存在的同名的定义文件追加内容,purge是先清空。


    运行defgen命令
    cd $GGS_HOME && ./defgen paramfile ./dirprm/defgen.prm  
    运行之前。假设已经有同名的defgen文件。会报错。所以得先删除。
        
    上面命令。首先我们编辑一个包括登陆源库usernamepassword,要解析哪些表结构。以及要在哪里生成这个解析后的定义文件的參数文件。然后我们利用这个參数文件,结合defgen命令,来生成实际的定义文件。生成的定义文件,是包括表、列而且用更一般的定义描写叙述了原生数据类型。

    ./defgen paramfile ./dirprm/defgen.prm  [reportfile ./dirrpt/defgen.rpt]
    这个reportfile指定除了要打印到屏幕。还打印到哪里。



    将生成的dirdef/epcis.def 文件 scp上传到目标库的GoldenGate安装文件夹下的dirdef文件夹下。

    使用二进制传输,能够避免不同系统之间对ascii编码的解析差异。

    到时replicat进程会使用它。然后将一般的类型,又一次映射为目标库表的数据类型。


    附录:运行defgen命令后打印的日志:
    ***********************************************************************
            Oracle GoldenGate Table Definition Generator for Oracle
          Version 11.2.1.0.1 OGGCORE_11.2.1.0.1_PLATFORMS_120423.0230
       Linux, x64, 64bit (optimized), Oracle 11g on Apr 23 2012 05:08:19
     
    Copyright (C) 1995, 2012, Oracle and/or its affiliates. All rights reserved.
                        Starting at 2014-04-22 15:31:30
    ***********************************************************************
    Operating System Version:
    Linux
    Version #1 SMP Wed Jul 27 21:02:33 EDT 2011, Release 2.6.32-200.13.1.el5uek
    Node: erpp1.dji.com
    Machine: x86_64
                             soft limit hard limit
    Address Space Size : unlimited unlimited
    Heap Size : unlimited unlimited
    File Size : unlimited unlimited
    CPU Time : unlimited unlimited
    Process id: 22698
    ***********************************************************************
    ** Running with the following parameters **
    ***********************************************************************
    defsfile ./dirdef/defgen.def
    userid ggmgr,password ******
    table ggmgr.t1;
    Retrieving definition for GGMGR.T1
    Definitions generated for 1 table in ./dirdef/defgen.def


    附录:defgen.def内容
    *+- Defgen version 2.0, Encoding UTF-8
    *
    * Definitions created/modified 2014-04-22 15:31
    *
    * Field descriptions for each column entry:
    *
    * 1 Name
    * 2 Data Type
    * 3 External Length
    * 4 Fetch Offset
    * 5 Scale
    * 6 Level
    * 7 Null
    * 8 Bump if Odd
    * 9 Internal Length
    * 10 Binary Length
    * 11 Table Length
    * 12 Most Significant DT
    * 13 Least Significant DT
    * 14 High Precision
    * 15 Low Precision
    * 16 Elementary Item
    * 17 Occurs
    * 18 Key Column
    * 19 Sub Data Type
    *
    Database type: ORACLE
    Character set ID: UTF-8
    National character set ID: UTF-16
    Locale: neutral
    Case sensitivity: 14 14 14 14 14 14 14 14 14 14 14 14 11 14 14 14
    *
    Definition for table GGMGR.T1
    Record length: 56
    Syskey: 0
    Columns: 1
    ID 64 50 0 0 0 1 0 50 50 50 0 0 0 0 1 0 1 2
    End of definition

    版权声明:本文博主原创文章。博客,未经同意不得转载。

  • 相关阅读:
    ASP.NET 2.0的页面缓存功能介绍
    我对针对接口编程的浅解
    接口和抽象类的区别
    面向接口编程到底有什么好处
    泛型编程是什么
    方法的重写、重载及隐藏
    基于事件的编程有什么好处
    Socket Remoting WebService对比
    技术讲座:.NET委托、事件及应用兼谈软件项目开发
    ny589 糖果
  • 原文地址:https://www.cnblogs.com/blfshiye/p/4839490.html
Copyright © 2020-2023  润新知