Beruflich Dokumente
Kultur Dokumente
Oracle GoldenGate enables the exchange and manipulation of data at the transaction
level among multiple, heterogeneous platforms across the enterprise. It moves
committed transactions with transaction integrity and minimal overhead on your
existing infrastructure. Its modular architecture gives you the flexibility to extract and
replicate selected data records, transactional changes, and changes to DDL (data
definition language) across a variety of topologies.
In this blog I am writing about oracle to oracle DB replication by using GoldenGate. Aim
of this demonstration if replicate all changes in one particular schema (include DDL)
from one oracle DB to another Oracle DB. For this purpose I have created two oracle DB
on same host from different users.
1. First of all, install Golden Gate software on each Oracle DB. Step1
process is same for both the database.
[oratest@localhost
[oratest@localhost
[oratest@localhost
[oratest@localhost
export PATH=$PATH:/u01/app/oratest/ggate
export
LD_LIBRARY_PATH=/u01/app/oratest/product/11.2.0/dbhome_1/lib:/u01/app/orate
st/ggate
[oratest@localhost ggate]$ ggsci
Oracle GoldenGate Command Interpreter for Oracle
Version 11.2.1.0.3 14400833
OGGCORE_11.2.1.0.3_PLATFORMS_120823.1258_FBO
Linux, x64, 64bit (optimized), Oracle 11g on Aug 23 2012 20:20:21
Copyright (C) 1995, 2012, Oracle and/or its affiliates. All rights reserved.
GGSCI (localhost.localdomain) 1> CREATE SUBDIRS
Creating subdirectories under current directory /u01/app/oratest/ggate
Parameter files
Report files
Checkpoint files
Process status files
SQL script files
2.4) Change the directory on Golden Gate home directory and run scripts
for creating all necessary objects for support ddl replication.
[ora1103@localhost ggate]$ cd /u01/app/ora1103/ggate
[ora1103@localhost ggate]$ sqlplus "/as sysdba"
SQL>
SQL>
SQL>
SQL>
SQL>
@marker_setup.sql
@ddl_setup.sql
@role_setup.sql
grant GGS_GGSUSER_ROLE to ggate;
@ddl_enable.sql
2.5) after that, add information about your Oracle GoldenGate DDL scheme
into file GLOBALS. You should input this row into the file "GGSCHEMA
ggate".
[ora1103@localhost ggate]$ ggsci
Oracle GoldenGate Command Interpreter for Oracle
Version 11.2.1.0.3 14400833
OGGCORE_11.2.1.0.3_PLATFORMS_120823.1258_FBO
Linux, x64, 64bit (optimized), Oracle 11g on Aug 23 2012 20:20:21
Copyright (C) 1995, 2012, Oracle and/or its affiliates. All rights reserved.
GGSCI (localhost.localdomain) 1> EDIT PARAMS ./GLOBALS
GGSCHEMA ggate
GGSCI (localhost.localdomain) 2>
3. Create the schemes for replication on both hosts (ora1103 (db1), dup
(db2)).
4. Create the directory for trail files on both hosts and create directory for
discard file on db2 host only.
[oracle@db ~] mkdir /u01/app/oracle/product/gg/dirdat/tr
EXTRACT
STOPPED
PUMP1
GGSCI (localhost.localdomain) 9>
00:00:00
00:00:38
5.3b)
[oratest@localhost ggate]$ ggsci
Oracle GoldenGate Command Interpreter for Oracle
Version 11.2.1.0.3 14400833
OGGCORE_11.2.1.0.3_PLATFORMS_120823.1258_FBO
Linux, x64, 64bit (optimized), Oracle 11g on Aug 23 2012 20:20:21
Copyright (C) 1995, 2012, Oracle and/or its affiliates. All rights reserved.
GGSCI (localhost.localdomain) 5> start replicat rep1
Sending START request to MANAGER ...
REPLICAT REP1 starting
GGSCI (localhost.localdomain) 6> info all
Program
Status
Group
Lag at Chkpt Time Since Chkpt
MANAGER
RUNNING
REPLICAT RUNNING
REP1
00:00:00
00:00:00
GGSCI (localhost.localdomain) 7>
6.1 at Target:
[oratest@localhost ggate]$ sqlplus target/oracle
SQL*Plus: Release 11.2.0.3.0 Production on Mon Nov 14 14:58:16 2016
Copyright (c) 1982, 2011, Oracle. All rights reserved.
Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
SQL> select * from test;
ID NAME
---------- -------------------------------------------------1 test
2 test
As you can see, all works. Lets execute some more SQLs and Update statements.
Source db:
SQL> delete test where id =2;
1 row deleted.
SQL> insert into test values (3,'test');
1 row created.
SQL> update test set name='test3' where id = 3;
1 row updated.
SQL> commit;
Commit complete.
SQL> select * from test;
ID NAME
---------- -------------------------------------------------1 test
3 test3
1 test
3 test3
ID NAME
---------- -------------------------------------------------1 test
3 test3
4 test
Conclusion:
--------------Oracle GoldenGate is a software package for enabling the replication of data in
heterogeneous data environments. It is easy to use. It provide other great feature
such as zero downtime upgrade of database, replication between different kind of
databases and data transformation from source to targets and many others. It has
a rich topology to deploy as per the requirements.