Vous êtes sur la page 1sur 15

The following is the high level documentation of Oracle 11g 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.
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-210 and Linux-VM-211 which was built using automatic partitioning with all the packages during the initial
installation.
The following group of packages can be selected
Oracle Enterprise Linux 5.0:
Desktop Environment:
GNOME Desktop Environment
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

Install oracle 11g R2

The following technical notes shows how to install and create 11g R2 database on CentOS. You can use this a guide to install Oracle 11.2.0.2 software on
a VMWare.
http://www.mydbanotes.com/2011/05/oracle-11g-installation-on-64-bit.html
From the above document, we are assuming that the following directories are created and oracle:oinstall has the correct permissions. If not create and
grant proper permission as below:
mkdir -p /u01 /u02 /u03 /u04 /u05 /u14 /u15 /u16 /u17 /u18 /u99
chown -R oracle:oinstall /u01/app/oracle
chmod -R 775 /u01/app/oracle
chown -R oracle:oinstall /u01 /u02 /u03 /u04 /u05 /u14 /u15 /u16 /u17 /u18 /u99
chmod -R 775 /u02 /u03 /u04 /u05 /u14 /u15 /u16 /u17 /u18 /u99

Download 11.2.0.2 Software for 64-bit Linux and install Oracle Software Only.
mkdir -p /u99/software/DB/11g/11.2.0.2/64-bit/
scp 192.168.0.223:/u99/software/DB/11g/11.2.0.2/64-bit/* /u99/software/DB/11g/11.2.0.2/64-bit/.
cd /u99/software/DB/11g/11.2.0.2/64-bit/
Download 11g GG Software.
mkdir -p /u99/software/GoldenGate/11g/64-bit
scp oracle@192.168.0.223:/u99/software/GoldenGate/11g/64-bit /u99/software/GoldenGate/11g/64-bit/.

What is Golden Gate?


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.

Oracle GoldenGate is composed of the following components:


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.

Oracle 11g GoldenGate Installation starts from here.


Execute the following on BOTH Database Servers.
Create Golden Gate Home Directory
mkdir -p /u01/app/oracle/product/11.2.0/gg
Create GoldenGate Software Directory
mkdir -p /u99/software/GoldenGate/11g/64-bit
Download gg from 223 Server
scp 192.168.0.223:/u99/software/GoldenGate/11g/64-bit/GG_V11.1.1.0.0_for_11g_Linux_x86-64bit_V22229-01_V22230-01.zip /u99/software/GoldenGate/11g/64-bit/.

Unzip the GG software


unzip /u99/software/GoldenGate/11g/64-bit/GG_V11.1.1.0.0_for_11g_Linux_x86-64bit_V22229-01_V22230-01.zip
Copy tar file to GG home
cp /u99/software/GoldenGate/11g/64-bit/ggs_Linux_x64_ora11g_64bit_v11_1_1_0_0_078.tar /u01/app/oracle/product/11.2.0/gg/.
untar the file
cd /u01/app/oracle/product/11.2.0/gg/

tar -xvof ggs_Linux_x64_ora11g_64bit_v11_1_1_0_0_078.tar


Add the GG settings in oracles .bash_profile
vi ~/.bash_pfile
export GGATE=/u01/app/oracle/product/11.2.0/gg/
export PATH=$PATH:$GGATE
Re-execute the .bash_profile
. ~/.bash_profile
Start Golden Gate
cd $GGATE
./ggsci
Create directories for GoldenGate Working directories (Golden Gate Engine?)
create subdirs
Exit out of Golden Gate
exit
Source DB:
---------Verify DB is in archivelog mode.

ALTER DATABASE ADD SUPPLEMENTAL LOG DATA (ALL) COLUMNS;


alter system set recyclebin=off scope=spfile; In 11g this is not required.
shutdown immediate;
exit
sqlplus / as sysdba
startup
create user ggate identified by abc123 default tablespace users temporary tablespace temp;
grant connect,resource,unlimited tablespace to ggate;
grant execute on utl_file to ggate;

spool /tmp/gg_setup.rtf
@$GGATE/marker_setup.sql
Enter GoldenGate schema name:ggate

@$GGATE/ddl_setup.sql
Enter mode of installation:INITIALSETUP
@$GGATE/role_setup.sql
grant GGS_GGSUSER_ROLE to ggate;
@$GGATE/ddl_enable.sql
exit;

Source Server:
---------------Create test schemas for replication. I will create a replication from schema sender to schema receiver
sq
create user sender identified by abc123 default tablespace users temporary tablespace temp;
grant connect,resource,unlimited tablespace to sender;

Destination DB:
--------------sq
create user ggate identified by abc123 default tablespace users temporary tablespace temp;
grant connect,resource,unlimited tablespace to ggate;
grant execute on utl_file to ggate;
create user receiver identified by abc123 default tablespace users temporary tablespace temp;
grant connect,resource,unlimited tablespace to receiver;
exit;
@$GGATE/marker_setup.sql
@$GGATE/ddl_setup.sql
@$GGATE/role_setup.sql
grant GGS_GGSUSER_ROLE to ggate;
@$GGATE/ddl_enable.sql

Source DB:
---------cd $GGATE
./ggsci

--to check the status of Manager process. 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.
info all
--add the port# for manager to start the process. 7809 is default.
edit params mgr
PORT 7809
autostart ER *
PURGEOLDEXTRACTS /u01/app/oracle/product/11.2.0/gg/dirdat/*, USECHECKPOINTS, MINKEEPHOURS 4

start manager
DBLOGIN USERID ggate, PASSWORD abc123
DBLOGIN USERID sender, PASSWORD abc123
exit

Destination DB:
--------------cd $GGATE
ggsci
info all
edit params mgr
PORT 7809
autostart ER *
PURGEOLDEXTRACTS /u01/app/oracle/product/11.2.0/gg/dirdat/*, USECHECKPOINTS, MINKEEPHOURS 4

start manager
info all
exit

Create Extract on Source DB:


---------------------------add extract ext1, tranlog, begin now
add exttrail /u01/app/oracle/product/11.2.0/gg/dirdat/lt, extract ext1
edit params ext1
--Add the following lines to the new parameter file for our extract:
--extract group-extract ext1
--connection to database-userid ggate, password abc123
--hostname and port for trail-rmthost Linux-VM-GG-211, mgrport 7809
--path and name for trail-rmttrail /u01/app/oracle/product/11.2.0/gg/dirdat/lt
--DDL support
ddl include mapped objname sender.*;
--DML
table sender.*
--save and come out

Create Replicate on Destination DB:


------------------------------------Use EDIT PARAMS to create or change a parameter file
cd $GGATE
./ggsci
--add checkpoint table to the destination database

edit params ext1


GGSCHEMA ggate
CHECKPOINTTABLE ggate.checkpoint
--login to database from ggsci to create the check point table.
add checkpointtable ggate.checkpoint

--Create Replication Group


add replicat rep1, exttrail /u01/app/oracle/product/11.2.0/gg/dirdat/lt,checkpointtable ggate.checkpoint

--Create Parameter file for replicat. Add the following lines in the parameter file.
--Replicat group Name
replicat rep1

--source and target definitions


ASSUMETARGETDEFS
--target database login -userid ggate, password abc123
--file for dicarded transaction -discardfile /u01/app/oracle/product/11.2.0/gg/discard/rep1_discard.txt, append, megabytes 10
--ddl support
DDL
--Specify table mapping --map sender.*, target receiver.*;

Start extract process on Source:

-------------------------------ggsci
start extract ext1
info all

Start Replicate process on Destination:


--------------------------------------ggsci
start replicat rep1
info all

Verification:
--------------On Source Server
sq
create table sender.emp as select * from scott.emp;
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;
/
select count(*) from sender.emp;
--On Destination Server
sq

select count(*) from receiver.emp;

Numbers should match.


I have the following:
--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
stop replicat rep1
stop stop extract ext1
SEND EXTRACT EXT1, FORCESTOP
stop manager
edit params mgr
edit params ext1
edit params rep1

Error logs
view ggsevt
vi $GGATE/ggserr.log
tail -f $GGATE/ggserr.log
$GGATE/dirrpt/EXT1.rpt --Extract logs are here.
view report mgr
view report ext1
view report rep1

References:
Oracle Main GoldenGate Documentation:
http://www.oracle.com/technetwork/middleware/goldengate/documentation/index.html
Oracle GoldenGate Documentation:
http://download.oracle.com/docs/cd/E18101_01/index.htm
GG Administrators Guide
http://download.oracle.com/docs/cd/E18101_01/doc.1111/e17341.pdf
GG installation on SQL Server:
http://download.oracle.com/docs/cd/E18101_01/index.htm
GG installation on Oracle:
http://download.oracle.com/docs/cd/E18101_01/doc.1111/e17799.pdf

Vous aimerez peut-être aussi