oracle goldengate bi-directional active-active configure
一、golden gate 软件安装,建立安装目录后,在该目录下解压即可。(在源端和目标端都执行)
注意:建议用oracle 用户安装,设置oralce用户的环境变量:
ld_library_path=/usr/lib:/usr/x11r6/lib:$oracle_goldengate:$oracle_home/lib
ld_library_path 中必须有 $oracle_home/lib 才能执行./ggsci ,否则回报缺少动态库文件的错误:
但是这种情况下oracle 数据库运行没有问题。
[oracle@haozg goldengate]$ ./ggsci
./ggsci: error while loading shared libraries: libclntsh.so.11.1: cannot open shared object file:
no such file or directory
原因是:goldengate 在运行时需要oralce 的动态库文件。所以需要把oracle的动态库文件放到共享库中,
赋值给环境变量ld_library_path,ogg 的官方文档是这样描述:
make certain that the database libraries are added to the shared-library environment variables of the system。
--ogg官方文档上的安装步骤
installing oracle goldengate on linux and unix
follow these steps to install oracle goldengate for oracle on a linux or unix system 。
installing the oracle goldengate files
1. extract the oracle goldengate mediapack.zip file to the system and directory where you
want oracle goldengate to be installed.
2. run the command shell.
./ggsci
3、in ggsci, issue the following command to create the oracle goldengate working directories.
create subdirs
4、issue the following command to exit ggsci.
exit
二、创建goldengate 用户(在源端和目标端都执行)
说明:为goldengate软件创建数据库用户,为了不影响生产环境,,此用户用来安装存放一些复制软件自身用到的procedure、table等,
也就是搭建ddl复制环境用到的一些表,过程等。该用户需要有一定的权限。---ddl objects 都在这个用户下。
oracle goldengate schema --ogg 官网上的称呼
注意:该用户在官网上也称之外复制用户: replicate user
1、创建 ogg schema
sql> create user ogg identified by ogg;
user created.
2、对其授权
sql> grant connect,resource,dba to ogg;
grant succeeded.
sql> grant execute on utl_file to ogg;
grant succeeded.
sql> !pwd
/oracle/goldengate
===========配置思路是:先配置主端到灾备端的单向复制,然后再配置从灾备端到主端的单向复制,从而实现双向复制============
三 先执行从主端到灾备端的单向复制配置
------------------------------主端的配置---------------------------------------------------
---------------------------数据库层面的配置--------------------------------------------------
1、检查附加日志情况
select
supplemental_log_data_min
,supplemental_log_data_pk
,supplemental_log_data_ui
,supplemental_log_data_fk
,supplemental_log_data_all from v$database;
正确状态如下:
suppleme sup sup sup sup
-------- --- --- --- ---
yes no no no no
2、增加数据库附加日志及回退
alter database add supplemental log data;
alter database add supplemental log data (primary key, unique,foreign key) columns;
---rollback
alter database drop supplemental log data (primary key, unique,foreign key) columns;
alter database drop supplemental log data;
3、开启数据库强制日志模式
alter database force logging;
------------------------------安装ddl 复制支持-----------------------------
4、执行marker_setup.sql 脚本。this script. installs support for the oracle goldengate ddl marker system
sql> @marker_setup.sql
marker setup script
you will be prompted for the name of a schema for the oracle goldengate database objects.
note: the schema must be created prior to running this script.
note: stop all ddl replication before starting this installation.
enter oracle goldengate schema name:ogg
marker setup table script. complete, running verification script...
please enter the name of a schema for the goldengate database objects:
setting schema name to ogg
marker table
-------------------------------
ok
marker sequence
-------------------------------
ok
script. complete.
sql>
5、执行@ddl_setup.sql
sql> @ddl_setup.sql
oracle goldengate ddl replication setup script
verifying that current user has privileges to install ddl replication...
you will be prompted for the name of a schema for the oracle 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 oracle goldengate schema name:ogg
working, please wait ...
spooling to file ddl_setup_spool.txt
checking for sessions that are holding locks on oracle golden gate metadata tables ...
check complete.
using ogg as a oracle goldengate schema name.
working, please wait ...
ddl replication setup script. complete, running verification script...
please enter the name of a schema for the goldengate database objects:
setting schema name to ogg
clear_trace status:
line/pos error
-------------------- -----------------------------------------------------------------
no errors no errors
create_trace status:
line/pos error
-------------------- -----------------------------------------------------------------
no errors no errors
trace_put_line status:
line/pos error
-------------------- -----------------------------------------------------------------
no errors no errors
initial_setup status:
line/pos error
-------------------- -----------------------------------------------------------------
no errors no errors
ddlversionspecific package status:
line/pos error
-------------------- -----------------------------------------------------------------
no errors no errors
ddlreplication package status:
line/pos error
-------------------- -----------------------------------------------------------------
no errors no errors
ddlreplication package body status:
line/pos error
-------------------- -----------------------------------------------------------------
no errors no errors
ddl ignore table
-----------------------------------
ok
ddl ignore log table
-----------------------------------
ok
ddlaux package status:
line/pos error
-------------------- -----------------------------------------------------------------
no errors no errors
ddlaux package body status:
line/pos error
-------------------- -----------------------------------------------------------------
no errors no errors
sys.ddlctxinfo package status:
line/pos error
-------------------- -----------------------------------------------------------------
no errors no errors
sys.ddlctxinfo package body status:
line/pos error
-------------------- -----------------------------------------------------------------
no errors no errors
ddl history table
-----------------------------------
ok
ddl history table(1)
-----------------------------------
ok
ddl dump tables
-----------------------------------
ok
ddl dump columns
-----------------------------------
ok
ddl dump log groups
-----------------------------------
ok
ddl dump partitions
-----------------------------------
ok
ddl dump primary keys
-----------------------------------
ok
ddl sequence
-----------------------------------
ok
ggs_temp_cols
-----------------------------------
ok
ggs_temp_uk
-----------------------------------
ok
ddl trigger code status:
line/pos error
-------------------- -----------------------------------------------------------------
no errors no errors
ddl trigger install status
-----------------------------------
ok
ddl trigger running status
----------------------------------------------------------------------
enabled
staymetadata in trigger
----------------------------------------------------------------------
off
ddl trigger sql tracing
----------------------------------------------------------------------
0
ddl trigger trace level
----------------------------------------------------------------------
0
location of ddl trace file
------------------------------------------------------------------------------------------------------------------------
/oracle/diag/rdbms/ora11/ora11/trace/ggs_ddl_trace.log
analyzing installation status...
status of ddl replication
------------------------------------------------------------------------------------------------------------------------
successful installation of ddl replication software components
script. complete.
sql>
6、执行role_setup.sql。
the script. drops and creates the role that is needed for ddl synchronization, and it grants dml permissions on
the oracle goldengate ddl objects.
sql> @role_setup.sql。
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:ogg
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
where is the user assigned to the goldengate processes.
sql>
7、grant the role that was created (default name is ggs_ggsuser_role to all oracle goldengate extract users.
sql> grant ggs_ggsuser_role to ogg;
grant succeeded.
sql>