Professional Documents
Culture Documents
PDF Oracle Goldengate Basic Architecture DL
PDF Oracle Goldengate Basic Architecture DL
Source Database - GoldenGate extracts the information from the source database.
The source database may be from any of the following vendors.
- Oracle Database
- TimesTen
- MySQL
- IBM DB2
- Microsoft SQL Server
- Teradata
- Sybase
- Enscribe
- SQL/MX
Capture(Local Extract) - Capture is the primary process in which all the commited DML
and
DDL changes are extracted from the source database.
Source Trail - The data extracted from the source database is written to the source trail,
which is basically a staging file and will be used by other processes (Ex: datapump).
Network - GoldenGate sends the data from the source trail via TCP/IP to the target host
and writes it in the remote trail.
Collector - The collector process is automatically started by the manager. This process
runs in the background, It captures and writes all the data received to the remote trail.
Remote Trail - Remote trail is similar to source trail. The only difference between the
two is that the remote trail is at the target host and the source trail is at the source
Database
host.
Delivery(Replicat) - The delivery process applies all the changes to the target database by
reading the remote trail. The changes are done to the target database in the same order as
they
were done in the source database.
Target Database - Target database is the database at which all the changes are applied.
It can be same or different from the source database.
GOLDEN GATE WORKFLOW:
1. Oracle 11g GoldenGate Installation.
$ mkdir -p /u01/app/gg
$ . ./.bash_profile
Copyright (C) 1995, 2011, Oracle and/or its affiliates. All rights reserved.
Code:
Creating subdirectories under current directory /u01/app/gg
SQL> alter database add supplemental log data (primary key) columns;
Database altered.
System altered.
Tablespace created.
User created.
Grant succeeded.
System altered.
--Set recyclebin to off, Necessary for DDL Replication from Oracle 10g onwards.
SOURCE DATABASE.
Hostname - canada
IP Address - 192.168.1.100
Code:
# Do not remove the following line, or various programs
# that require network functionality will fail.
TARGET DATABASE.
Hostname - london
IP Address - 192.168.1.200
SID - dup
Code:
# Do not remove the following line, or various programs
# that require network functionality will fail.
--make sure supplemental log data is enabled only for the source database.
# ping canada
# ping london
ON SOURCE
Copyright (C) 1995, 2011, Oracle and/or its affiliates. All rights reserved.
port 7980
Manager started.
extract ext1
userid ggs_admin, password ggs_admin
exttrail dirdat/t1
table SCOTT.*;
GGSCI (canada) 9> add exttrail dirdat/t1, extract ext1, megabytes 100
EXTTRAIL added.
Code:
EXTRACT EXT1 Last Started 2012-03-15 20:47 Status RUNNING
Checkpoint Lag 00:00:00 (updated 00:00:03 ago)
Log Read Checkpoint Oracle Redo Logs
2012-03-15 20:48:15 Seqno 5, RBA 6204416
extract dpump1
passthru
rmthost london, mgrport 7980
rmttrail dirdat/t2
table SCOTT.*;
--passthru parameter is used here because we are not using any data
--filteration or column mapping. The source and target data structures
--are identical.
GGSCI (canada) 16> add rmttrail dirdat/t2, extract dpump1, megabytes 100
RMTTRAIL added.
To stop datapump.
Code:
EXTRACT DPUMP1 Last Started 2012-03-15 20:58 Status RUNNING
Checkpoint Lag 00:00:00 (updated 00:00:04 ago)
Log Read Checkpoint File dirdat/t1000000
First Record RBA 943
Code:
Program Status Group Lag Time Since Chkpt
MANAGER RUNNING
EXTRACT RUNNING DPUMP1 00:00:00 00:00:00
EXTRACT RUNNING EXT1 00:00:00 00:00:02
Copyright (C) 1995, 2011, Oracle and/or its affiliates. All rights reserved.
-create checkpoint table
replicat repl1
userid ggs_admin, password ggs_admin
handlecollisions
assumetargetdefs
discardfile dirrpt/repl1.dsc, append
discardrollover at 5:00 on sunday
map SCOTT.*, target SCOTT.*;
GGSCI (london) 5> add replicat repl1, exttrail dirdat/t2, checkpointtable ggs_admin.chkpt
REPLICAT added.
Code:
Program Status Group Lag Time Since Chkpt
MANAGER RUNNING
REPLICAT RUNNING REPL1 00:00:00 00:00:03
Verify.
On Source
SQL> conn scott/tiger
SQL> update emp set sal=13000 where ename='MILLER';
1 row updated.
SQL> commit;
Commit complete.
On Target
SQL>conn scott/tiger
SAL
----------
13000
Also,
SQL> exit
Code:
Sending STATS request to REPLICAT REPL1 ...
End of Statistics.
4) DDl statements that are less than 2MB in length will be replicated automatically,
any statement longer than that will have to be manually processed by Golden Gate script.
5) Passthru paramater is to be configured while configuring datapump for tables that require
DDL replication.
On Source
Grant succeeded.
Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
SQL> @marker_setup.sql
Code:
Marker setup 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.
MARKER TABLE
-------------------------------
OK
MARKER SEQUENCE
-------------------------------
OK
Script complete.
SQL> @ddl_setup.sql
Code:
GoldenGate DDL Replication setup script
You will be prompted for the name of a schema for the 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.
DDLORA_GETTABLESPACESIZE STATUS:
Line/pos Error
---------- -----------------------------------------------------------------
No errors No errors
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
Line/pos Error
---------- -----------------------------------------------------------------
No errors No errors
Line/pos Error
---------- -----------------------------------------------------------------
No errors No errors
Line/pos Error
---------- -----------------------------------------------------------------
No errors No errors
DDL SEQUENCE
-----------------------------------
OK
GGS_TEMP_COLS
-----------------------------------
OK
GGS_TEMP_UK
-----------------------------------
OK
Line/pos Error
---------- -----------------------------------------------------------------
No errors No errors
STAYMETADATA IN TRIGGER
-----------------------------------
OFF
Script complete.
SQL> @role_setup.sql
Code:
GGS Role setup 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.
command:
GRANT GGS_GGSUSER_ROLE TO
Grant succeeded.
SQL> @ddl_enable.sql
Trigger altered.
GGSCHEMA GGS_ADMIN
On Source
exttrail dirdat/t1
ddl include mapped objname "SCOTT.*"
table SCOTT.*;
Lets check
On Source
Table altered.
Code:
Name Null? Type
----------------------------------------- -------- ----------------------------
EMPNO NOT NULL NUMBER(4)
ENAME VARCHAR2(10)
JOB VARCHAR2(9)
MGR NUMBER(4)
HIREDATE DATE
SAL NUMBER(7,2)
COMM NUMBER(7,2)
DEPTNO NUMBER(2)
NCOL VARCHAR2(10)
On Target.
Code:
Name Null? Type
----------------------------------------- -------- ----------------------------
EMPNO NOT NULL NUMBER(4)
ENAME VARCHAR2(10)
JOB VARCHAR2(9)
MGR NUMBER(4)
HIREDATE DATE
SAL NUMBER(7,2)
COMM NUMBER(7,2)
DEPTNO NUMBER(2)
NCOL VARCHAR2(10)
Also
On Source
Table created.
On Target
Code:
TNAME TABTYPE CLUSTERID
------------------------------ ------- ----------
BONUS TABLE
DEPT TABLE
EMP TABLE
SALGRADE TABLE
TEST TABLE
Prerequisites:
1) Target Tables should be empty. Otherwise you can get duplicate row errors.
2) Disable Foreign Key and Check Constraints. They can be enabled later on
when the initial load is complete.
3) (Optional) Remove indexes from target tables as they may slow down the
initial loading process.
4) To use handlecollisions function, each target table must have a
primary or unique key. If that's not possible use the KEYCOLS
option of the TABLE and MAP parameters. Even if that is not possible
then quiesce your database for the duration of intial load.
2) Disable Foreign key and check constraints and triggers on target tables.
Table altered.
On Source
extract iniload1
userid ggs_admin, password ggs_admin
rmthost newyork, mgrport 7980
rmttask replicat, group iniload2
table SCOTT.*;
On Target
replicat iniload2
userid ggs_admin, password ggs_admin
assumetargetdefs
map SCOTT.*, target SCOTT.*;
On Source
Code:
Sending START request to MANAGER ...
EXTRACT INILOAD1 starting
Code:
EXTRACT INILOAD1 Last Started 2012-11-13 21:48 Status RUNNING
Checkpoint Lag Not Available
Log Read Checkpoint Table SCOTT.DEPT
2012-11-13 21:48:32 Record 1
Task SOURCEISTABLE
Code:
2012-11-13 21:48:27 INFO OGG-01017 Wildcard resolution set to IMMEDIATE because
SOURCEISTABLE is used.
***********************************************************************
Oracle GoldenGate Capture for Oracle
Version 11.1.1.1.2 OGGCORE_11.1.1.1.2_PLATFORMS_111004.2100
Linux, x86, 32bit (optimized), Oracle 11g on Oct 7 2011 15:32:42
Copyright (C) 1995, 2011, Oracle and/or its affiliates. All rights reserved.
Description:
***********************************************************************
** Running with the following parameters **
***********************************************************************
extract iniload1
userid ggs_admin, password *********
rmthost newyork, mgrport 7980
rmttask replicat, group iniload2
table SCOTT.*;
TABLEWildcard resolved (entry SCOTT.*):
table SCOTT.BONUS;
2012-11-13 21:48:27 WARNING OGG-00869 No unique key is defined for table BONUS. All
viable columns will b
e used to represent the key, but may not guarantee uniqueness. KEYCOLS may be used to
define the key.
Using the following key columns for source table SCOTT.BONUS: ENAME, JOB, SAL, COMM.
TABLEWildcard resolved (entry SCOTT.*):
table SCOTT.DEPT;
Using the following key columns for source table SCOTT.DEPT: DEPTNO.
TABLEWildcard resolved (entry SCOTT.*):
table SCOTT.EMP;
Using the following key columns for source table SCOTT.EMP: EMPNO.
TABLEWildcard resolved (entry SCOTT.*):
table SCOTT.SALGRADE;
2012-11-13 21:48:27 WARNING OGG-00869 No unique key is defined for table SALGRADE.
All viable columns wil
l be used to represent the key, but may not guarantee uniqueness. KEYCOLS may be used
to define the key.
Using the following key columns for source table SCOTT.SALGRADE: GRADE, LOSAL, HISAL.
Database Version:
Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - Production
PL/SQL Release 11.2.0.1.0 - Production
CORE 11.2.0.1.0 Production
TNS for Linux: Version 11.2.0.1.0 - Production
NLSRTL Version 11.2.0.1.0 - Production
Warning: your NLS_LANG setting does not match database server language setting.
Please refer to user manual for more information.
***********************************************************************
* ** Run Time Statistics ** *
***********************************************************************
Output to iniload2:
Table altered.
1) Stop extract/replicat.
3) Cleanup.