Oracle GoldenGate安装配置


Oracle GoldenGate软件基于数据库日志结构变化,通过解析源端在线日志或归档日志获得数据增量,再将这些变化应用到目标数据库,从而实现源库和目标库的数据同步。下面通过一个简单的示例,详细介绍利用GoldenGate实现Oracle数据库之间的同步。基本架构如下图所示:

1. 安装

1.1 下载介质

GoldenGate的安装介质可以从Oracle的官网上下载。

http://www.oracle.com/technetwork/middleware/goldengate/downloads/index.html

1.2 配置GoldenGate用户

下载完成后将其拷贝到源和目标的相应位置解压完成后,即可以开始进行配置。

# useradd -g oinstall -G dba ggate

# su – ggate

$ mkdir /oracle/ggate

$ cd /oracle/ggate

$ unzip  ……

$tar  ……

$ vi ~/.bash_profile

 

添加如下的内容:

 

export ORACLE_BASE=/oracle

export ORACLE_HOME=$ORACLE_BASE/db

export LD_LIBRARY_PATH=$ORACLE_HOME/lib:/oracle/ggate

export GGATE=/oracle/ggate

 

1.3 创建目录

 

使用ggsci工具,创建必要的目录。

$ cd /oracle/ggate

$ ./ggsci

 

Oracle GoldenGate Command Interpreter for Oracle

Version 11.1.1.0.0 Build 078

Linux, x86, 32bit (optimized), Oracle 10 on Jul 282010 13:24:18

Copyright (C) 1995, 2010, Oracle and/or itsaffiliates. All rights reserved.

GGSCI (gridcontrol) 1> create subdirs

至此,GoldenGate基本的安装完成。

 

注意: 此部分需要在源端和目标端完成。

 

2. 源数据库配置

 

GoldenGate主要通过抓取源端数据库重做日志进行分析,将获取的数据应用到目标端,实现数据同步。因此,为了让GoldenGate能够正常工作,源数据库需要进行一定配置。

2.1 设置源库为归档模式

 

SQL> shutdown immediate

SQL> startup mount

SQL> alter database archivelog;

SQL> alter database open;

 

2.2 开启minimal supplemental logging

 

SQL> alter database add supplemental log data;

SQL> select SUPPLEMENTAL_LOG_DATA_MIN fromv$database;

SUPPLEME

——–

YES

 

2.3 关闭数据库的recyblebin

 

SQL> alter system set recyclebin=off scope=spfile;

 

如果数据库是10g,需要关闭recyclebin并重启;或者手工purge recyclebin。

 

2.4 配置复制的DDL支持

 

SQL> create user ggate identified by ggate defaulttablespace users temporary tablespace temp;

SQL> grant connect,resource,dba,unlimitedtablespace to ggate;

SQL> grant execute on utl_file to ggate;

 

SQL> @$GGATE/marker_setup.sql;

SQL> @$GGATE/ddl_setup.sql;

SQL> @$GGATE/role_setup.sql;

SQL> grant GGS_GGSUSER_ROLE to ggate;

SQL> @$GGATE/ddl_enable.sql;

 

2.5 创建源端和目标端的测试用户

 

source

SQL> create user sender identified by oracledefault tablespace users temporary tablespace temp;

SQL> grant connect,resource,unlimited tablespace tosender;

 

destination

SQL> create user ggate identified by ggate defaulttablespace users temporary tablespace temp;

SQL> grant connect,resource,dba,unlimitedtablespace to ggate;

SQL> create user receiver identified by oracledefault tablespace users temporary tablespace temp;

SQL> grant connect,resource,unlimited tablespace toreceiver;

  • 1
  • 2
  • 3
  • 下一页

相关内容