ogg12 oracle to oracle 雙向DDL複製

ahfhuang發表於2017-04-07

一、OGG雙向DDL複製
1、基本資訊
1.1 經典抽取模式+ trigger based ddl 方式配置
node1: hostname ogg1 IP 192.168.91.137
node2: hostname ogg2 IP 192.168.91.138

1.2 版本資訊
[oracle@ogg1 ~]$ cd $GG_HOME
[oracle@ogg1 goldengate]$ ggsci -v

Oracle GoldenGate Command Interpreter for Oracle
Version 12.2.0.1.1 OGGCORE_12.2.0.1.0_PLATFORMS_151211.1401_FBO
Linux, x64, 64bit (optimized), Oracle 11g on Dec 12 2015 00:54:38
Copyright (C) 1995, 2015, Oracle and/or its affiliates. All rights reserved.

[oracle@ogg1 goldengate]$ sqlplus /nolog

SQL*Plus: Release 11.2.0.4.0 Production on Fri Mar 31 10:49:37 2017
Copyright (c) 1982, 2013, Oracle.  All rights reserved.

SQL> connect / as sysdba
Connected.

SQL> select banner from v$version;
BANNER
--------------------------------------------------------------------------------
Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production
PL/SQL Release 11.2.0.4.0 - Production
CORE 11.2.0.4.0 Production
TNS for Linux: Version 11.2.0.4.0 - Production
NLSRTL Version 11.2.0.4.0 - Production

SQL> exit
Disconnected from Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options

[oracle@ogg1 goldengate]$ cat /etc/redhat-release
CentOS release 6.5 (Final)

1.3 拓撲圖

  eddl1--------------------->aa----------------->pddl1----------------->bb------------>rddl1
node1                                                                                     node2

  rddl2<------------------dd<----------------------pddl2<---------------cc<------------eddl2

2、安裝GG,在兩個節點安裝OGG軟體
$ su - root
$ mkdir -p /u01/app/goldengate
$ chown -R oracle:oinstall /u01/app/goldengate
$ su - oracle
$ cd
$ ll unzip fbo_ggs_Linux_x64_shiphome.zip
$ cd /home/oracle/fbo_ggs_Linux_x64_shiphome/Disk1
$ sed -i "s/INSTALL_OPTION=/INSTALL_OPTION=ORA11g/" /home/oracle/fbo_ggs_Linux_x64_shiphome/Disk1/response/oggcore.rsp
$ sed -i "s|SOFTWARE_LOCATION=|SOFTWARE_LOCATION=/u01/app/goldengate|" /home/oracle/fbo_ggs_Linux_x64_shiphome/Disk1/response/oggcore.rsp
$ sed -i "s/START_MANAGER=/START_MANAGER=false/" /home/oracle/fbo_ggs_Linux_x64_shiphome/Disk1/response/oggcore.rsp
$ ./runInstaller -silent -responseFile /home/oracle/fbo_ggs_Linux_x64_shiphome/Disk1/response/oggcore.rsp


3、配置環境變數
配置oracle使用者的環境變數(ogg2節點改ORACLE_SID=ggtt即可)

$ vi ~/.bash_profile

export ORACLE_BASE=/u01/app/oracle
export ORACLE_HOME=$ORACLE_BASE/product/11.2.0/dbhome_1
export ORACLE_SID=ggss
export PATH=$PATH:$ORACLE_HOME/bin:$HOME/bin:$ORACLE_HOME/jdk/bin
export PATH=$ORACLE_HOME/bin:/usr/sbin:$GG_HOME:$PATH
export TNS_ADMIN=$ORACLE_HOME/network/admin
export NLS_LANG=AMERICAN_AMERICA.AL32UTF8
export NLS_DATE_FORMAT="YYYY-MM-DD HH24:MI:SS"
export LD_LIBRARY_PATH=$ORACLE_HOME/lib:/usr/lib:/usr/local/lib
export GG_HOME=/u01/app/goldengate
umask 022

$ source  ~/.bash_profile


4、配置監聽
4.1 兩節點伺服器上配置tnsnames.oras
$ vi $TNS_ADMIN/tnsnames.ora

GGSS =
  (DESCRIPTION =
    (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.91.137)(PORT = 1521))
    (CONNECT_DATA =
      (SERVER = DEDICATED)
      (SERVICE_NAME = ggss)
    )
  )

GGTT =
  (DESCRIPTION =
    (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.91.138)(PORT = 1521))
    (CONNECT_DATA =
      (SERVER = DEDICATED)
      (SERVICE_NAME = ggtt)
    )
  )

4.2 互相ping通
OGG1端:
[oracle@ogg1]$ sqlplus sys/oracle4U@ggtt as sysdba
OGG2端:
[oracle@ogg2]$ sqlplus sys/oracle4U@ggss as sysdba


5、配置資料庫引數
5.1 建立ogg使用者(兩節點操作基本相同,具體根據實際情況修改)
[oracle@ogg1]$ mkdir -p /u01/app/archivelog
[oracle@ogg1]$ sqlplus / as sysdba
[oracle@ogg1 Disk1]$ sqlplus / as sysdba

SQL*Plus: Release 11.2.0.4.0 Production on Thu Apr 6 01:01:34 2017
Copyright (c) 1982, 2013, Oracle.  All rights reserved.
Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options

SQL> alter system set log_archive_dest_1='LOCATION=/u01/app/archivelog' scope=spfile;
System altered.

SQL> alter system set log_archive_format='ggss_%t_%s_%r.arc' scope=spfile;
System altered.

SQL> shutdown immediate
Database closed.
Database dismounted.
ORACLE instance shut down.

SQL> startup mount
ORACLE instance started.
Total System Global Area  843456512 bytes
Fixed Size      2257920 bytes
Variable Size    545262592 bytes
Database Buffers   293601280 bytes
Redo Buffers      2334720 bytes
Database mounted.

SQL> alter database archivelog;
Database altered.

SQL> alter database open;
Database altered.

SQL> archive log list;
Database log mode        Archive Mode
Automatic archival        Enabled
Archive destination        /u01/app/archivelog
Oldest online log sequence     3
Next log sequence to archive   5
Current log sequence        5

SQL> alter database add supplemental log data;
Database altered.

SQL> select supplemental_log_data_min from v$database;
SUPPLEME
--------
YES

SQL> alter database force logging;
Database altered.

SQL> create tablespace tbs_ogg datafile '/u01/app/oracle/oradata/ggss/tbs_ogg.dat' size 200M autoextend on next 5M;
Tablespace created.

SQL> create user ogg identified by ogg default tablespace tbs_ogg temporary tablespace temp account unlock;
User created.

SQL> alter system set enable_goldengate_replication = true scope=both;
System altered.

SQL> alter user ogg quota unlimited on tbs_ogg;
User altered.

SQL> grant connect,resource to ogg;
Grant succeeded.

SQL> grant execute on utl_file to ogg;
Grant succeeded.


6、啟用ddl,兩端均配置
執行OGG支援DDL指令碼
[oracle@ogg1 ]$ cd $GG_HOME
[oracle@ogg1 goldengate]$ sqlplus / as sysdba

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> @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
------------------------------------------------------------------------------------------------------------------------
NONE

LOCATION OF DDL TRACE FILE
------------------------------------------------------------------------------------------------------------------------
/u01/app/oracle/diag/rdbms/ggss/ggss/trace/ggs_ddl_trace.log

Analyzing installation status...

VERSION OF DDL REPLICATION
------------------------------------------------------------------------------------------------------------------------
OGGCORE_12.2.0.1.0_PLATFORMS_151211.1401

STATUS OF DDL REPLICATION
------------------------------------------------------------------------------------------------------------------------
SUCCESSFUL installation of DDL Replication software components

Script complete.

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 <loggedUser>

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

SQL> grant GGS_GGSUSER_ROLE to ogg;
grant succeeded.

SQL> @ddl_enable.sql
Trigger altered.


7、準備初始化測試資料
7.1 OGG1端:
[oracle@ogg1 goldengate]$ sqlplus / as sysdba
SQL> create tablespace TESTTBS001 datafile '/u01/app/oracle/oradata/ggss/testtbs001.dat' size 100M autoextend on next 5M;
Tablespace created.

SQL> create user testogg identified by test2017 default tablespace TESTTBS001 temporary tablespace temp;
User created.

SQL> create directory dump_dir as '/home/oracle/dump';
Directory created.

SQL> grant connect,resource,select_catalog_role to testogg;
Grant succeeded.

SQL> grant select any dictionary to testogg;
Grant succeeded.

SQL> grant read,write on directory dump_dir to testogg;
Grant succeeded.

SQL> conn testogg/test2017
Connected.
SQL> create table t1 as select * from dba_objects;
Table created.

SQL> select count(*) from t1 ;
  COUNT(*)
----------
     86322


[oracle@ogg1 goldengate]$ mkdir -p /home/oracle/dump
[oracle@ogg1 goldengate]$ expdp system/oracle4U@ggss schemas=testogg dumpfile=expdp_testogg.dmp directory=dump_dir logfile=exppd_testogg.log
[oracle@ogg1 goldengate]$ scp -r /home/oracle/dump/expdp_testogg.dmp oracle@192.168.91.138:/home/oracle/dump/expdp_testogg.dmp
oracle@192.168.91.138's password:
expdp_testogg.dmp                             100% 8756KB   8.6MB/s   00:00
  注:保證對端有此目錄

7.2 OGG2端:
[oracle@ogg2 goldengate]$ mkdir -p /home/oracle/dump
[oracle@ogg2 goldengate]$ sqlplus / as sysdba
SQL> create tablespace TESTTBS001 datafile '/u01/app/oracle/oradata/ggtt/testtbs001.dat' size 100M autoextend on next 5M;
SQL> create directory dump_dir as '/home/oracle/dump';
SQL> exit
[oracle@ogg2 goldengate]$ impdp system/oracle4U DIRECTORY=dump_dir DUMPFILE=expdp_testogg.dmp schemas=testogg
[oracle@ogg2 goldengate]$ sqlplus / as sysdba
SQL> alter user testogg identified by test2017 account unlock;
SQL> truncate table testogg.t1;
Table truncated


8、分別在兩端配置GG引數(操作基本相同,具體根據實際情況配置)
[oracle@ogg2 goldengate]$ cd $GG_HOME
[oracle@ogg2 goldengate]$ ./ggsci

GGSCI (ogg1) 1> create subdirs

Creating subdirectories under current directory /u01/app/goldengate

Parameter files                /u01/app/goldengate/dirprm: created
Report files                   /u01/app/goldengate/dirrpt: created
Checkpoint files               /u01/app/goldengate/dirchk: created
Process status files           /u01/app/goldengate/dirpcs: created
SQL script files               /u01/app/goldengate/dirsql: created
Database definitions files     /u01/app/goldengate/dirdef: created
Extract data files             /u01/app/goldengate/dirdat: created
Temporary files                /u01/app/goldengate/dirtmp: created
Credential store files         /u01/app/goldengate/dircrd: created
Masterkey wallet files         /u01/app/goldengate/dirwlt: created
Dump files                     /u01/app/goldengate/dirdmp: created

GGSCI (ogg1) 2> edit params mgr
GGSCI (ogg1) 3> view params mgr
PORT 7809
autorestart er *,retries 5,waitminutes 2
ACCESSRULE, PROG REPLICAT, IPADDR 192.168.91.138, ALLOW    // IP為目標端地址

GGSCI (ogg1) 4> start mgr
Manager started.

GGSCI (ogg1) 5> info mgr
Manager is running (IP port ogg1.7809, Process ID 15567).

GGSCI (ogg1) 6> dblogin userid ogg,password ogg
Successfully logged into database.

GGSCI (ogg1 as ogg@ggss) 7> edit params ./GLOBAL

GGSCI (ogg1 as ogg@ggss) 8> view params ./GLOBAL
ggschema ogg
checkpointtable ogg.checkpoint


9、配置兩端GG引數
9.1 OGG1端配置
(a) 在測試表上增加補充日誌
[oracle@ogg1 goldengate]$ cd $GG_HOME
[oracle@ogg1 goldengate]$ ./ggsci
GGSCI (ogg1) 1> dblogin userid ogg, password ogg
Successfully logged into database.

GGSCI (ogg1 as ogg@ggss) 2> add trandata testogg.*
2017-04-06 01:39:26  WARNING OGG-06439  No unique key is defined for table T1. All viable columns will be used to represent the key, but may not guarantee uniqueness. KEYCOLS may be used to define the key.
Logging of supplemental redo data enabled for table TESTOGG.T1.
TRANDATA for scheduling columns has been added on table 'TESTOGG.T1'.
TRANDATA for instantiation CSN has been added on table 'TESTOGG.T1'.

(b) 增加 checkpoint 表
GGSCI (ogg1 as ogg@ggss) 3> add checkpointtable ogg.checkpoint
Successfully created checkpoint table ogg.checkpoint.

  注:如果沒新增此表,報錯ERROR OGG-00446 OGG-01668
 
GGSCI (ogg1 as ogg@ggss) 4> exit

(c) 正向抽取程式:
[oracle@ogg1 goldengate]$ ./ggsci
GGSCI (ogg1) 1> add extract eddl1, tranlog, begin now;
EXTRACT added.

GGSCI (ogg1) 2> add exttrail ./dirdat/aa extract eddl1, megabytes 100
EXTTRAIL added.

GGSCI (ogg1) 3> edit params eddl1
GGSCI (ogg1) 4> view params eddl1

extract eddl1
userid ogg, password ogg
ddl include all
ddloptions report
ddloptions addtrandata
ddloptions getreplicates
exttrail ./dirdat/aa
TRANLOGOPTIONS EXCLUDEUSER ogg
table testogg.*;

  注:如果沒新增 TRANLOGOPTIONS EXCLUDEUSER ogg 配置,會導致資料重複插入
 
(d) 正向投遞程式:
GGSCI (ogg1) 5> add extract pddl1, exttrailsource ./dirdat/aa
EXTRACT added.

GGSCI (ogg1) 6> add rmttrail ./dirdat/bb, extract pddl1, megabytes 100
RMTTRAIL added.

GGSCI (ogg1) 7> edit params pddl1
GGSCI (ogg1) 8> view params pddl1

extract  pddl1
userid ogg, password ogg
rmthost 192.168.91.138, mgrport 7809
rmttrail ./dirdat/bb
table testogg.*;

(e) 反向複製程式:
GGSCI (ogg1) 9> add replicat rddl2 exttrail ./dirdat/dd,checkpointtable ogg.checkpoint
REPLICAT added.

GGSCI (ogg1) 10> edit params rddl2
GGSCI (ogg1) 11> view params rddl2

replicat rddl2
userid ogg,password ogg
ddl include all
ddloptions report
ddloptions updatemetadata
ddlerror default ignore retryop
discardfile ./dirrpt/rddl.dsc, purge
DBOPTIONS DEFERREFCONST
DBOPTIONS SUPPRESSTRIGGERS
map testogg.*, target testogg.*;

9.2 OGG2端
(a) 在測試表上增加補充日誌
[oracle@ogg2 goldengate]$ cd $GG_HOME
[oracle@ogg2 goldengate]$ ./ggsci
GGSCI (ogg2) 1> dblogin userid ogg, password ogg
fully logged into database.

GGSCI (ogg2 as ogg@ggtt) 2> add trandata testogg.*
2017-04-06 01:45:51  WARNING OGG-06439  No unique key is defined for table T1. All viable columns will be used to represent the key, but may not guarantee uniqueness. KEYCOLS may be used to define the key.
Logging of supplemental redo data enabled for table TESTOGG.T1.
TRANDATA for scheduling columns has been added on table 'TESTOGG.T1'.
TRANDATA for instantiation CSN has been added on table 'TESTOGG.T1'.

(b) 增加 checkpoint 表
GGSCI (ogg2 as ogg@ggtt) 3> add checkpointtable ogg.checkpoint
Successfully created checkpoint table ogg.checkpoint.

GGSCI (ogg2 as ogg@ggtt) 4>exit

(c) 反向抽取程式:
[oracle@ogg2 goldengate]$ ./ggsci
GGSCI (ogg2) 1> add extract eddl2, tranlog, begin now;
EXTRACT added.

GGSCI (ogg2) 2> add exttrail ./dirdat/cc extract eddl2, megabytes 100
EXTTRAIL added.

GGSCI (ogg2) 3> edit params eddl2
GGSCI (ogg2) 4> view params eddl2

extract eddl2
userid ogg,password ogg
ddl include all
ddloptions report
ddloptions addtrandata
ddloptions getreplicates
exttrail ./dirdat/cc
TRANLOGOPTIONS EXCLUDEUSER ogg
table testogg.*;

(d) 反向投遞程式:
GGSCI (ogg2) 5> add extract pddl2, exttrailsource ./dirdat/cc
EXTRACT added.

GGSCI (ogg2) 6> add rmttrail ./dirdat/dd, extract pddl2, megabytes 100
RMTTRAIL added.

GGSCI (ogg2) 7> edit params pddl2
GGSCI (ogg2) 8> view params pddl2

extract pddl2
userid ogg, password ogg
rmthost 192.168.91.137, mgrport 7809
rmttrail ./dirdat/dd
table testogg.*;

(e) 正向複製程式:
GGSCI (ogg2) 9> add replicat rddl1 exttrail ./dirdat/bb,checkpointtable ogg.checkpoint
REPLICAT added.

GGSCI (ogg2) 10> edit params rddl1
GGSCI (ogg2) 11> view params rddl1

replicat rddl1
userid ogg, password ogg
ddl include all
ddloptions report
ddloptions updatemetadata
ddlerror default ignore retryop
discardfile ./dirrpt/rddl.dsc, purge
DBOPTIONS DEFERREFCONST
DBOPTIONS SUPPRESSTRIGGERS
map testogg.*, target testogg.*;


10、啟動順序
eddl1 --> pddl1 --> rddl1 --> eddl2 --> pddl2 --> rddl2

OGG1
start extract eddl1
start extract pddl1
OGG2
start replicat rddl1
OGG2
start extract eddl2
start extract pddl2
OGG1
start replicat rddl2


11、檢查程式狀態
OGG1:
GGSCI (ogg1 as ogg@ggss) 1> info all

Program     Status      Group       Lag at Chkpt  Time Since Chkpt
MANAGER     RUNNING                                          
EXTRACT     RUNNING     EDDL1       00:00:00      00:00:09   
EXTRACT     RUNNING     PDDL1       00:00:00      00:00:08   
REPLICAT    RUNNING     RDDL2       01:01:40      00:00:00  

OGG2:
GGSCI (ogg2 as ogg@ggtt) 1> info all

Program     Status      Group       Lag at Chkpt  Time Since Chkpt
MANAGER     RUNNING                                          
EXTRACT     RUNNING     EDDL2       00:00:00      00:00:02   
EXTRACT     RUNNING     PDDL2       00:00:00      00:00:07   
REPLICAT    RUNNING     RDDL1       00:00:00      00:00:01 


12、驗證資料
12.1 檢視初始化是否同步,檢視下ggtt端的T1
[oracle@ogg2 ~]$ sqlplus testogg/testogg
SQL> select count(*) from t1;
  COUNT(*)
----------
  0

12.2 正向
ggss端:

[oracle@ogg1 ~]$ sqlplus testogg/testogg
SQL> create table test1(id int primary key);
Table created.

SQL> insert into test1 values (1);
1 row created.

SQL> commit;
Commit complete.

SQL> select count(*) from test1;
  COUNT(*)
----------
  1


ggtt端:

[oracle@ogg2 ~]$ sqlplus testogg/testogg
SQL> desc test1
 Name        Null?    Type
 ----------------------------------------- -------- ----------------------------
 ID        NOT NULL NUMBER(38)

SQL> select * from test1;

 ID
----------
  1


12.3 反向
ggtt端:

[oracle@ogg2 ~]$ sqlplus testogg/test2017
SQL> create table test2(id int primary key);
Table created.

SQL> insert into test2 values (2);
1 row created.

SQL> commit;
Commit complete.

SQL> select * from test2;
 ID
----------
  2

ggss端:

[oracle@ogg1 ~]$ sqlplus testogg/testogg
SQL> desc test2
 Name        Null?    Type
 ----------------------------------------- -------- ----------------------------
 ID        NOT NULL NUMBER(38)

SQL> select * from test2;

 ID
----------
  2
 
搭建部分到此結束

補充:
1.確保配置過程中沒有DDL,應用僅連線至正向抽取端
2.配置抽取程式
3.配置投遞程式
4.啟動抽取投遞程式
5.exp imp expdp,impdp rman完成目標端初始化
6.啟動目標端複製程式
7.配置反向複製鏈路
8.配置兩端開啟DDL

停止OGG
OGG2
stop replicat rddl1
OGG1
stop extract pddl1
stop extract eddl1
OGG1
stop replicat rddl2
OGG2
stop extract pddl2
stop extract eddl2

來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/30590361/viewspace-2136786/,如需轉載,請註明出處,否則將追究法律責任。

相關文章