2014-08-31 Baoxinjian
I. Summary
Oracle goldengate software enables data synchronization between source and target libraries by parsing source-side online logs or archive logs for data increments based on database log structure changes, and then applying these changes to the target database.
The following is a simple example that details the use of goldengate to achieve synchronization between Oracle databases.
The basic architecture looks like this:
Second, installation
1.1 Download Media
The Goldengate installation media can be downloaded from Oracle's official website.
Http://www.oracle.com/technetwork/middleware/goldengate/downloads/index.html
1.2 Configuring Goldengate Users
Once the download is complete, it is ready to be copied to the source and destination at the appropriate location after the decompression is complete, the configuration can begin.
# useradd-g Oinstall-g dba Ggate
# su–ggate
# passwd Ggate
$ mkdir/opt/oracle/ggate
$ cd/opt/oracle/ggate
$ tar-xvf
Note that if you use the Oracle 11g database, you need to create a link file.
$ ln-s/u01/app/oracle/product/11.2.0/db_1/lib/libnnz11.so-
/u01/app/oracle/product/11.2.0/db_1/lib/libnnz10.so
$ VI ~/.bash_profile
Add the following content:
Export Oracle_base=/u01/app/oracle
Export Oracle_home= $ORACLE _base/product/10.2.0/db_1
Export Ld_library_path= $ORACLE _home/lib:/u01/app/oracle/ggate
Export Ggate=/u01/app/oracle/ggate
1.3 Creating a Directory
Use the Ggsci tool to create the necessary directories.
$ cd/u01/app/oracle/ggate
$./ggsci
Oracle GoldenGate Command Interpreter for Oracle
Version 11.1.1.0.0 Build 078
Linux, x86, 32bit (optimized), Oracle 28 on Jul 2010 13:24:18
Copyright (C) 1995, Oracle and/or its affiliates. All rights reserved.
Ggsci (Gridcontrol) 1> Create Subdirs
At this point, goldengate Basic installation is complete.
Note. This section needs to be done on both the source and target side.
Third, configure the source data side
1. Source Database Configuration
Goldengate mainly through the retrieval of the source-side database redo log analysis, the obtained data to the target side, to achieve data synchronization. Therefore, in order for Goldengate to work properly, the source database needs to be configured.
1.1 Setting the Source Library to archive mode
sql> shutdown Immediate
Sql> Startup Mount
sql> ALTER DATABASE Archivelog;
sql> ALTER DATABASE open;
1.2 Opening minimal supplemental logging
sql> ALTER DATABASE add supplemental log data;
Sql> select Supplemental_log_data_min from V$database;
Suppleme
——–
YES
1.3 Shutting down the recyblebin of the database
Sql> alter system set Recyclebin=off Scope=spfile;
If the database is 10g, you need to close RecycleBin and restart it, or manually purge RecycleBin.
1.4 Configuring DDL Support for Replication
Sql> create user ggate identified by ggate default tablespace users temporary tablespace temp;
Sql> Grant connect,resource,unlimited tablespace to Ggate;
Sql> Grant execute on utl_file to Ggate;
sql> @ $GGATE/marker_setup.sql;
sql> @ $GGATE/ddl_setup.sql;
sql> @ $GGATE/role_setup.sql;
Sql> Grant Ggs_ggsuser_role to Ggate;
sql> @ $GGATE/ddl_enable.sql;
1.5 Creating a test user on the source and target side
Source
Sql> Create user sender identified by Oracle default tablespace users temporary tablespace temp;
Sql> Grant connect,resource,unlimited tablespace to Sender;
Destination
Sql> create user receiver identified by Oracle default tablespace users temporary tablespace temp;
Sql> Grant connect,resource,unlimited tablespace to receiver;
2 Configuring the Manager
Perform the following steps separately on the source and target sides.
2.1 Creating the Manager
[Ggate@gridcontrol gg]$./ggsci
Ggsci (Gridcontrol) 1> info All
Program Status Group Lag time Since chkpt
MANAGER STOPPED
Ggsci (Gridcontrol) 2> edit params Mgr
PORT 7809
Ggate (Gridcontrol) 3> start manager
Manager started.
3. Configure the source-side replication queue
Ggsci (Gridcontrol) 1> Add extract ext1, Tranlog, begin now
EXTRACT added.
Ggsci (Gridcontrol) 2> add exttrail/opt/oracle/ggate/dirdat/lt, extract Ext1
Exttrail added.
Ggsci (Gridcontrol) 3> edit params Ext1
Extract Ext1
UserID Ggate@gavinprod, password Oracle
Rmthost Centos4, Mgrport 7809
Rmttrail/u01/app/oracle/ggate/dirdat/lt
DDL include mapped objname sender.*;
Table sender.*;
Ggsci (Gridcontrol) 6> info All
Program Status Group Lag time Since chkpt
MANAGER STOPPED
EXTRACT STOPPED EXT1 00:00:00 00:10:55
Iv. Configuring the target side
1. Configure the target-side synchronization queue
1.1 Adding checkpoint tables on the target side
[Oracle@centos4 ggate]$./ggsci
Ggsci (CENTOS4) 1> edit params./global– Add the following
Ggschema ggate
Checkpointtable Ggate.checkpoint
Ggsci (CENTOS4) 2> dblogin userid Ggate@target
Password:
Successfully logged into database.
Ggsci (CENTOS4) 3> add checkpointtable ggate.checkpoint
Successfully created Checkpoint table Ggate. CHECKPOINT.
1.2 Creating a synchronization queue
Ggsci (CENTOS4) 4> add Replicat rep1, exttrail/opt/oracle/ggate/dirdat/lt, checkpointtable ggate.checkpoint
Replicat added.
Ggsci (CENTOS4) 5> edit params Rep1
Replicat REP1
Assumetargetdefs
UserID ggate@gavinsit, password Oracle
Discardfile/opt/oracle/ggate/dirdat/rep1_discard.txt, append, megabytes 10
Ddl
Map sender.*, Target receiver.*;
2. Turn on Sync
Ggsci (Gridcontrol) 14> start extract ext1
Ggsci (gridcontrol) 15> info all
Pr ogram status group Lag time Since chkpt
manager RUNNING
extract running ext1 00:00:00 00:00:05
Ggsci (CENTOS4) 7> start Replicat rep1
Ggsci (CENTOS4) 8> info All
Program Status Group Lag time Since chkpt
MANAGER RUNNING
Replicat RUNNING REP1 00:00:00 00:00:00
3. Verify the results
SOURCE side:
Sql> CREATE TABLE sender.test_tab_1 (ID number,rnd_str varchar2 (12));
sql> INSERT INTO sender.test_tab_1 values (1, ' test_1′);
Sql> commit;
Target side:
Sql> select * from Receiver.test_tab_1;
ID Rnd_str
———- ————
1 test_1
\
Ggsci (gavinprod.com) 9> View report EXT1
***********************************************************************
Oracle GoldenGate Capture for Oracle
Version 11.2.1.0.1 OGGCORE_11.2.1.0.1_PLATFORMS_120423.0230_FBO
Linux, x64, 64bit (optimized), Oracle 11g on APR 23 2012 08:42:16
Copyright (C) 1995, Oracle and/or its affiliates. All rights reserved.
Starting at 2014-09-10 02:24:08
***********************************************************************
Operating System Version:
Linux
Version #1 SMP Mon Nov 02:14:55 EST., Release 2.6.18-53.el5
Node:gavinprod.com
Machine:x86_64
Soft Limit Hard Limit
Address Space Size:unlimited Unlimited
Heap Size:unlimited Unlimited
File Size:unlimited Unlimited
CPU Time:unlimited Unlimited
Process id:4793
Description:
***********************************************************************
* * Running with the following parameters * *
***********************************************************************
2014-09-10 02:24:08 INFO OGG-03035 Operating system Character Set Identifie
D as UTF-8. Locale:en_us, Lc_all:.
Extract Ext1
UserID Ggate@gavinprod, password ******
Rmthost centos5, Mgrport 7809
Rmttrail/opt/oracle/ggate/dirdat/lt
DDL include mapped objname sender.*;
Table sender.*;
2014-09-10 02:24:19 INFO OGG-01635 bounded recovery:reset to initial or al
Tered checkpoint.
2014-09-10 02:24:19 INFO OGG-01815 Virtual Memory Facilities for:br
Anon Alloc:mmap (Map_anon) Anon Free:munmap
File Alloc:mmap (map_shared) file Free:munmap
Target directories:
/opt/oracle/ggate/br/ext1.
Bounded Recovery Parameter:
Options = Brreset
Brinterval = 4HOURS
Brdir =/opt/oracle/ggate
2014-09-10 02:24:19 INFO OGG-01815 Virtual Memory Facilities for:com
Anon Alloc:mmap (Map_anon) Anon Free:munmap
File Alloc:mmap (map_shared) file Free:munmap
Target directories:
/opt/oracle/ggate/dirtmp.
Cachemgr virtual memory values (may have been adjusted)
cachesize:64g
Cachepageoutsize (normal): 8M
PROCESS VM AVAIL from OS (min): 128G
Cachesizemax (strict force to disk): 96G
Database Version:
Oracle Database 11g Enterprise Edition Release 11.2.0.1.0-64bit 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
Database Language and Character Set:
Nls_lang = ". Al32utf8 "
Nls_language = "AMERICAN"
Nls_territory = "AMERICA"
Nls_characterset = "Al32utf8"
2014-09-10 02:24:20 WARNING OGG-01423 No Valid default archive log destination
Directory found for thread 1.
2014-09-10 02:24:21 INFO OGG-01515 positioning to begin time Sep 10, 2014 1
: 27:40 AM.
2014-09-10 02:24:21 INFO OGG-01516 positioned to Sequence one, RBA 32997376,
SCN 0.0, Sep, 1:27:40 AM.
2014-09-10 02:24:37 INFO OGG-01226 Socket buffer size set to 27985 (flush s
Ize 27985).
2014-09-10 02:24:37 INFO OGG-01052 No Recovery is required for target file
/opt/oracle/ggate/dirdat/lt000000, at RBA 0 (file not opened).
2014-09-10 02:24:37 INFO OGG-01478 Output file/opt/oracle/ggate/dirdat/lt
is using format RELEASE 11.2.
***********************************************************************
* * Run Time Messages * *
***********************************************************************
2014-09-10 02:24:37 INFO OGG-01517 Position of first record processed Seque
nCE One, RBA 32997392, SCN 0.1148088, Sep, 1:27:41 AM.
2014-09-10 02:24:38 INFO OGG-00732 Found crash recovery marker from thread
#1 on sequence one at RBA 33305616. Aborting uncommitted transactions.
2014-09-10 02:24:38 INFO OGG-00732 Found crash recovery marker from thread
#1 on sequence in RBA 1040. Aborting uncommitted transactions.
Abalone New ********************
Reference: http://www.oracle.com/technetwork/cn/articles/datawarehouse/oracle-sqlserver-goldengate-1396114-zhs.html
Dba_oracle goldengate Installation Detailed (case)