在上一篇文件中的OGG单向复制配置不支持DLL的同步,只支持DML,因而本文在之前的基础上增加对DDL语句的复制,下面是简要配置过程记录!

一:验证之前的配置不支持DDL复制,这里在source端,新建一张表,发现无法复制到target端!target端也新建相同的表后,DML操作可以成功复制

  1. [root@db1 ~]# su - oracle
  2. [oracle@db1 ~]$ sqlplus hr/hr
  3. SQL> create table t2 (id number primary key,name varchar2(20));
  4. Table created.
  5. SQL> conn hr/hr@db2
  6. Connected.
  7. SQL> select tname from tab where tname='T2';
  8. no rows selected
  9. SQL> create table t2 (id number primary key,name varchar2(20));
  10. Table created.
  11. SQL> conn hr/hr
  12. Connected.
  13. SQL> insert into t2 values (1,'one');
  14. 1 row created.
  15. SQL> commit;
  16. Commit complete.
  17. SQL> conn hr/hr@db2
  18. Connected.
  19. SQL> select * from t2;
  20. ID NAME
  21. ---------- --------------------
  22. 1 one

二:开始配置OGG支持DDL复制(在source端操作)
1:赋予ogg用户相应的权限,修改全局配置文件添加ggschema参数

  1. SQL> conn /as sysdba
  2. Connected.
  3. SQL> grant execute on utl_file to ogg;
  4. Grant succeeded.
  5. [oracle@db1 ~]$ cd $GGATE
  6. [oracle@db1 ogg]$ ggsci
  7. GGSCI (db1) 1> edit param ./GLOBALS
  8. GGSCI (db1) 2> view param ./GLOBALS
  9. ggschema ogg

2:运行相关的sql脚本

  1. [oracle@db1 ~]$ cd $GGATE
  2. [oracle@db1 ogg]$ sqlplus /nolog
  3. SQL> conn /as sysdba
  4. Connected.
  5. SQL> @marker_setup.sql
  6. Marker setup script
  7. You will be prompted for the name of a schema for the Oracle GoldenGate database objects.
  8. NOTE: The schema must be created prior to running this script.
  9. NOTE: Stop all DDL replication before starting this installation.
  10. Enter Oracle GoldenGate schema name:ogg
  11. Marker setup table script complete, running verification script...
  12. Please enter the name of a schema for the GoldenGate database objects:
  13. Setting schema name to OGG
  14. MARKER TABLE
  15. -------------------------------
  16. OK
  17. MARKER SEQUENCE
  18. -------------------------------
  19. OK
  20. Script complete.
  21. SQL> show parameter recyclebin;
  22. NAME                                 TYPE        VALUE
  23. ------------------------------------ ----------- ------------------------------
  24. recyclebin                           string      on
  25. SQL> alter system set recyclebin=off;
  26. System altered.
  27. SQL> show parameter recyclebin;
  28. NAME                                 TYPE        VALUE
  29. ------------------------------------ ----------- ------------------------------
  30. recyclebin                           string      OFF
  31. SQL> @ddl_setup.sql
  32. Oracle GoldenGate DDL Replication setup script
  33. Verifying that current user has privileges to install DDL Replication...
  34. You will be prompted for the name of a schema for the Oracle GoldenGate database objects.
  35. NOTE: For an Oracle 10g source, the system recycle bin must be disabled. For Oracle 11g and later, it can be enabled.
  36. NOTE: The schema must be created prior to running this script.
  37. NOTE: Stop all DDL replication before starting this installation.
  38. Enter Oracle GoldenGate schema name:ogg
  39. Working, please wait ...
  40. Spooling to file ddl_setup_spool.txt
  41. Checking for sessions that are holding locks on Oracle Golden Gate metadata tables ...
  42. Check complete.
  43. Using OGG as a Oracle GoldenGate schema name.
  44. Working, please wait ...
  45. RECYCLEBIN must be empty.
  46. This installation will purge RECYCLEBIN for all users.
  47. To proceed, enter yes. To stop installation, enter no.
  48. Enter yes or no:yes
  49. ————————其他输出省略————————
  50. STATUS OF DDL REPLICATION
  51. ---------------------------------------------------------------------------------------
  52. SUCCESSFUL installation of DDL Replication software components
  53. Script complete.
  54. SQL> @role_setup.sql
  55. GGS Role setup script
  56. This script will drop and recreate the role GGS_GGSUSER_ROLE
  57. To use a different role name, quit this script and then edit the params.sql script to change the gg_role parameter to the preferred name. (Do not run the script.)
  58. You will be prompted for the name of a schema for the GoldenGate database objects.
  59. NOTE: The schema must be created prior to running this script.
  60. NOTE: Stop all DDL replication before starting this installation.
  61. Enter GoldenGate schema name:ogg
  62. Wrote file role_setup_set.txt
  63. PL/SQL procedure successfully completed.
  64. Role setup script complete
  65. Grant this role to each user assigned to the Extract, GGSCI, and Manager processes, by using the following SQL command:
  66. GRANT GGS_GGSUSER_ROLE TO <loggedUser>
  67. where <loggedUser> is the user assigned to the GoldenGate processes.
  68. SQL> grant ggs_ggsuser_role to ogg;
  69. Grant succeeded.
  70. SQL> @ddl_enable.sql
  71. Trigger altered.
  72. SQL> @?/rdbms/admin/dbmspool.sql
  73. Package created.
  74. Grant succeeded.
  75. View created.
  76. Package body created.
  77. SQL> @ddl_pin.sql ogg
  78. PL/SQL procedure successfully completed.
  79. PL/SQL procedure successfully completed.
  80. PL/SQL procedure successfully completed.

3:source端修改extract进程的params文件,添加"ddl include all"参数,重启extract进程

  1. GGSCI (db1) 1> view params eora_t1
  2. extract eora_t1
  3. setenv (NLS_LANG=AMERICAN_AMERICA.AL32UTF8)
  4. ddl include all
  5. userid ogg,password ogg
  6. exttrail ./dirdat/aa
  7. table hr.*;
  8. GGSCI (db1) 2> stop extract eora_t1
  9. Sending STOP request to EXTRACT EORA_T1 ...
  10. Request processed.
  11. GGSCI (db1) 3> start extract eora_t1
  12. Sending START request to MANAGER ...
  13. EXTRACT EORA_T1 starting
  14. GGSCI (db1) 4> info extract eora_t1
  15. EXTRACT    EORA_T1   Last Started 2012-06-20 15:42   Status RUNNING
  16. Checkpoint Lag       00:00:00 (updated 00:00:10 ago)
  17. Log Read Checkpoint  Oracle Redo Logs
  18. 2012-06-20 15:42:58  Seqno 3, RBA 50044416
  19. SCN 0.567478 (567478)

4:target端修改replicat进程的params文件,添加"ddl include all"和"ddlerror default ignore retryop maxretries 3 retrydelay 5" 参数,重启replicat进程

  1. [root@db2 ~]# su - oracle
  2. [oracle@db2 ~]$ cd $GGATE
  3. [oracle@db2 ogg]$ ggsci
  4. GGSCI (db2) 1> edit params rora_t1
  5. GGSCI (db2) 2> view params rora_t1
  6. replicat rora_t1
  7. setenv (NLS_LANG=AMERICAN_AMERICA.AL32UTF8)
  8. ddl include all
  9. ddlerror default ignore retryop maxretries 3 retrydelay 5
  10. userid ogg,password ogg
  11. handlecollisions
  12. assumetargetdefs
  13. discardfile ./dirrpt/rora_t1.dsc,purge
  14. map hr.* ,target hr.*;
  15. GGSCI (db2) 3> stop replicat rora_t1
  16. Sending STOP request to REPLICAT RORA_T1 ...
  17. Request processed.
  18. GGSCI (db2) 4> start replicat rora_t1
  19. Sending START request to MANAGER ...
  20. REPLICAT RORA_T1 starting
  21. GGSCI (db2) 5> info replicat rora_t1
  22. REPLICAT   RORA_T1   Last Started 2012-06-20 15:50   Status RUNNING
  23. Checkpoint Lag       00:00:00 (updated 00:00:00 ago)
  24. Log Read Checkpoint  File ./dirdat/pa000000
  25. First Record  RBA 4780973

三:测试

  1. [oracle@db1 ogg]$ sqlplus hr/hr
  2. SQL> alter table t2 add location varchar2(200);
  3. Table altered.
  4. SQL> conn hr/hr@db2
  5. Connected.
  6. SQL> desc t2
  7. Name                                      Null?    Type
  8. ----------------------------------------- -------- ----------------------------
  9. ID                                        NOT NULL NUMBER
  10. NAME                                               VARCHAR2(20)
  11. LOCATION                                           VARCHAR2(200)
  12. SQL> conn hr/hr
  13. Connected.
  14. SQL> create table t3 as select object_id,object_name from dba_objects;
  15. Table created.
  16. SQL> conn hr/hr@db2
  17. Connected.
  18. SQL> select tname from tab where tname='T3';
  19. TNAME
  20. ------------------------------
  21. T3
  22. SQL> desc t3;
  23. Name                                      Null?    Type
  24. ----------------------------------------- -------- ----------------------------
  25. OBJECT_ID                                          NUMBER
  26. OBJECT_NAME                                        VARCHAR2(128)

本文转自斩月博客51CTO博客,原文链接http://blog.51cto.com/ylw6006/904373如需转载请自行联系原作者

ylw6006

GoldenGate单向复制配置(支持DDL复制)相关推荐

  1. 【OGG】OGG的单向复制配置-支持DDL(二)

    [OGG]OGG的单向复制配置-支持DDL(二) 一.1  BLOG文档结构图 一.2  前言部分 一.2.1  导读 各位技术爱好者,看完本文后,你可以掌握如下的技能,也可以学到一些其它你所不知道的 ...

  2. goldengate ddl mysql_Oracle GoldenGate 12.2-异构环境的单项复制(支持DDL复制)

    Oracle Golden gate 12版本已经很长世间了,对比前几个版本变化很大.在安装过程已经摈弃了原有命令行形式,采用了与Oracle DB以及weblogic一样的图形解决,在界面上可以选择 ...

  3. Goldengate DDL复制相关注意事项

    Goldengate DDL复制相关注意事项 1.Goldengate DDL复制概述 a.Goldengate开启DDL复制后,不需要对原有的表和以后新加的表执行add trandata操作 这一点 ...

  4. 实战goldengate:安装配置+数据初始化+单向DML复制

    1.安装软件 1.1 下载goldengate 1.2 设置ORACLE_HOME and ORACLE_SID等环境变量 确保安装的oracle实例设置了正确的ORACLE_HOME以及ORACLE ...

  5. Oracle Golden Gate 系列十一 -- 配置 GG DDL 同步 说明 与 示例

    一.DDL 说明 1.1 说明 这部分的说明,在系列四和系列六中已经说明: Oracle Golden Gate 系列六 --11gR2 Ora2Ora 单向复制GG 示例 www.2cto.com/ ...

  6. apache配置支持php

    apache配置支持php 首先安装php运行环境 php笔记 安装步骤 1.检查模块./bin/httpd.exe -M 2.windows添加PHP模块#下载PHP安装包https://windo ...

  7. DTS增量/同步支持DDL迁移的说明

    DTS目前并不支持所有数据库类型时间的DDL迁移,特别是异构数据库之间的迁移.不得不承认DDL的迁移还是非常复杂的,因为这涉及到DDL的解析(DDL的过滤)及转换(库表列映射及异构数据库),详情参考D ...

  8. python 打包 .app 运行 控制台窗口_Python打包工具PyInstaller的安装与pycharm配置支持PyInstaller详细方法...

    windows系统下安装Pyinstaller cmd下输入指令 pip install PyInstaller Pyinstaller的使用 进入需要打包的目录下,执行打包命令 Pyinstalle ...

  9. Mac 配置支持 opengl 的 opencv 4.2

    本教程教大家如何在Mac环境下对opencv源码进行编译,并开启opengl支持.因为配置过程及其艰辛,基本没有现成教程,希望记录下来能帮到有需要的人.其他系统的其实流程更简单 一.准备工作 open ...

最新文章

  1. Job for docker.service failed because the control process exited with error code. See systemctl sta
  2. MySQL中的共享锁与排他锁
  3. 解决System.Data.SqlClient.SqlException (0x80131904): Timeout 时间已到的问题
  4. ML之Clustering:关于Clustering进阶的那些不可告密的事
  5. asp.net中此页的状态信息无效,可能已损坏的解决之道
  6. [转载] C#面向对象设计模式纵横谈——10. Decorator装饰模式
  7. .NET6之MiniAPI(二十):实体验证FluentValidation
  8. Lambda运行时内部:窥视无服务器巢穴
  9. 2020年度JEECG开发者大赛,开发插件赚外块还能赢大奖!!
  10. Vnc-server——linux远程桌面配置
  11. Linux C基础笔记(1)
  12. Camtasia实用技巧之行为效果
  13. 软件设计师历年真题与解析(05-18 包括答案)
  14. PPT快速成长经验,我将其免费告诉你
  15. dede后台登陆提示 验证码不正确 解决办法
  16. win7浏览器主页修改不过来_Win7 IE无法修改默认主页怎么办?解决IE浏览器主页无法修改主页...
  17. win7保护眼睛的颜色设置方法
  18. mysql3306端口被占用无法终止_Mysql3306端口被占用无法启动解决办法
  19. 对成功的渴望和恐惧——谈心理学中的“瓦伦达效应”和“约拿情结”
  20. 谈B2B电商平台与大数据

热门文章

  1. BZOJ 1640: [Usaco2007 Nov]Best Cow Line 队列变换
  2. Oracle 怎么删除重复数据
  3. Rails Minitest style 指南
  4. windows10系统的电脑如何设置密码?
  5. 计算机辅助设计b实验目的,上海电力学院电路计算机辅助设计1--含有受控源电路辅助分析...
  6. C语言中声明复数用什么字母,用c语言定义复数-20210407134457.docx-原创力文档
  7. ubuntu安装ftp_如何在 Ubuntu 20.04 上安装 Webmin
  8. php date函数实现,PHP date() 函数可实现的功能列表
  9. mongoose mysql_mongoose入门
  10. python抓取html中特定的数据库,Python抓取网页中内容,正则分析后存入mysql数据库...