Professional Documents
Culture Documents
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).
Datapump - The datapump which is a goldengate process(not to be confused with oracle
datapump), reads the information from the source trail, transfers it to the target host via
TCP/IP and writes it down to the remote trail.
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.
1.
/u01/app/gg/dirprm: created
/u01/app/gg/dirrpt: created
/u01/app/gg/dirchk: created
/u01/app/gg/dirpcs: created
/u01/app/gg/dirsql: created
/u01/app/gg/dirdef: created
/u01/app/gg/dirdat: created
/u01/app/gg/dirtmp: created
/u01/app/gg/dirver: created
/u01/app/gg/dirver/lock: created
/u01/app/gg/dirver/oos: created
/u01/app/gg/dirver/oosxml: created
/u01/app/gg/dirver/params: created
/u01/app/gg/dirver/report: created
/u01/app/gg/dirver/status: created
/u01/app/gg/dirver/trace: created
/u01/app/gg/dirout: created
into the redo log if any of the unique columns are modified.
Create a Tablespace and user for GoldenGate.
SQL> create tablespace golden datafile'/u01/app/oracle/oradata/orcl/golden01.dbf' size
100m
2 autoextend on
3 extent management local
4 segment space management auto;
Tablespace created.
SQL> create user ggs_admin identified by ggs_admin
2 temporary tablespace temp
3 default tablespace golden
4 quota unlimited on golden;
User created.
SQL> grant dba to ggs_admin;
Grant succeeded.
SQL> alter system set recyclebin=off scope=spfile;
System altered.
--Set recyclebin to off, Necessary for DDL Replication from Oracle 10g onwards.
SQL> shutdown immediate
SQL> startup
1.
SID - orcl
GoldenGate Version - 11.1.1.1.2
Sample "/etc/hosts" file.
Code:
# Do not remove the following line, or various programs
# that require network functionality will fail.
127.0.0.1
192.168.1.100
192.168.1.200
localhost.localdomain localhost
canada
london
canada
london
TARGET DATABASE.
OS - Red Hat Enterprise Linux Server release 5.4
Hostname - london
IP Address - 192.168.1.200
Database - Oracle 11g Release 2
SID - dup
GoldenGate Version - 11.1.1.1.2
Sample "/etc/hosts" file.
Code:
# Do not remove the following line, or various programs
# that require network functionality will fail.
127.0.0.1
192.168.1.100
192.168.1.200
localhost.localdomain localhost
canada
london
canada
london
# ping london
Both the databases should be in archivelog mode.
ON SOURCE
[oracle@canada gg]$ export ORACLE_SID=orcl
[oracle@canada gg]$ ggsci
Oracle GoldenGate Command Interpreter 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 4 2011 23:53:33
Copyright (C) 1995, 2011, Oracle and/or its affiliates. All rights reserved.
port 7980
purgeoldextracts dirdat/*, usecheckpoints, minkeepdays 2
-The above parameter instructs the GoldenGate software to
-delete all the trails which have been used by the Extract
-and Replicat process after 2 days.
ggsci > start manager
Manager started.
ggsci > info manager
Manager is running (IP port canada.7980).
Configure local extract on source.
Status
Group
Lag
MANAGER
EXTRACT
EXTRACT
RUNNING
RUNNING
RUNNING
DPUMP1
EXT1
00:00:00
00:00:00
00:00:00
00:00:02
Code:
REPLICAT
REPL1
Checkpoint Lag
Log Read Checkpoint
Status
Group
Lag
MANAGER
REPLICAT
RUNNING
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
SQL> select sal from emp where ename='MILLER';
SAL
---------13000
Also,
SQL> exit
[oracle@london gg]$ export ORACLE_SID=dup
[oracle@london gg]$ ggsci
Oracle GoldenGate Command Interpreter 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 4 2011 23:53:33
Copyright (C) 1995, 2011, Oracle and/or its affiliates. All rights reserved.
GGSCI (london) 1> stats replicat repl1
Code:
Sending STATS request to REPLICAT REPL1 ...
Start of Statistics at 2012-03-15 21:35:11.
Replicating from SCOTT.EMP to SCOTT.EMP:
*** Total statistics since 2012-03-15 21:31:54 ***
Total inserts
Total updates
Total deletes
Total discards
Total operations
0.00
1.00
0.00
0.00
1.00
0.00
1.00
0.00
0.00
1.00
0.00
1.00
0.00
0.00
1.00
0.00
1.00
0.00
0.00
1.00
End of Statistics.
1.
3) DDL replication is supported only between two systems. Bi-directional DDL replication
is also supported. DDL replication between one to many systems is not supported.
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.
Main differences when implementing DDL replication as compared to DML replication is
that you have to create GLOBALS file in both source and target schema.
Run certain scripts on source to facilitate DDL replication.
Add one additional parameter to the local extract
file (i.e ddl include mapped objname "SCOTT.*).
On Source
SQL> grant execute on utl_file to ggs_admin;
Grant succeeded.
[oracle@canada gg]$ export ORACLE_SID=orcl
[oracle@canada gg]$ sqlplus
SQL*Plus: Release 11.2.0.1.0 Production on Tue Mar 27 21:50:27 2012
Copyright (c) 1982, 2009, Oracle. All rights reserved.
Enter user-name: / as sysdba
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.
Enter GoldenGate schema name:ggs_admin
Marker setup table script complete, running verification script...
Please enter the name of a schema for the GoldenGate database objects:
Setting schema name to GGS_ADMIN
MARKER TABLE
------------------------------OK
MARKER SEQUENCE
------------------------------OK
Script complete.
SQL> @ddl_setup.sql
Code:
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 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 GoldenGate schema name:ggs_admin
You will be prompted for the mode of installation.
To install or reinstall DDL replication, enter INITIALSETUP
To upgrade DDL replication, enter NORMAL
Enter mode of installation:INITIALSETUP
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 GGS_ADMIN as a GoldenGate schema name, INITIALSETUP as a mode of installation.
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 GGS_ADMIN
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
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 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
----------------------------------0
LOCATION OF DDL TRACE FILE
----------------------------------------------------------------/u01/app/oracle/diag/rdbms/orcl/orcl/trace/ggs_ddl_trace.log
Analyzing installation status...
STATUS OF DDL REPLICATION
-----------------------------------------------------------------SUCCESSFUL installation of DDL Replication software components
Script complete.
SQL> @role_setup.sql
Code:
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:ggs_admin
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
where
Lets check
On Source
SQL> alter table emp add ncol varchar2(10);
Table altered.
SQL> desc emp;
Code:
Name
Null?
----------------------------------------- -------EMPNO
NOT NULL
ENAME
JOB
MGR
HIREDATE
SAL
COMM
DEPTNO
NCOL
Type
---------------------------NUMBER(4)
VARCHAR2(10)
VARCHAR2(9)
NUMBER(4)
DATE
NUMBER(7,2)
NUMBER(7,2)
NUMBER(2)
VARCHAR2(10)
On Target.
Also
On Source
SQL> create table test as select * from emp;
Table created.
SQL> select * from tab;
Code:
TNAME
-----------------------------BONUS
DEPT
EMP
SALGRADE
TEST
TABTYPE CLUSTERID
------- ---------TABLE
TABLE
TABLE
TABLE
TABLE
On Target
SQL> select * from tab;
Code:
TNAME
-----------------------------BONUS
DEPT
EMP
SALGRADE
TEST
1.
TABTYPE CLUSTERID
------- ---------TABLE
TABLE
TABLE
TABLE
TABLE
Code:
CONSTRAINT_NAME
-----------------------------FK_DEPTNO
PK_DEPT
PK_EMP
C
R
P
P
TABLE_NAME
-----------------------------EMP
DEPT
EMP
STATUS
-------ENABLED
ENABLED
ENABLED
Status RUNNING
Code:
2012-11-13 21:48:27 INFO
SOURCEISTABLE is used.
OGG-01017
***********************************************************************
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.
Starting at 2012-11-13 21:48:27
***********************************************************************
Operating System Version:
Linux
Version #1 SMP Tue Aug 18 15:51:54 EDT 2009, Release 2.6.18-164.el5
Node: canada.example.com
Machine: i686
soft limit
hard limit
Address Space Size
:
unlimited
unlimited
Heap Size
:
unlimited
unlimited
File Size
:
unlimited
unlimited
CPU Time
unlimited
unlimited
NLS_TERRITORY
= "AMERICA"
NLS_CHARACTERSET = "WE8MSWIN1252"
Warning: your NLS_LANG setting does not match database server language setting.
Please refer to user manual for more information.
Processing table SCOTT.BONUS
Processing table SCOTT.DEPT
Processing table SCOTT.EMP
Processing table SCOTT.SALGRADE
***********************************************************************
*
** Run Time Statistics **
*
***********************************************************************
Report at 2012-11-13 21:48:50 (activity since 2012-11-13 21:48:27)
Output to iniload2:
From Table SCOTT.DEPT:
#
inserts:
#
updates:
#
deletes:
#
discards:
From Table SCOTT.EMP:
#
inserts:
#
updates:
#
deletes:
#
discards:
From Table SCOTT.SALGRADE:
#
inserts:
#
updates:
#
deletes:
#
discards:
REDO Log Statistics
Bytes parsed
Bytes output
4
0
0
0
14
0
0
0
5
0
0
0
0
3473
1.
1) Stop extract/replicat.
kill extract group_name
kill replicat group_name
2) Delete extracat / replicat.
delete extract group_name
delete replicat group_name
3) Cleanup.
cleanup extract group_name
cleanup replicat group_name