Oracle11gR2_使用GoldenGate配置单向同步
这里测试开启DDL同步,忽略初始化过程的单向同步。Oracle测试模式为test。
os:oel 6.5
db:11.2.0.4
ogg:11.2.1.0.1
本测试在源端没有使用pump进程。
1、安装GoldenGate
1.1 解压安装文件
源端和目标端都使用oracle用户进行下列操作:
创建ogg目录并安装:
mkdir -p /u01/ogg
tar xvf fbo_ggs_Linux_x64_ora11g_64bit.tar -C /u01/ogg
1.2 添加环境变量
在源端和目标端编辑oracle用户环境变量,在文件~/.bash_profile中加入下列行:
export PATH=/u01/ogg:$PATH
export LD_LIBRARY_PATH=/u01/ogg:$LD_LIBRARY_PATH
并使其生效:
source ~/.bash_profile
1.3 使用ggsci创建目录
在源端和目标端都执行:
[oracle@oraclesrc ogg]$ ggsci
GGSCI (oraclesrc) 1> create subdirs
2、配置源端数据库强制归档
查看源端数据库归档情况:
SQL> select log_mode,supplemental_log_data_min,force_logging from v$database;
LOG_MODE SUPPLEME FOR
------------ -------- ---
NOARCHIVELOG NO NO
修改归档模式:
SQL>shutdown immediate
SQL>startup mount
SQL>alter database archivelog;
SQL>alter database open;
SQL>alter database force logging;
SQL>alter database add supplemental log data;
3、开启DDL同步
配置DDL同步需要在源端执行以下操作
3.1 创建存放DDL信息的user
SQL> create user ogg identified by ogg default tablespace users temporary tablespace temp;
User created.
SQL> grant connect,resource,dba to ogg;
Grant succeeded.
SQL> grant create table,create sequence to ogg;
Grant succeeded.
SQL> grant execute on utl_file to ogg;
Grant succeeded.
在目标端同样创建一次该用户,用来存放同步相关信息。
3.2 执行脚本
进入OGG目录执行以下脚本:
[oracle@oraclesrc ~]$ cd /u01/ogg
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
--