Oracle GoldenGate installation Configuration
Oracle GoldenGate can be used to migrate and synchronize data on heterogeneous platforms. It is based on database log structure changes and obtains data increments by parsing source-end online logs or archiving logs, then, these changes are applied to the target database to synchronize data between the source database and the target database. The following is a simple example to describe how to use GoldenGate to synchronize Oracle databases.
1. Install
1.1 download media
The installation media of GoldenGate can be downloaded from the official Oracle website.
Http://www.oracle.com/technetwork/middleware/goldengate/overview/index.html
1.2 configure GoldenGate users
After the download is complete, copy it to the corresponding location of the source and target databases and decompress it. Then, you can start the configuration.
# Su-oracle
$ Mkdir/u01/ogg
$ Cd/u01/ogg
$ Tar xvf ogg_for_oracle_linux_86.tar
Note: If you are using an Oracle 11g Database, you need to create a link file.
$ Ln-s/u01/app/oracle/product/11.2.0/db_1/lib/libnnz11.so-
/U01/app/oracle/product/11.2.0/db_1/lib/libnnz10.so
Configure Environment Variables
$ Vi ~ /. Bash_profile
Add the following content:
Export ORACLE_BASE =/u01/app/oracle
Export ORACLE_HOME = $ ORACLE_BASE/product/10.2.0/db_1
Export LD_LIBRARY_PATH = $ ORACLE_HOME/lib:/u01/ogg
Export GGATE =/u01/app/oracle/ogg
1.3 configure the ogg application directory
Use the ggsci tool to create necessary directories.
$ Cd/u01/app/oracle/ogg
$./Ggsci
Oracle GoldenGate Command Interpreter for Oracle
Version 11.1.1.0.0 Build 078
Linux, x86, 32bit (optimized), Oracle 10 on Jul 28 2015 10:20:18
Copyright (C) 1995,201 0, Oracle and/or its affiliates. All rights reserved.
GGSCI (gridcontrol) 1> create subdirs
So far, the basic installation of GoldenGate is complete.
Note: This part must be completed at the source and target ends.
2. source Database Configuration
GoldenGate mainly captures the source database redo logs for analysis, and applies the obtained data to the target end for data synchronization. Therefore, in order for GoldenGate to work properly, the source database must be configured.
2.1 configure the source database to be in the archive mode, with additional logs and forced logs
-- View
SQL> CONN/AS SYSDBA
SQL> select db. LOG_MODE, db. SUPPLEMENTAL_LOG_DATA_MIN, db. FORCE_LOGGING
From v $ database db
SQL> -- modify
SQL> -- 1) archivelog
SQL> shutdown immediate
SQL> startup mount
SQL> alter database archivelog;
SQL> alter database open;
SQL> -- 2) force logging
SQL> alter database force logging;
SQL> -- 3) supplemental log data
SQL> alter database add supplemental log data;
2.2 shut down the recyblebin of the database
SQL> alter system set recyclebin = off scope = spfile;
If the database is 10 Gb, You need to disable recyclebin and restart it; or manually purge recyclebin.
2.3 configure replication DDL support
SQL> create user ogg identified by ogg default tablespace users temporary tablespace temp;
SQL> grant connect, resource, unlimited tablespace to ogg;
SQL> grant execute on utl_file to ogg;
SQL> @ $ GGATE/marker_setup. SQL;
SQL> @ $ GGATE/ddl_setup. SQL;
SQL> @ $ GGATE/role_setup. SQL;
SQL> grant GGS_GGSUSER_ROLE to ogg;
SQL> @ $ GGATE/ddl_enable. SQL;
2.4 create source and target test users
-- Execute at the source end
SQL> create user ss identified by oracle default tablespace users temporary tablespace temp;
SQL> grant connect, resource, unlimited tablespace to ss;
-- Execute on the target
SQL> create user rr identified by oracle default tablespace users temporary tablespace temp;
SQL> grant connect, resource, unlimited tablespace to rr;
3. Configure manager
Perform the following steps on the source and target respectively.
3.1 create a manager at the source end
[Ogg @ node1 gg] $./ggsci
GGSCI (node1) 1> info all
Program Status Group Lag Time Since Chkpt
MANAGER STOPPED
GGSCI (node1) 2> edit params mgr
PORT 7809
GGSCI (node1) 3> start manager
Manager started.
On the target end
[Ogg @ node2 gg] $./ggsci
GGSCI (node2) 1> info all
Program Status Group Lag Time Since Chkpt
MANAGER STOPPED
GGSCI (node2) 2> edit params mgr
PORT 7809
GGSCI (node2) 3> start manager
Manager started.
4. Configure the source replication queue
GGSCI (node1) 1> add extract ext1, tranlog, begin now
EXTRACT added.
GGSCI (node1) 2> add exttrail/u01/ogg/dirdat/lt, extract ext1
EXTTRAIL added.
GGSCI (node1) 3> edit params ext1
Extract ext1
Userid ogg @ source, password ogg
Rmthost node1 and mgrport 7809
Rmttrail/u01/ogg/dirdat/lt
Ddl include mapped objname sender .*;
Table sender .*;
GGSCI (node1) 6> info all
Program Status Group Lag Time Since Chkpt
MANAGER STOPPED
Extract stopped EXT1 00:00:00 00:10:55
5. Configure the target synchronization queue
5.1 Add a checkpoint table to the target
[Oracle @ node2 ogg] $./ggsci
GGSCI (node2) 1> edit params./GLOBAL-Add the following content
GGSCHEMA ggate
CHECKPOINTTABLE ggate. checkpoint
GGSCI (node2) 2> dblogin userid ogg password ogg
Successfully logged into database.
GGSCI (node2) 3> add checkpointtable ogg. checkpoint
Successfully created checkpoint table GGATE. CHECKPOINT.
5.2 create a synchronization queue
GGSCI (node2) 4> add replicat rep1, exttrail/u01/ogg/dirdat/lt, checkpointtable ogg. checkpoint
REPLICAT added.
GGSCI (node2) 5> edit params rep1
Replicat rep1
ASSUMETARGETDEFS
Userid ogg, password ogg
Discardfile/u01/ogg/dirdat/rep1_discard.txt, append, megabytes 10
DDL
Map ss. *, target rr .*;
6. enable synchronization
-- Source end
GGSCI (node1) 14> start extract ext1
GGSCI (nod1) 15> info all
Program Status Group Lag Time Since Chkpt
MANAGER RUNNING
Extract running EXT1 00:00:00 00:00:05
-- Target end
GGSCI (node2) 7> start replicat rep1
GGSCI (node2) 8> info all
Program Status Group Lag Time Since Chkpt
MANAGER RUNNING
Replicat running REP1 00:00:00
GoldenGate unidirectional table DML Synchronization
Oracle GoldenGate series: restoration principles of Extract processes
Oracle GoldenGate installation Configuration
OGG-01004 OGG-1296 error for Oracle goldengate
Oracle GoldenGate Quick Start Tutorial: Basic Concepts and configurations
Build a GoldenGate bidirectional replication environment from Oracle to Oracle