Welcome 微信登录

首页 / 数据库 / MySQL / 搭建一个Oracle到Oracle的GoldenGate双向复制环境

目标:搭建一个Oracle到Oracle的Goldengate双向复制环境(支持DDL+DML)。环境:OS:Red Hat Enterprise Linux Server release 5.5 (Tikanga)DB:Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - Productiongg1和gg2互为source和target,所处OS和所安DB均一样。 GoldenGate单向表DML同步 http://www.linuxidc.com/Linux/2013-04/82942.htm Oracle GoldenGate 系列:Extract 进程的恢复原理 http://www.linuxidc.com/Linux/2013-04/82563.htm Oracle GoldenGate安装配置 http://www.linuxidc.com/Linux/2013-02/79455.htm Oracle goldengate的OGG-01004 OGG-1296错误 http://www.linuxidc.com/Linux/2011-08/40951.htm Oracle GoldenGate快速入门教程:基本概念和配置 http://www.linuxidc.com/Linux/2014-09/106677.htm搭建Oracle 到Oracle 的Golden Gate 单向复制测试环境 http://www.linuxidc.com/Linux/2014-11/109102.htm 一、安装GG在gg1和gg2都执行如下操作:(1)添加环境变量,在/home/oracle/.bash_profile文件里添加如下内容:export PATH=/u01/ggate:$PATHexportLD_LIBRARY_PATH=/u01/ggate:$LD_LIBRARY_PATHexport ggtest=/u01/ggate这里的GG 和Oracle 使用的是相同的用户,所以把GG 的变量加上就可以了。加载刚刚设置的环境变量:source/home/oracle/.bash_profile(2)使用ggsci工具,创建必要的目录gg1:/u01/ggate> ggsci--调用ggsci 工具Oracle GoldenGate Command Interpreter forOracleVersion 11.1.1.1OGGCORE_11.1.1_PLATFORMS_110421.2040Linux, x64, 64bit (optimized), Oracle 11gon Apr 21 2011 22:42:14 Copyright (C) 1995, 2011, Oracle and/or itsaffiliates. All rights reserved. GGSCI (gg1) 1> create subdirs--使用ggsci 工具创建目录Creating subdirectories under currentdirectory /u01/ggate Parameter files                /u01/ggate/dirprm: createdReport files                   /u01/ggate/dirrpt: createdCheckpoint files               /u01/ggate/dirchk: createdProcess status files           /u01/ggate/dirpcs: createdSQL script files               /u01/ggate/dirsql: createdDatabase definitions files     /u01/ggate/dirdef: createdExtract data files             /u01/ggate/dirdat: createdTemporary files                /u01/ggate/dirtmp: createdVeridata files                 /u01/ggate/dirver: createdVeridata Lock files            /u01/ggate/dirver/lock: createdVeridata Out-Of-Sync files     /u01/ggate/dirver/oos: createdVeridata Out-Of-Sync XML files/u01/ggate/dirver/oosxml: createdVeridata Parameter files       /u01/ggate/dirver/params: createdVeridata Report files          /u01/ggate/dirver/report: createdVeridata Status files          /u01/ggate/dirver/status: createdVeridata Trace files           /u01/ggate/dirver/trace: createdStdout files                   /u01/ggate/dirout: created GGSCI (gg1) 2> 以上就是GG 的安装,在source 和target database 都执行。二、分别配置source和target(1)GoldenGate通过抓取源端数据库重做日志进行分析,将获取的数据应用到目标端,实现数据同步。因此,源数据库需要必须处于归档模式,并启用附加日志和强制日志。归档模式、附加日志、强制日志--查看SQL> select log_mode,supplemental_log_data_min,force_logging from v$database;LOG_MODE     SUPPLEME FOR------------ -------- ---ARCHIVELOG  NO       NO --修改(1)archivelogSQL>shutdown immediateSQL>startup mountSQL>alter database archivelog;SQL>alter database open;(2)force loggingSQL>alterdatabase force logging;(3)supplemental log dataSQL>alterdatabase add supplemental log data;(2)禁用Recycle Bin如果启用DDL 支持,必须关闭recycle bin。官网的解释如下:If the recyclebin is enabled, the Oracle GoldenGate DDL trigger session receives implicitrecycle bin DDL operations that cause the trigger to fail.Oracle 11g:SQL> alter system set recyclebin=offscope=spfile;System altered.如果数据库是10g,需要关闭recyclebin并重启;或者手工purge recyclebin。(3)创建存放DDL 信息的user并赋权SQL> create user ggtest identified by oracle default tablespace users temporary tablespace temp;User created.SQL> grant connect,resource to ggtest;Grant succeeded.SQL> grant execute on utl_file to ggtest;Grant succeeded.退出所有使用Oracle 的session,然后使用SYSDBA权限的用户执行如下脚本:gg1:/u01/ggate> echo $ggate/u01/ggate--进入GG的目录,然后调用脚本:gg1:/home/oracle> cd $ggategg1:/u01/ggate> sqlplus / as sysdba;SQL*Plus: Release 11.2.0.3.0 Production onTue Nov 8 19:41:58 2011Copyright (c) 1982, 2011, Oracle.  All rights reserved.Connected to:Oracle Database 11g Enterprise EditionRelease 11.2.0.3.0 - 64bit ProductionWith the Partitioning, OLAP, Data Miningand Real Application Testing options--脚本1:SQL> @marker_setup.sql;Marker setup scriptYou will be prompted for the name of aschema for the GoldenGate database objects.NOTE: The schema must be created prior torunning this script.NOTE: Stop all DDL replication beforestarting this installation.--输入我们之前创建的用户名:Enter GoldenGate schema name:ggtestMarker setup table script complete, runningverification script...Please enter the name of a schema for theGoldenGate database objects:Setting schema name to ggtestMARKER TABLE-------------------------------OKMARKER SEQUENCE-------------------------------OKScript complete.--脚本2:SQL> @ddl_setup.sql;GoldenGate DDL Replication setup scriptVerifying that current user has privilegesto install DDL Replication...You will be prompted for the name of aschema for the GoldenGate database objects.NOTE: For an Oracle 10g source, the systemrecycle bin must be disabled. For Oracle 11g and later, it can be enabled.--注意这里提示我们在10g里,必须关闭recycle bin,在11g以后的版本,可以不用关闭。NOTE: The schema must be created prior torunning this script.NOTE: Stop all DDL replication beforestarting this installation.--提示输入GG的用户:Enter GoldenGate schema name:ggtestYou will be prompted for the mode ofinstallation.To install or reinstall DDL replication,enter INITIALSETUPTo upgrade DDL replication, enter NORMAL--这里让我们选择安装模式: install 和 reinstall 选择INITIALSETUPEnter mode of installation:INITIALSETUPWorking, please wait ...Spooling to file ddl_setup_spool.txtChecking for sessions that are holdinglocks on Oracle Golden Gate metadata tables ...Check complete.Using ggtest as a GoldenGate schema name,INITIALSETUP as a mode of installation. Working, please wait ... DDL replication setup script complete,running verification script...Please enter the name of a schema for theGoldenGate database objects:Setting schema name to ggtest DDLORA_GETTABLESPACESIZE STATUS:…… STATUS OF DDL REPLICATION-------------------------------------------------------------------------------------------------------SUCCESSFUL installation of DDL Replicationsoftware components Script complete.--脚本3:SQL> @role_setup.sql;GGS Role setup scriptThis script will drop and recreate the roleGGS_GGSUSER_ROLETo use a different role name, quit thisscript and then edit the params.sql script to change the gg_role parameter tothe preferred name. (Do not run the script.) You will be prompted for the name of aschema for the GoldenGate database objects.NOTE: The schema must be created prior torunning this script.NOTE: Stop all DDL replication beforestarting this installation.--同样输入GG用户名:Enter GoldenGate schema name:ggtestWrote file role_setup_set.txtPL/SQL procedure successfully completed.Role setup script complete Grant this role to each user assigned tothe Extract, GGSCI, and Manager processes, by using the following SQL command:--这里提示我们赋权给相关的用户:GRANT GGS_GGSUSER_ROLE TO<loggedUser>where <loggedUser> is the userassigned to the GoldenGate processes.--脚本4:赋权SQL> grant GGS_GGSUSER_ROLE to ggtest;Grant succeeded.--脚本5:SQL> @ddl_enable.sql;Trigger altered.注意这里脚本创建的table都是使用默认的名称,当然也可以修改这些table的默认名。 更多详情见请继续阅读下一页的精彩内容: http://www.linuxidc.com/Linux/2014-11/109101p2.htm
  • 1
  • 2
  • 下一页
配置MySQL服务器实现主主复制搭建Oracle 到Oracle 的GoldenGate 单向复制测试环境相关资讯      GoldenGate 
  • Oracle Goldengate在HP平台裸设备  (今 11:04)
  • GoldenGate for Oracle 数据一致性  (10/10/2015 19:41:17)
  • 使用GoldenGate 实现Oracle for   (09/16/2015 09:42:31)
  • GoldenGate中使用FILTER,COMPUTE   (07月27日)
  • GoldenGate 实现Oracle for Oracle  (09/20/2015 13:49:00)
  • Oracle GoldenGate 学习教程二、配  (08/27/2015 09:19:01)
本文评论 查看全部评论 (0)
表情: 姓名: 字数

版权所有©石家庄振强科技有限公司2024 冀ICP备08103738号-5 网站地图