搭建Oracle 到Oracle 的GoldenGate 单向复制测试环境(2)

以上就是GG 的安装,在source target database 都执行。

.配置Source database

GoldenGate通过抓取源端数据库重做日志进行分析,将获取的数据应用到目标端,实现数据同步。因此,源数据库需要必须处于归档模式,并启用附加日志和强制日志。

2.1 归档模式、附加日志、强制日志

--查看

SQL> select log_mode,supplemental_log_data_min,force_logging from v$database;

LOG_MODE     SUPPLEME FOR

------------ -------- ---

ARCHIVELOG  NO       NO

--修改

1archivelog

SQL>shutdown immediate

SQL>startup mount

SQL>alter database archivelog;

SQL>alter database open;

2) force logging

SQL>alterdatabase force logging;

3supplemental log data

SQL>alterdatabase add supplemental log data;

2.2 Oracle 9i_LOG_PARALLELISM参数

如果是Oracle 9i的数据库,还需要将_LOG_PARALLELISM 参数设置为1. 因为GG 不支持该值超过1.

If using OracleGoldenGate for an Oracle 9i source database, set the _LOG_PARALLELISMparameter to 1. Oracle GoldenGate does not support values higher than 1.

2.3 启用DDL 支持

GG虽然支持DDL,但是也是有限制的,GG 支持DDL 也是通过创建一些table 来保存这些DDL 的信息,关于这些table 的具体说明,在如下链接的第二小节:启用GG DDL 操作的支持有详细说明:

对于这些存放DDL 信息表的管理的理论支持,参考如下链接的第四小结:Managing theOracle DDL replication environment

这块的测试内容会另篇Blog进行测试。 

2.3.1 禁用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

2.3.2 创建存放DDL 信息的user并赋权

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

User created.

SQL> grant connect,resource to ggate;

Grant succeeded.

SQL> grant execute on utl_file to ggate;

Grant succeeded.

退出所有使用Oracle session,然后使用SYSDBA权限的用户执行如下脚本:

gg1:/u01/ggate> echo $GGATE

/u01/ggate

--进入GG的目录,然后调用脚本:

gg1:/home/oracle> cd $GGATE

gg1:/u01/ggate> sqlplus / as sysdba;

SQL*Plus: Release 11.2.0.3.0 Production onTue Nov 8 19:41:58 2011

Copyright (c) 1982, 2011, Oracle.  All rights reserved.

Connected to:

Oracle Database 11g Enterprise EditionRelease 11.2.0.3.0 - 64bit Production

With the Partitioning, OLAP, Data Miningand Real Application Testing options

--脚本1

SQL> @marker_setup.sql;

Marker setup 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.

--输入我们之前创建的用户名:

Enter GoldenGate schema name:ggate

Marker setup table script complete, runningverification script...

Please enter the name of a schema for theGoldenGate database objects:

Setting schema name to GGATE

MARKER TABLE

-------------------------------

OK

MARKER SEQUENCE

-------------------------------

OK

Script complete.

--脚本2

SQL> @ddl_setup.sql;

GoldenGate DDL Replication setup script

Verifying that current user has privilegesto install DDL Replication...

You will be prompted for the name of aschema for the GoldenGate database objects.

内容版权声明:除非注明,否则皆为本站原创文章。

转载注明出处:https://www.heiqu.com/25aa33e83ea4dc0190678a506ef888cd.html