Beruflich Dokumente
Kultur Dokumente
Oracle GoldenGate enables the exchange and manipulation of data at the transaction level among multiple, heterogeneous (Oracle, DB2, SQL Server,
Ingres, MySQL) platforms across the enterprise. Oracle Goldengate can be used as a replication tool, ETL, and even as a DR solution. GoldenGate
enables us to extract and replicate data across a variety of topologies as shown the diagram below as well as the exchange and manipulation of data at the
transactional level between different databases.
● Extract: The Extract process runs on the source system and is the extraction (capture) mechanism of Oracle GoldenGate.
● Data pump: A data pump is a secondary Extract group within the source Oracle GoldenGate configuration. The data pump reads this trail and sends the
data over the network to a remote trail on the target. DATA PUMP is an optional extract.
● Replicat: The Replicat process runs on the target system. Replicat reads extracted data changes and DDL changes (if supported) that are specified in
the Replicat configuration, and then it replicates them to the target database
● Trails or extract files: To support the continuous extraction and replication of database changes, Oracle GoldenGate stores the captured changes
temporarily on disk in a series of files called a trail. A trail can exist on the source or target system, or on an intermediary system, depending on how you
configure Oracle GoldenGate. On the local system it is known as an extract trail (or local trail). On a remote system it is known as a remote trail.
Trail files are created as needed during processing, and they are aged automatically to allow processing to continue without interruption for file
maintenance. By default, each file in a trail is 10 MB in size.
● Checkpoints: Checkpoints store the current read and write positions of a process to disk for recovery purposes. These checkpoints ensure that data
changes that are marked for synchronization actually are extracted by Extract and replicated by Replicat, and they prevent redundant processing. They
provide fault tolerance by preventing the loss of data should the system, the network, or an Oracle GoldenGate process need to be restarted.
● Manager: Manager is the control process of Oracle GoldenGate. Manager must be running on each system in the Oracle GoldenGate configuration
before Extract or Replicat can be started, and Manager must remain running while those processes are running so that resource management functions
are performed. Manager performs the following functions:
● Collector: Collector is a process that runs in the background on the target system. Collector receives extracted database changes that are sent across
the TCP/IP network, and it writes them to a trail or extract file. Typically, Manager starts Collector automatically when a network connection is required.
When Manager starts Collector, the process is known as a dynamic Collector, and Oracle GoldenGate users generally do not interact with it. However, you
can run Collector manually. This is known as a static Collector. Not all Oracle GoldenGate configurations use a Collector process.
Section-0
1. It is a replication tool.
3. However, Oracle Data Guard will only replicate from "Oracle to Oracle" databases.
Where as Oracle GoldenGate is "heterogeneous" replication. So, what does "heterogenous" means?
Well, it mean cross platform which means, "Oracle to SQL Server", "SQL Server to Oracle", "Oracle to DB2", "Oracle to MySQL" is possible with
Oracle GoldenGate
The following is the high level documentation of Oracle 11g R2 GoldenGate installation on 64-bit RHEL 5 u3. As time progress, I will be updating this
document. Please refer to server 210 and 211 for your reference.
Once you have the above done, you are ready to configure Oracle 11g R2 GoldenGate on your database server. So let us start with the basics.
Part-1 Install OS
I used OS RHEL5 u3 64-bit to build two servers. However because of the rpm requirement, it is best if you work on 64-bit CentOS 5.6 as your Operating
System. My server names are Linux-VM-159 and Linux-VM-161 which was built using automatic partitioning with all the packages during the initial
installation. Later I will be naming my database as MDB1 and MDB2 respectively.
Application:
● Editors
● Graphical Internet
● Text-based Internet
Development:
● Development Libraries
● Development Tools
Servers
● Server Configuration Tools
Base System
● Administration Tools
● Base
● System Tools
● X Window System
● Make sure both server has hostnames recorded in /etc/hosts.
● Make sure times are same on both servers, if not change it. Below is an example on how to change the time and sync it with BIOS time.
date -s "12/28/2010 02:32:00"
clock -w
Download GG
● From your local laptop browse to http://www.oracle.com/technetwork/middleware/goldengate/downloads/index.html and download 11g GG.
● We will be downloading 11.1.0.2 zip file called “ogg112101_fbo_ggs_Linux_x64_ora11g_64bit.zip” from the above site. Just accept the license
and click on the file. [you may will need your metalink credentials]
● Once the file is downloaded to your client windows machine, using “winscp” send the zip file to your database server. As per the standards in my
database environment, send the file to /u99/software/GoldenGate/11g/64-bit
Create directories for GoldenGate Working directories (GoldenGate Working Directories = Golden Gate Engine)
create subdirs
Exit out of Golden Gate
exit
Section-1 Verify DB is in archivelog mode are in archivelog mode (Execute on both Source and Target)
sqlplus / as sysdba
If DB is not in archivelog log mode, see “How enable the archivelog mode”.
http://www.mydbanotes.com/2011/07/how-to-enable-archivelog-mode.html
Section-2 Add supplemental Log data for all columns in database. (Execute on both Source and Target)
SELECT SUPPLEMENTAL_LOG_DATA_MIN FROM V$DATABASE;
-- it must be YES or IMPLICIT
Section-5 Create GGS_ADMINSchema for Oracle GoldenGate objects (Execute on both Source and Target)
sqlplus / as sysdba
create user GGS_ADMIN identified by abc123 default tablespace users temporary tablespace temp;
grant dba to GGS_ADMIN;
grant connect,resource,unlimited tablespace to GGS_ADMIN;
grant execute on utl_file to GGS_ADMIN;
Section-6 Run scripts for creating all necessary objects for support DDL replication (Execute on both Source and Target)
cd $GGATE ← Very important to be in the GG_HOME
sqlplus / as sysdba
spool /tmp/gg_setup.rtf
#1
@$GGATE/marker_setup.sql
Enter GoldenGate schema name: GGS_ADMIN
#2
@$GGATE/ddl_setup.sql
Enter Oracle GoldenGate schema name: GGS_ADMIN
Enter mode of installation:INITIALSETUP
#3
@$GGATE/role_setup.sql
Enter Oracle GoldenGate schema name: GGS_ADMIN
The above will generate SQL to create a role. Simply run the following as we have only one user GGS_ADMIN.
grant GGS_GGSUSER_ROLE to GGS_ADMIN;
#4
@$GGATE/ddl_enable.sql
#5
@$GGATE/ddl_pin.sql GGS_ADMIN
So what is ddl_pin.sql ?
● It pins GoldenGate DDL Replication code in shared pool
○ exec dbms_shared_pool.keep(...........);
exit;
Step-10 Enable additional logging at the table level (This needs more info)
cd $GGATE
./ggsci
DBLOGIN USERID GGS_ADMIN, PASSWORD abc123
add trandata <owner>.<tablename>
exit
Section 10 - Task:
Our taskis to replicate a schema called “sender” to the destination database schema called “receiver”.
create user sender identified by abc123 default tablespace users temporary tablespace temp;
grant connect,resource,unlimited tablespace to sender;
create user receiver identified by abc123 default tablespace users temporary tablespace temp;
grant connect,resource,unlimited tablespace to receiver;
The Manager process must be running on both the source as well as target systems before the Extract or Replicat process can be started and performs a
number of functions including monitoring and starting other GoldenGate processes, managing the trail files and also reporting.
cd $GGS_ADMIN
./ggsci
Now Create and extract called “ext1” and edit it’s parameter file.
edit params E1
--Extract name
extract ext1
--Connection to database--
userid GGS_ADMIN, password abc123
--DDL support
ddl include mapped objname Moid.T1;
--DML
table Moid.T1
--Create Parameter file for replicat. Add the following lines in the parameter file.
--ddl support
DDL
Verification:
-------------
DECLARE
v_count number := 0;
BEGIN
LOOP
EXIT WHEN v_count > 16;
INSERT INTO sender.emp
SELECT * FROM sender.emp;
COMMIT;
v_count := v_count + 1;
END LOOP;
END;
/
--On Source:
SQL> select count(*) from receiver.emp;
COUNT(*)
----------
7340032
SQL> !hostname
Linux-VM-GG-211
--On Destination:
SQL> select count(*) from receiver.emp;
COUNT(*)
----------
7340032
SQL> !hostname
Linux-VM-GG-211
That's it. You just created Uni-Directional Replication using Oracle GoldenGate.
commands
---------
history
show all
info all
start manager
DBLOGIN USERID ggs_owner, PASSWORD ggs_owner
stop manager
fc --> same like fc -l of unix?
help add extract
help add replicat
Error logs
view ggsevt
vi $GGS_ADMIN/ggserr.log
tail -f $GGS_ADMIN/ggserr.log
$GGS_ADMIN/dirrpt/EXT1.rpt --Extract logs are here.
GG Administrator’s Guide
http://download.oracle.com/docs/cd/E18101_01/doc.1111/e17341.pdf
GG installation on Oracle:
http://download.oracle.com/docs/cd/E18101_01/doc.1111/e17799.pdf