Golden Gate
Golden Gate
Golden Gate
------------------
The main components of the GoldenGate architecture are :
EXTRACT : Collects the changes vectors from the redo logs and archive logs file
from the source database, and send them to the manager process (like capture
process for streams). It regulary checkpoints its R/W position to
a file and Can have the following status :
- STOPPED
- RUNNING
- STARTING
- ABENED (abnormal end)
TRAIL FILES : GoldenGate converts data to replicate into a special format which is
written to trail files both on the source and target systems. They are called local
trail on the source system and remote trail on the target system.
DATA PUMP : On the local trail, GoldenGate requires an additional extract process
called data pump to send data in large block accross TCP/IP.
SERVER COLLECTOR : This process runs on the target system and accepts data from the
source and writes it to the remote trails (like propagation process for streams).
MANAGER : Runs on both source and target systems. Stores the change vectors in
TRAIL files. It controls the starting, monitoring and restarting processes, the
reporting errors and events. Can have the following status :
- STOPPED
- RUNNING
REPLICAT : Recovers the change vectors from trail files and apply them to the
target database (like apply process for streams). It regulary checkpoints its R/W
position to a file. Can have the following status :
- STOPPED
- RUNNING
- STARTING
- ABENED (abnormal end)
1. Prerequisite
PRIMARY HOST/INSTANCE : OGG1.FCICANADA.COM / OGG1
ORACLE_HOME=/u01/app/oracle/product/11.2.0.4/dbhome_1
2. Software Install
Install GG software on both source and target
SOFTWARE_LOCATION=/u01/app/oracle/product/11.2.0/oggcore_1
MANAGER_PORT=7808
3. Source environment
# Oracle Settings
export TMP=/tmp
export TMPDIR=$TMP
ORACLE_HOSTNAME=OGG1.FCICANADA.COM; export ORACLE_HOSTNAME
ORACLE_UNQNAME=OGG1; export ORACLE_UNQNAME
ORACLE_BASE=/u01/app/oracle; export ORACLE_BASE
ORACLE_HOME=$ORACLE_BASE/product/11.2.0.4/dbhome_1; export ORACLE_HOME
ORACLE_GG_HOME=/u01/app/oracle/product/11.2.0/oggcore_1; export ORACLE_GG_HOME
ORACLE_SID=OGG1; export ORACLE_SID
export PATH=/usr/sbin:$PATH
export PATH=$ORACLE_HOME/bin:$PATH
export LD_LIBRARY_PATH=$ORACLE_GG_HOME:$ORACLE_HOME/lib:/lib:/usr/lib
export CLASSPATH=$ORACLE_HOME/jlib:$ORACLE_HOME/rdbms/jlib
4. Prepare the SOURCE DATABASE (host db) for replication. Switch the database to
archivelog mode:
LOG_MODE
------------
ARCHIVELOG
Prepare the database for DDL replication. Turn off the recyclebin feature and be
sure that it is empty.
5. Create a schema that will contain the Oracle GoldenGate DDL objects.
SQL> create user ggate identified by oracle default tablespace gg_tbls quota
unlimited on gg_tbls;
User created.
OR
6. Make sure you can tnsping both databases from each host
listener.ora
------------
SID_LIST_LISTENER =
(SID_LIST =
(SID_DESC = (GLOBAL_DBNAME = OGG1)
(ORACLE_HOME = /u01/app/oracle/product/11.2.0.4/dbhome_1)
(SID_NAME = ogg1))
(SID_DESC = (GLOBAL_DBNAME = OGG2)
(ORACLE_HOME = /u01/app/oracle/product/11.2.0.4/dbhome_1)
(SID_NAME = OGG2)))
tnsnames.ora
------------
OGG1 =
(DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = OGG1.FCICANADA.COM)(PORT =
1523))
(CONNECT_DATA = (SERVER = DEDICATED) (SERVICE_NAME = OGG1)))
OGG2 =
(DESCRIPTION =(ADDRESS = (PROTOCOL = TCP)(HOST = OGG2.FCICANADA.COM)(PORT =
1523))
(CONNECT_DATA = (SERVER = DEDICATED) (SERVICE_NAME = OGG2)))
7. Change the directory on Golden Gate home directory and run scripts for creating
all necessary objects for support ddl replication.
[oracle@db ~]$ cd /u01/app/oracle/product/11.2.0/oggcore_1
[oracle@db gg]$ sqlplus / as sysdba
SQL> @marker_setup.sql
SQL> @ddl_setup.sql
SQL> @role_setup.sql
SQL> grant GGS_GGSUSER_ROLE to ggate;
SQL> @ddl_enable.sql
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> @marker_setup.sql
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.
MARKER TABLE
-------------------------------
OK
MARKER SEQUENCE
-------------------------------
OK
Script complete.
SQL> @ddl_setup.sql
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.
Checking for sessions that are holding locks on Oracle Golden Gate metadata
tables ...
Check complete.
CLEAR_TRACE STATUS:
Line/pos Error
----------------------------------------
-----------------------------------------------------------------
No errors No errors
.
.
.
.
.
Script complete.
SQL> @role_setup.sql
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.
Grant this role to each user assigned to the Extract, GGSCI, and Manager processes,
by using the following SQL command:
Grant succeeded.
SQL> @ddl_enable.sql
Trigger altered.
SQL>
System altered.
After that, add information about your Oracle GoldenGate DDL scheme into file
GLOBALS. You should input this row into the file "GGSCHEMA ggate".
[oracle@db gg]$ ./ggsci
Copyright (C) 1995, 2012, Oracle and/or its affiliates. All rights reserved.
Grant succeeded.
SQL>
Target database(OGG2):
SQL> create user target identified by oracle default tablespace users temporary
tablespace temp;
User created.
Grant succeeded.
Grant succeeded.
SQL>
Create the directory for trail files on ***BOTH HOSTS and create directory for
****discard file on OGG2 host only.
GGSCI (OGG1.FCICANADA.COM as ggate@OGG1) 3> add extract ext1, tranlog, begin now
EXTRACT added.
MANAGER RUNNING
EXTRACT STOPPED EXT1 00:00:00 00:02:33
EXTRACT STOPPED PUMP1 00:00:00 00:02:56
Copyright (C) 1995, 2015, Oracle and/or its affiliates. All rights reserved.
MANAGER RUNNING
MANAGER RUNNING
REPLICAT STOPPED REP1 00:00:00 00:01:52