You are on page 1of 22

Oracle GoldenGate

1Oracle GoldenGate

GoldenGate TDM

GoldenGate TDM IT

GoldenGate TDM

(Capture Process)Online Redo LogArchive Log


GoldenGate TDM
TCP/IP
log
log

GoldenGate TDM

GoldenGate TDMSQL

GoldenGate TDM
GoldenGate TDM

TCP/IP
9:1GoldenGate TDM

GoldenGate TDM

GoldenGate TDM

GoldenGate TDM

GoldenGate TDM

GoldenGate TDM
2

GoldenGate TDM

128
Oracle GoldenGateIT
GoldenGate

MS NT, 2000, XP, Linux, Sun Solaris,


HP-UX, IBM AIX, HP NonStop,
TRU64, IBM z/OSOS/390

Oracle, DB2, MS SQL Server, MySQL,


Enscribe, SQL/MP, SQL/MX, Sybase,
Teradata, ODBC

2Oracle GoldenGate For Oracle(windows )

GoldenGate
d:\ggs
:
1.
2. ggs
3. install addservice addevents
4. ggsci GoldenGate
5. create subdirs
OKGoldenGate

C:\Documents and Settings\PONY>d:


D:\>cd ggs
D:\ggs>install addservice addevents
Oracle GoldenGate messages installed successfully.
Service 'GGSMGR' created.

Install program terminated normally.

D:\ggs>ggsci
Oracle GoldenGate Command Interpreter for Oracle
Version 10.4.0.19 Build 002
Windows (optimized), Oracle 10 on Sep 18 2009 15:54:55
Copyright (C) 1995, 2009, Oracle and/or its affiliates. All rights reserved.

GGSCI (PONY) 1> create subdirs


Creating subdirectories under current directory D:\ggs
Parameter files
D:\ggs\dirprm: created
Report files
D:\ggs\dirrpt: created
Checkpoint files
D:\ggs\dirchk: created
Process status files
D:\ggs\dirpcs: created
SQL script files
D:\ggs\dirsql: created
Database definitions files D:\ggs\dirdef: created
Extract data files
D:\ggs\dirdat: created
Temporary files
D:\ggs\dirtmp: created
Veridata files
D:\ggs\dirver: created
Veridata Lock files
D:\ggs\dirver\lock: created
Veridata Out-Of-Sync files D:\ggs\dirver\oos: created
Veridata Out-Of-Sync XML files D:\ggs\dirver\oosxml: created
Veridata Parameter files
D:\ggs\dirver\params: created
Veridata Report files
D:\ggs\dirver\report: created
Veridata Status files
D:\ggs\dirver\status: created
Veridata Trace files
D:\ggs\dirver\trace: created
Stdout files
D:\ggs\dirout: created

3DML

3.1
SourceDB, TargetDB TCP/IP
SourceDB WIN XP Oracle 10g 10.2.0.1.0
TargetDB WIN 2003 Oracle 10g 10.2.0.1.0
SourceDB
SourceDB Schema TargetDB
Sechema
SouceDB SAJET,SJ,SMT,LANG Target
SAJET,SJ,SMT,LANG
SourceD, TargetDB Schema
Exp/Imp,Rman,.
DB GoldenGate DBA GoldenGate DB.
DB GoldenGate
SourceDB
DB
SQL> select SUPPLEMENTAL_LOG_DATA_MIN from v$database;
SUPPLEME
-------YES

SQL>alter database add supplemental log data;


GoldenGate
GGSCI (PONY) 1> dblogin userid sajet password tech
Successfully logged into database.

GGSCI (PONY) 2> add trandata sajet.*


Database
Sajet
SJ,LANG,SMT

3.2 GoldenGate
3.2.1 SourceDB GoldenGate
SourceDB mgr extract
1. mgr
GGSCI (PONY) 2> edit param mgr
mgr
PORT 7809
--mgr TCP/IP
2. GGSCI
GGSCI (PONY) 1> add extract ext1,tranlog,begin now
EXTRACT added.
--- SourceDB
3.
GGSCI (PONY) 2> edit param ext1
ext1
extract ext1
userid goldengate,password goldengate
rmthost 172.17.17.61, mgrport 7809
rmttrail d:\ggs\dirdat\r1
dynamicresolution
gettruncates
table sajet.*;
table sj.*;
table smt.*;
table lang.*;

- ext2
DB

TargetDB
(TargetDB)

Truncate
table
4.
GGSCI (PONY) 3> add rmttrail d:\ggs\dirdat\r1 extract ext2
RMTTRAIL added.
- TargetDB d:\ggs\dirdat\r1 ext1
rmttrail d:\ggs\dirdat\r1

GGSCI (PONY) 11> start mgr


Starting Manager as service ('GGSMGR')...
Service started.
GGSCI (PONY) 14> start ext1
Sending START request to MANAGER ('GGSMGR') ...
EXTRACT EXT1 starting

GGSCI (PONY) 185> info all


Program

Status

Group

Lag

MANAGER RUNNING
EXTRACT RUNNING EXT1

Time Since Chkpt

00:00:00

00:00:06

OKMgr EXT
SouceDB

3.2.2 TargetDB GoldenGate


1. mgr
GGSCI (PONY) 2> edit param mgr

mgr
PORT 7809
DYNAMICPORTLIST 7840-7850
--mgr TCP/IP

2.
GGSCI (PONY) 2>ADD replicat rep1 EXTTRAIL d:\ggs\dirdat\r1, nodbcheckpoint
-- TargetDB
3.
GGSCI (PONY) 2> edit param rep1

replicat rep1
userid goldengate,password goldengate
assumetargetdefs
reperror default,discard
discardfile D:\oradata\discard\repsz.dsc,append,megabytes 100
gettruncate
map sajet.*, target sajet.*;
map sj.*, target sj.*;
map lang.*, target lang.*;
map smt.*, target smt.*;

--
TargetDB
DB
discardfile
truncate
sajetsjlangsmt TargetDB

mgr rep
GGSCI (PONY) 20> start mgr
Starting Manager as service ('GGSMGR')...
Service started.

GGSCI (PONY) 21> start rep1

Sending START request to MANAGER ('GGSMGR') ...


REPLICAT REP1 starting

GGSCI (PONY) 22> info all


Program

Status

Group

Lag

MANAGER RUNNING
REPLICAT RUNNING REP1

Time Since Chkpt

00:00:00

00:00:07

OK,MGR REP
DB GoldenGate

3.3 DML
SourceDB
C:\Documents and Settings\Administrator>sqlplus
SQL*Plus: Release 10.2.0.1.0 - Production on Mon Mar 8 15:33:47 2010
Copyright (c) 1982, 2005, Oracle. All rights reserved.
Enter user-name: sajet/tech@hitron
Connected to:
Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - 64bit Production
With the Partitioning, OLAP and Data Mining options
SQL> insert into sajet.sys_emp values (10000786,'TEST1','TEST1','','TEST','10000
27','','Y','',0,'',0,'','')
2 ;
1 row created.
SQL> commit
2 ;
Commit complete.

10

TargetDB
SQL> connect sajet/tech@goldenga
Connected.
SQL> select count (*) from sajet.sys_emp
2 where emp_id=10000786;
COUNT(*)
---------1

EXT1

GGSCI (sajet-project) 189> stats ext1


Sending STATS request to EXTRACT EXT1 ...
Start of Statistics at 2010-03-08 15:47:51.
DDL replication statistics (for all trails):
*** Total statistics since extract started ***
Operations
40.00
Mapped operations
28.00
Unmapped operations
0.00
Other operations
12.00
Excluded operations
0.00
Output to d:\ggs\dirdat\r1:
Extracting from GOLDENGATE.GGS_MARKER to GOLDENGATE.GGS_MARKER:
*** Total statistics since 2010-03-05 09:51:51 ***
No database operations have been performed.
*** Daily statistics since 2010-03-08 00:00:00 ***
No database operations have been performed.
*** Hourly statistics since 2010-03-08 15:00:00 ***

11

No database operations have been performed.


*** Latest statistics since 2010-03-05 09:51:51 ***
No database operations have been performed.
Extracting from SAJET.GOLDEGATETEST to SAJET.GOLDEGATETEST:
*** Total statistics since 2010-03-05 09:51:51 ***
Total inserts
3.00
Total updates
0.00
Total deletes
0.00
Total truncates
2.00
Total discards
0.00
Total operations
5.00
*** Daily statistics since 2010-03-08 00:00:00 ***
No database operations have been performed.
*** Hourly statistics since 2010-03-08 15:00:00 ***
No database operations have been performed.
*** Latest statistics since 2010-03-05 09:51:51 ***
Total inserts
3.00
Total updates
0.00
Total deletes
0.00
Total truncates
2.00
Total discards
0.00
Total operations
5.00
Extracting from SAJET.SYS_EMP to SAJET.SYS_EMP:
*** Total statistics since 2010-03-05 09:51:51 ***
Total inserts
2.00
Total updates
0.00
Total deletes
0.00
Total discards
0.00
Total operations
2.00
*** Daily statistics since 2010-03-08 00:00:00 ***
Total inserts
2.00
Total updates
0.00
12

Total deletes
Total discards
Total operations

0.00
0.00
2.00

*** Hourly statistics since 2010-03-08 15:00:00 ***


Total inserts
2.00
Total updates
0.00
Total deletes
0.00
Total discards
0.00
Total operations
2.00
*** Latest statistics since 2010-03-05 09:51:51 ***
Total inserts
2.00
Total updates
0.00
Total deletes
0.00
Total discards
0.00
Total operations
2.00
Extracting from SAJET.MLOG$_SYS_EMP to SAJET.MLOG$_SYS_EMP:
*** Total statistics since 2010-03-05 09:51:51 ***
Total inserts
2.00
Total updates
0.00
Total deletes
0.00
Total discards
0.00
Total operations
2.00
*** Daily statistics since 2010-03-08 00:00:00 ***
Total inserts
2.00
Total updates
0.00
Total deletes
0.00
Total discards
0.00
Total operations
2.00
*** Hourly statistics since 2010-03-08 15:00:00 ***
Total inserts
2.00
Total updates
0.00
Total deletes
0.00
Total discards
0.00
Total operations
2.00
*** Latest statistics since 2010-03-05 09:51:51 ***
Total inserts
2.00
Total updates
0.00
13

Total deletes
Total discards
Total operations

0.00
0.00
2.00

End of Statistics.

DML

4 GoldenGate Support DDL


1. Schema DDL GoldenGate
2. Globals
3. Oracle Recycle bin

On Oracle10gand up, system recycle bin must be disabled.


To turn off the recycle bin:
Oracle10gRelease 2 and later: Set the RECYCLEBIN initialization parameter to
OFF.
Oracle10gRelease 1: Set the _RECYCLEBIN initialization parameter to FALSE.
4. GGS
5. SQLPLUS
6. run marker_setup.sql, enter GoldenGate schema(goldengate)
7. run ddl_setup.sql
enter schema:goldengate
choose installation mode: INITIALSETUP
8. run role_setup.sql
9. grant role(GGS_GGSUSER_ROLE) to all GoldenGate Extract users;
10. run ddl_enable.sql
.

GGSCI (PONY) 23> edit param globals

14

GGSCHEMA goldengate
D:\ggs>sqlplus/ as sysdba
SQL*Plus: Release 10.2.0.1.0 - Production on 3 3 10:12:06 2010
Copyright (c) 1982, 2005, Oracle. All rights reserved.

:
Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Production
With the Partitioning, OLAP and Data Mining options
SQL> @marker_setup.sql
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:goldengate

Marker setup table script complete, running verification script...


Please enter the name of a schema for the GoldenGate database objects:
Setting schema name to GOLDENGATE
MARKER TABLE
-------------------------------------------------------------OK
MARKER SEQUENCE
-------------------------------------------------------------OK
Script complete.
SQL> @ddl_setup.sql
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 object
15

s.
NOTE: The schema must be created prior to running this script.
NOTE: On Oracle 10g and up, system recycle bin must be disabled.
NOTE: Stop all DDL replication before starting this installation.
Enter GoldenGate schema name:goldengate
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

Using GOLDENGATE as a GoldenGate schema name, INITIALSETUP as a mode of installa


tion.
Working, please wait ...
RECYCLEBIN must be empty.
This installation will purge RECYCLEBIN for all users.
To proceed, enter yes. To stop installation, enter no.
Enter yes or no:yes

DDL replication setup script complete, running verification script...


Please enter the name of a schema for the GoldenGate database objects:
Setting schema name to GOLDENGATE
DDLORA_GETTABLESPACESIZE STATUS:
Line/pos
-------------------------------------------------------------------------------Error
----------------------------------------------------------------No errors
No errors

CLEAR_TRACE STATUS:
16

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:


17

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

18

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
19

-------------------------------------------------------------------------------ENABLED
STAYMETADATA IN TRIGGER
-------------------------------------------------------------------------------OFF
DDL TRIGGER SQL TRACING
-------------------------------------------------------------------------------0
DDL TRIGGER TRACE LEVEL
-------------------------------------------------------------------------------0
LOCATION OF DDL TRACE FILE
-------------------------------------------------------------------------------C:\ORACLE\PRODUCT\10.2.0\ADMIN\TEST\UDUMP/ggs_ddl_trace.log
Analyzing installation status...

STATUS OF DDL REPLICATION


-------------------------------------------------------------------------------SUCCESSFUL installation of DDL Replication software components
Script complete.
SQL> @role_setup.sql
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 scri
pt 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 object
s.
20

NOTE: The schema must be created prior to running this script.


NOTE: Stop all DDL replication before starting this installation.
Enter GoldenGate schema name:goldengate
file role_setup_set.txt
PL/SQL

Role setup script complete


Grant this role to each user assigned to the Extract, GGSCI, and Manager process
es, by using the following SQL command:
GRANT GGS_GGSUSER_ROLE TO <loggedUser>
where <loggedUser> is the user assigned to the GoldenGate processes.
SQL> GRANT GGS_GGSUSER_ROLE TO goldengate;

SQL> @ddl_enable.sql

SQL> exit

Note

Supported Oracle objects and operations for DDL replication


clusters
functions
indexes
packages
procedure
tables
tablespaces
roles
sequences
synonyms
21

triggers
types
views
materialized views
users

Non-supported Oracle objects and operations for DDL replication


Oracle-reserved schemas
Oracle recycle bin
Limitation of GG DDL Support
1) GoldenGate supports DDL replication for uni-directional configurations. Bi-directional
replication of DDL is not supported.()
2) GoldenGate supports DDL synchronization only in a like-to-like configuration.GoldenGate
DDL support requires the following:
Source and target object definitions must be identical.
The ASSUMETARGETDEFS parameter must be used in the Replicat parameter file. Replicat
will abend if objects are configured for DDL support and the SOURCEDEFS parameter is being
used.( Replicat ASSUMETARGETDEFS )

22