IT技术互动交流平台

GoldenGate配置实例:RHEL 4.7下的Oracle 10g RAC到单实例的单向同步(二)

作者:狂浪 的旮旯天地  发布日期:2011-12-09 16:39:37

安装DDL OBJECTS


在源端,以oracle用户登录sqlplus,执行以下脚本

 


执行marker_setup

确保goldengate的相关进程 关闭状态,任何使用oracle的应用程序都已关闭,且不会有新的会话产生。然后执行下面命令

[goldengate@gg1 ~]$ cd /opt/gg/goldengate/
[goldengate@gg1 goldengate]$ sqlplus / as sysdba

SQL> @marker_setup

Marker setup script

You will be prompted for the name of a schema for the GoldenGate database objects.
NOTE: The schema must be created prior to running this script.
NOTE: Stop all DDL replication before starting this installation.

Enter GoldenGate schema name:goldengate

……

Script complete.

SQL>

 

 

执行ddl_setup

确保所有的会话都已关闭

SQL> @ddl_setup

GoldenGate DDL Replication setup script

Verifying that current user has privileges to install DDL Replication...
Checking user sessions...

Check complete.

You will be prompted for the name of a schema for the GoldenGate database objects.
NOTE: For an Oracle 10g source, the system recycle bin must be disabled. For Oracle 11g and later, it can be enabled.
NOTE: The schema must be created prior to running this script.
NOTE: Stop all DDL replication before starting this installation.

Enter GoldenGate schema name:goldengate

You will be prompted for the mode of installation.
To install or reinstall DDL replication, enter INITIALSETUP
To upgrade DDL replication, enter NORMAL
Enter mode of installation:INITIALSETUP

Working, please wait ...
Spooling to file ddl_setup_spool.txt

Using GOLDENGATE as a GoldenGate schema name, INITIALSETUP as a mode of installation.

Working, please wait ...

RECYCLEBIN must be empty.
This installation will purge RECYCLEBIN for all users.
To proceed, enter yes. To stop installation, enter no.

Enter yes or no:yes

……

Script complete.
SQL>

 

执行role_setup

创建一个名为ggs_ggsuser_role的角色,包含了ddl objects需要的权限
SQL> @role_setup

GGS Role setup script

This script will drop and recreate the role GGS_GGSUSER_ROLE
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.)

You will be prompted for the name of a schema for the GoldenGate database objects.
NOTE: The schema must be created prior to running this script.
NOTE: Stop all DDL replication before starting this installation.

Enter GoldenGate schema name:goldengate
Wrote file role_setup_set.txt

PL/SQL procedure successfully completed.

Role setup script complete

Grant this role to each user assigned to the Extract, GGSCI, and Manager processes, by using the following SQL command:

GRANT GGS_GGSUSER_ROLE TO <loggedUser>

where <loggedUser> is the user assigned to the GoldenGate processes.
SQL>

 

将创建的角色授权给goldengate用户

SQL> grant ggs_ggsuser_role to goldengate;

Grant succeeded.

SQL>

 

启用DDL触发器

SQL> @ddl_enable

Trigger altered.

SQL>

 

安装可选的性能工具


安装dbms_shared_pool包


如果系统中不存在dbms_shared_pool包,则手动执行脚本安装。如下

SQL> select object_name,object_type from dba_objects where object_name='DBMS_SHARED_POOL';

no rows selected

SQL> @?/rdbms/admin/dbmspool

Package created.

Grant succeeded.

View created.

Package body created.

SQL> select object_name,object_type from all_objects where object_name='DBMS_SHARED_POOL';

OBJECT_NAME OBJECT_TYPE
------------------------------ -------------------
DBMS_SHARED_POOL PACKAGE
DBMS_SHARED_POOL PACKAGE BODY

2 rows selected.

 

ddl_pin


ddl_pin将触发器用到的plsql包放进内存中

SQL> @ddl_pin goldengate

PL/SQL procedure successfully completed.

PL/SQL procedure successfully completed.

PL/SQL procedure successfully completed.

SQL>

 

 

 


配置goldengate


创建goldengate工作目录


源端和目标端:

[goldengate@rac1 goldengate]$ cd $GG_HOME
[goldengate@rac1 goldengate]$ ./ggsci

GGSCI (rac1) 1> create subdirs

Creating subdirectories under current directory /opt/gg/goldengate

Parameter files /opt/gg/goldengate/dirprm: created
Report files /opt/gg/goldengate/dirrpt: created
Checkpoint files /opt/gg/goldengate/dirchk: created
……

GGSCI (gg1) 2> exit

 

创建trail文件存放目录


源和目标端:

[goldengate@rac1 ~]$ mkdir /opt/gg/trails
[goldengate@rac1 ~]$ ls -l /opt/gg | grep trails
drwxr-xr-x 2 goldengate oinstall 4096 Nov 27 14:57 trails
[goldengate@rac1 ~]$

 

配置MANAGER


源端和目标端:

DYNAMICPORTLIST中配置了GoldenGate(extract和replicat)进程使用的端口范围
PORT参数指定MANAGER使用的端口
AUTORESTART参数使抽取/复制进程失败后自动重启
配置MANAGER的参数,PURGEOLDEXTRACTS参数指定:当根据checkpoint发现已经完成抽取和复制的trail文件将被自动删除,但保留最近10个。
PURGEDDLHISTORY和PURGEMARKERHISTORY分别删除DDL历史表和marker表中的过期数据,以控制它们不会变得过于庞大。

GGSCI (gg1) 1> edit params mgr

DYNAMICPORTLIST 7840-7914
PORT 5898
PURGEOLDEXTRACTS /opt/gg/trails/w1*, USECHECKPOINTS, MINKEEPFILES 10
PURGEOLDEXTRACTS /opt/gg/trails/w2*, USECHECKPOINTS, MINKEEPFILES 10
AUTORESTART ER *, RETRIES 3, WAITMINUTES 5
PURGEDDLHISTORY MINKEEPDAYS 3, MAXKEEPDAYS 5, FREQUENCYMINUTES 30
PURGEMARKERHISTORY MINKEEPDAYS 3, MAXKEEPDAYS 5, FREQUENCYMINUTES 30
~
~

 

Tag标签: GoldenGate配置实例  
  • 专题推荐

About IT165 - 广告服务 - 隐私声明 - 版权申明 - 免责条款 - 网站地图 - 网友投稿 - 联系方式
本站内容来自于互联网,仅供用于网络技术学习,学习中请遵循相关法律法规