GoldenGate的安装、配置与测试

环境:Oracle Linux 5.8/Windows Server 2003 +  Oracle Database 11.2.0.4 + Golengate 11.2

解压安装文件里的内容到/opt/goldengate,然后创建工作目录:


点击(此处)折叠或打开

  1. [oracle@oltp ~]$ cd /opt/goldengate/
  2. [oracle@oltp goldengate]$ ggsci

  3. Oracle GoldenGate Command Interpreter for Oracle
  4. Version 11.2.1.0.1 OGGCORE_11.2.1.0.1_PLATFORMS_120423.0230_FBO
  5. Linux, x64, 64bit (optimized), Oracle 11g on Apr 23 2012 08:32:14

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



  7. GGSCI (oltp.demo.com) 1> create subdirs

  8. Creating subdirectories under current directory /opt/goldengate

  9. Parameter files /opt/goldengate/dirprm: already exists
  10. Report files /opt/goldengate/dirrpt: created
  11. Checkpoint files /opt/goldengate/dirchk: created
  12. Process status files /opt/goldengate/dirpcs: created
  13. SQL script files /opt/goldengate/dirsql: created
  14. Database definitions files /opt/goldengate/dirdef: created
  15. Extract data files /opt/goldengate/dirdat: created
  16. Temporary files /opt/goldengate/dirtmp: created
  17. Stdout files /opt/goldengate/dirout: created

在Windows环境下,需要将manager进程添加到Windows服务,否则注销后进程就会退出

点击(此处)折叠或打开

  1. GGSCI (hum-cf0bf98919e) 2> EDIT PARAMS ./GLOBALS
  2. --编辑以下文字
  3. MGRSERVNAME GGMGR

  4. GGSCI (hum-cf0bf98919e) 4> exit

  5. C:\goldengate>install addservice

  6. Service 'GGMGR' created.


  7. Install program terminated normally.

--如果要删除服务,进入根目录后


C:\goldengate>install deleteevents deleteservice


Service 'GGMGR' removed.




Install program terminated normally.


二、数据库设置

数据库要设置为归档模式、并打开数据库级别的补充日志,以及设置启用GoldenGate复制的参数

点击(此处)折叠或打开

  1. SQL> select supplemental_log_data_min from v$database;

  2. SUPPLEMENTAL_LOG
  3. ----------------
  4. NO

  5. SQL> alter database add supplemental log data;

  6. Database altered.

  7. SQL> select supplemental_log_data_min from v$database;

  8. SUPPLEMENTAL_LOG
  9. ----------------
  10. YES
  --以下参数在11.2.1.0.26下必须改,否则extract进程无法启动
  1. SQL> alter system set enable_goldengate_replication=TRUE scope=both;


    System altered.

创建用户并赋予权限:


点击(此处)折叠或打开

  1. --创建专属表空间
  2. create tablespace ogg datafile size 100M autoextend on;
  3. --源和目的都执行
  4. create user ggs identified by ggs default tablespace ogg temporary tablespace temp;
  5. grant connect, resource, unlimited tablespace to ggs;
  6. grant execute on utl_file to ggs;

  7. --源端执行
  8. grant connect,resource to ggs;
  9. grant select any dictionary,select any table to ggs;
  10. grant alter any table to ggs;
  11. grant flashback any table to ggs;
  12. grant execute on DBMS_FLASHBACK to ggs;

  13. --目的端执行
  14. grant insert any table to ggs;
  15. grant delete any table to ggs;
  16. grant update any table to ggs;

  17. --如果不讲究,可以直接给DBA权限
  18. grant dba to ggs;
在trandata添加需要同步的表和schema

源端进入GGSCI

点击(此处)折叠或打开

  1. dblogin userid ggs,password ggs
  2. GGSCI (oltp.demo.com) 3> add trandata soe.*


    2015-01-26 21:43:25  WARNING OGG-00869  No unique key is defined for table 'ADDRESSES'. All viable columns will be used to represent the key, but may not guarantee uniqueness.  KEYCOLS may be used to define the key.


    Logging of supplemental redo data enabled for table SOE.ADDRESSES.


    2015-01-26 21:43:27  WARNING OGG-00869  No unique key is defined for table 'CARD_DETAILS'. All viable columns will be used to represent the key, but may not guarantee uniqueness.  KEYCOLS may be used to define the key.


    Logging of supplemental redo data enabled for table SOE.CARD_DETAILS.


    2015-01-26 21:43:28  WARNING OGG-00869  No unique key is defined for table 'CUSTOMERS'. All viable columns will be used to represent the key, but may not guarantee uniqueness.  KEYCOLS may be used to define the key.


    Logging of supplemental redo data enabled for table SOE.CUSTOMERS.


    2015-01-26 21:43:28  WARNING OGG-00869  No unique key is defined for table 'INVENTORIES'. All viable columns will be used to represent the key, but may not guarantee uniqueness.  KEYCOLS may be used to define the key.


    Logging of supplemental redo data enabled for table SOE.INVENTORIES.


    2015-01-26 21:43:28  WARNING OGG-00869  No unique key is defined for table 'LOGON'. All viable columns will be used to represent the key, but may not guarantee uniqueness.  KEYCOLS may be used to define the key.


    Logging of supplemental redo data enabled for table SOE.LOGON.


    2015-01-26 21:43:28  WARNING OGG-00869  No unique key is defined for table 'ORDERENTRY_METADATA'. All viable columns will be used to represent the key, but may not guarantee uniqueness.  KEYCOLS may be used to define the key.


    Logging of supplemental redo data enabled for table SOE.ORDERENTRY_METADATA.


    2015-01-26 21:43:28  WARNING OGG-00869  No unique key is defined for table 'ORDERS'. All viable columns will be used to represent the key, but may not guarantee uniqueness.  KEYCOLS may be used to define the key.


    Logging of supplemental redo data enabled for table SOE.ORDERS.


    2015-01-26 21:43:28  WARNING OGG-00869  No unique key is defined for table 'ORDER_ITEMS'. All viable columns will be used to represent the key, but may not guarantee uniqueness.  KEYCOLS may be used to define the key.


    Logging of supplemental redo data enabled for table SOE.ORDER_ITEMS.


    Logging of supplemental redo data enabled for table SOE.PRODUCT_DESCRIPTIONS.


    Logging of supplemental redo data enabled for table SOE.PRODUCT_INFORMATION.


    2015-01-26 21:43:28  WARNING OGG-00869  No unique key is defined for table 'WAREHOUSES'. All viable columns will be used to represent the key, but may not guarantee uniqueness.  KEYCOLS may be used to define the key.


    Logging of supplemental redo data enabled for table SOE.WAREHOUSES.

目标端添加checkpoint表


点击(此处)折叠或打开

  1. GGSCI (hum-cf0bf98919e) 1> edit params ./GLOBALS

  2. --添加一行
  3. checkpointtable ggs.checkpoint

  4. GGSCI (hum-cf0bf98919e) 2> dblogin userid ggs,password ggs
  5. Successfully logged into database.

  6. GGSCI (hum-cf0bf98919e) 3> add checkpointtable ggs.checkpoint

  7. Successfully created checkpoint table ggs.checkpoint.

  8. GGSCI (hum-cf0bf98919e) 4>

三、 GG进程

编辑并启动源端Manager进程


点击(此处)折叠或打开

  1. GGSCI (oltp.demo.com) 5> edit params mgr
  2. port 7500
  3. dynamicportlist 7501-7505
  4. autorestart extract *,waitminutes 2,retries 5

  5. GGSCI (oltp.demo.com) 6> view params mgr

  6. port 7500
  7. dynamicportlist 7501-7505
  8. autorestart extract *,waitminutes 2,retries 5


  9. GGSCI (oltp.demo.com) 7> start mgr

  10. Manager started.
配置Extract进程组

创建名为eora的Extract进程组


点击(此处)折叠或打开

  1. GGSCI (oltp.demo.com) 8> edit params eora
  2. extract eora
  3. dynamicresolution
  4. userid ggs,password ggs
  5. exttrail /opt/goldengate/dirdat/et
  6. table soe.*;

  7. GGSCI (oltp.demo.com) 9add extract eora,tranlog,begin now
    1. EXTRACT added.

  8. GGSCI (oltp.demo.com) 11> add exttrail /opt/goldengate/dirdat/et,extract eora
  9. EXTTRAIL added.


  10. GGSCI (oltp.demo.com) 12> start extract eora


    Sending START request to MANAGER ...
    EXTRACT EORA starting


源端配置Pump进程组

点击(此处)折叠或打开

  1. GGSCI (oltp.demo.com) 19> edit params pump_so
  2. extract pump_so
  3. dynamicresolution
  4. passthru
  5. rmthost 192.168.226.13,mgrport 7809,compress
  6. rmttrail C:\goldengate\dirdat\pt
  7. table soe.*;

  8. GGSCI (oltp.demo.com) 20> add extract pump_so,exttrailsource /opt/goldengate/dirdat/et
  9. EXTRACT added.


  10. GGSCI (oltp.demo.com) 21> add rmttrail C:\goldengate\dirdat\pt,extract pump_so
  11. RMTTRAIL added.
  12. GGSCI (oltp.demo.com) 24> start pump_so


    Sending START request to MANAGER ...
    EXTRACT PUMP_SO starting




    GGSCI (oltp.demo.com) 25> info all


    Program     Status      Group       Lag at Chkpt  Time Since Chkpt


    MANAGER     RUNNING                                           
    EXTRACT     RUNNING     EORA        00:00:00      00:00:08    
    EXTRACT     RUNNING     PUMP_SO     00:00:00      00:21:32    



配置目的端MGR

点击(此处)折叠或打开

  1. GGSCI (hum-cf0bf98919e) 5> view params mgr
  2. port 7809
  3. dynamicportlist 7800-8000
  4. autostart er *
  5. autorestart extract *,waitminutes 2,retries 5
  6. lagreporthours 1
  7. laginfominutes 3
  8. lagcriticalminutes 5
  9. purgeoldextracts c:\goldengate\dirdat\rt*,usecheckpoints,minkeepdays 3


  10. GGSCI (hum-cf0bf98919e) 6> start mgr

  11. Starting Manager as service ('GGMGR')...
  12. Service started.


  13. GGSCI (hum-cf0bf98919e) 7> info all

  14. Program Status Group Lag at Chkpt Time Since Chkpt

  15. MANAGER RUNNING
配置目的端Replicate进程

点击(此处)折叠或打开

  1. GGSCI (hum-cf0bf98919e) 8> edit params repl


  2. GGSCI (hum-cf0bf98919e) 9> view params repl
  3. replicat repl
  4. userid ggs, password ggs
  5. assumetargetdefs
  6. reperror default,discard
  7. discardfile ./dirrpt/repl.dsc,append,megabytes 50
  8. dynamicresolution
  9. map soe.*, target soe.*;

  10. GGSCI (hum-cf0bf98919e) 11> add replicat repl,exttrail c:\goldengate\dirdat\pt checkpointtable ggs.checkpoint
  11. REPLICAT added.

  12. GGSCI (hum-cf0bf98919e) 12> start repl


    Sending START request to MANAGER ('GGMGR') ...
    REPLICAT REPL starting


进程状态不正常时,查看错误日志,文件名是ggserr.log,在程序根目录下。






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

转载于:http://blog.itpub.net/22621861/viewspace-1416225/

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值