[Oracle] OGG unidirectional replication Configuration

Source: Internet
Author: User

Lab environment:

Source end:

Ip: 192.168.40.10

DataBase: Oracle 11.2.0.1.0 ORCL

OS: OEL5.6

OGG: fbo_ggs_Linux_x86_ora11g_32bit

Target end:

Ip: 192.168.40.128

DataBase: 10.2.0.1.0 ORCL

OS: OEL5.6

OGG: fbo_ggs_Linux_x86_ora11g_32bit

First, configure the environment variables on the two machines, and add the following content to make it take effect:

Export GGATE = $ ORACLE_BASE/ogg

Export LD_LIBRARY_PATH = $ ORACLE_HOME/lib:/usr/lib: $ GGATE

The path is also created:

Mkdir $ ORACLE_BASE/ogg

Source Configuration:

[Oracle @ badly9 ~] $ Sqlplus/as sysdba

SQL * Plus: Release 11.2.0.1.0 Production on Sat Jun 7 17:23:51 2014

Copyright (c) 1982,200 9, Oracle. All rights reserved.

Connected:

Oracle Database 11g Enterprise Edition Release 11.2.0.1.0-Production

With the Partitioning, OLAP, Data Mining and Real Application Testing options

SYS @ ORCL> archive log list

Database log mode Archive Mode

Automatic archival Enabled

Archive destination USE_DB_RECOVERY_FILE_DEST

Oldest online log sequence 5

Next log sequence to archive 7

Current log sequence 7

SYS @ ORCL> select supplemental_log_data_min from v $ database;

SUPPLEME

--------

NO

SYS @ ORCL> alter database add supplemental log data;

Database altered.

SYS @ ORCL> select supplemental_log_data_min from v $ database;

SUPPLEME

--------

YES

SYS @ ORCL> alter database force logging;

Database altered.

SYS @ ORCL> create tablespace tbs_ogg

2 datafile '/u01/app/oracle/oradata/ORCL/datafile/tbs_og1_1.dbf' size 200 M

3 autoextend on;

Tablespace created.

SYS @ ORCL> create user ogg identified by ogg default tablespace tbs_ogg;

User created.

SYS @ ORCL> grant connect, resource, dba to ogg;

Grant succeeded.

SYS @ ORCL> grant execute on utl_file to ogg;

Grant succeeded.

SYS @ ORCL> grant select any dictionary, select any table to ogg;

Grant succeeded.

SYS @ ORCL> grant alter any table to ogg;

Grant succeeded.

SYS @ ORCL> grant flashback any table to ogg;

Grant succeeded.

SYS @ ORCL> grant execute on DBMS_FLASHBACK to ogg;

Grant succeeded.

Target end:

SYS @ ORCL> create tablespace tbs_ogg

2 datafile '/u01/app/oracle/oradata/ORCL/tbs_og1_1.dbf' size 200 M

3 autoextend on;

Tablespace created.

SYS @ ORCL> create user ogg identified by ogg default tablespace tbs_ogg;

User created.

SYS @ ORCL> grant connect, resource, dba to ogg;

Grant succeeded.

SYS @ ORCL> grant execute on utl_file to ogg;

Grant succeeded.

SYS @ ORCL> grant insert any table to ogg;

Grant succeeded.

SYS @ ORCL> grant delete any table to ogg;

Grant succeeded.

SYS @ ORCL> grant update any table to ogg;

Grant succeeded.

Source and target

[Oracle @ badly9 ~] $ Tar-xvf fbo_ggs_Linux_x86_ora11g_32bit.tar

UserExitExamples/

UserExitExamples/ExitDemo_passthru/

UserExitExamples/ExitDemo_passthru/Makefile_passthru.AIX

... ...

[Oracle @ badly9 ~] $./Ggsci

Source end:

GGSCI (badly9) 1> create subdirs

Creating subdirectories under current directory/u01/app/oracle/ogg

Parameter files/u01/app/oracle/ogg/dirprm: already exists

Report files/u01/app/oracle/ogg/dirrpt: created

Checkpoint files/u01/app/oracle/ogg/dirchk: created

Process status files/u01/app/oracle/ogg/dirpcs: created

SQL script files/u01/app/oracle/ogg/dirsql: created

Database definitions files/u01/app/oracle/ogg/dirdef: created

Extract data files/u01/app/oracle/ogg/dirdat: created

Temporary files/u01/app/oracle/ogg/dirtmp: created

Stdout files/u01/app/oracle/ogg/dirout: created

GGSCI (badly9) 2> edit params mgr

GGSCI (badly9) 3> view params mgr

Port 7809

Dynamicportlist 7800-8000

Autorestart extract *, waitminutes 2, resetminutes 5

GGSCI (badly9) 4> start mgr

Manager started.

GGSCI (badly9) 5> edit params eora

GGSCI (badly9) 6> view params eora

Extract eora

Dynamicresolution

Userid ogg, password ogg

Exttrail/u01/app/oracle/ogg/dirdat/et

Table scott .*;

GGSCI (badly9) 7> dblogin userid ogg, password ogg

Successfully logged into database.

GGSCI (badly9) 8> add trandata scott .*

GGSCI (badly9) 9> add extract eora, tranlog, begin now

EXTRACT added.

GGSCI (badly9) 10> add exttrail/u01/app/oracle/ogg/dirdat/et, extract eora

EXTTRAIL added.

GGSCI (badly9) 11> start extract eora

Sending START request to MANAGER...

Extract eora starting

GGSCI (badly9) 12> edit params pump_so

GGSCI (badly9) 13> view params pump_so

Extract pump_so

Dynamicresolution

Passthru

Rmthost 192.168.40.128, mgrport 7809, compress

Rmttrail/u01/app/oracle/ogg/dirdat/pt

Table scott .*;

GGSCI (badly9) 14> add extract pump_so, exttrailsource/u01/app/oracle/ogg/dirdat/et

EXTRACT added.

GGSCI (badly9) 15> add rmttrail/u01/app/oracle/ogg/dirdat/pt, extract pump_so

RMTTRAIL added.

GGSCI (badly9) 16> info all

Program Status Group Lag at Chkpt Time Since Chkpt

MANAGER RUNNING

Extract running eora 00:00:00

Extract running PUMP_SO 00:00:00

Configure the target process:

Because the target end uses oracle 10 Gb, an error is reported when ggsci is started:
[Oracle @ jp ogg] $ ggsci

Ggsci: error while loading shared libraries: libnnz11.so: cannot open shared object file: No such file or directory

Add soft link:

Ln-s/u01/app/oracle/product/10.2.0/db_1/lib/libnnz10.so libnnz11.so

An error is reported when the instance is started again:

[Oracle @ jp ogg] $ ggsci

Ggsci: error while loading shared libraries: libclntsh. so.11.1: cannot open shared object file: No such file or directory

Add a soft link:

Ln-s/u01/app/oracle/product/10.2.0/db_1/lib/libclntsh. so.10.1 libclntsh. so.11.1

Restart normally:

[Oracle @ jp ogg] $ ggsci

Oracle GoldenGate Command Interpreter for Oracle

Version 11.2.1.0.1 oggcore_11.2.1.0.20.platforms_120423.0230_fbo

Linux, x86, 32bit (optimized), Oracle 11g on Apr 23 2012 08:09:25

Copyright (C) 1995,201 2, Oracle and/or its affiliates. All rights reserved.

GGSCI (jp) 1> create subdirs

Creating subdirectories under current directory/u01/app/oracle/ogg

Parameter files/u01/app/oracle/ogg/dirprm: already exists

Report files/u01/app/oracle/ogg/dirrpt: created

Checkpoint files/u01/app/oracle/ogg/dirchk: created

Process status files/u01/app/oracle/ogg/dirpcs: created

SQL script files/u01/app/oracle/ogg/dirsql: created

Database definitions files/u01/app/oracle/ogg/dirdef: created

Extract data files/u01/app/oracle/ogg/dirdat: created

Temporary files/u01/app/oracle/ogg/dirtmp: created

Stdout files/u01/app/oracle/ogg/dirout: created

GGSCI (jp) 2> edit params mgr

GGSCI (jp) 3> view params mgr

Port 7809

Dynamicportlist 7800-8000

Autostart er *

Autorestart extract *, waitminutes 2, retries 5

Lagreporthours 1

Laginfominutes 3

Lagcriticalminutes 5

Purgeoldextracts/u01/app/oracle/ogg/dirdat/rt *, usecheckpoints, minkeepdays 3

GGSCI (jp) 4> start mgr

Manager started.

GGSCI (jp) 5> info all

Program Status Group Lag at Chkpt Time Since Chkpt

MANAGER RUNNING

GGSCI (jp) 12> edit params rep2

GGSCI (jp) 13> view params rep2

Replicat rep2

Userid ogg, password ogg

Assumetargetdefs

Reperror default, discard

Discardfile./dirrpt/rep1.dsc, append, megabytes 50

Dynamicresolution

-- Map ogg. test, target ogg. test;

Map scott. *, target scott .*;

GGSCI (jp) 9> dblogin userid ogg, password ogg;

Successfully logged into database.

GGSCI (jp) 14> add checkpointtable ogg. checkpoint

Successfully created checkpoint table ogg. checkpoint.

GGSCI (jp) 16> add replicat rep2, exttrail/u01/app/oracle/ogg/dirdat/pt, checkpointtable ogg. checkpoint

REPLICAT added.

GGSCI (jp) 17> start rep2

Sending START request to MANAGER...

REPLICAT REP2 starting

GGSCI (jp) 18> info all

Program Status Group Lag at Chkpt Time Since Chkpt

MANAGER RUNNING

Replicat running REP2 00:00:00 00:00:00

DML Testing

Source end:

SCOTT @ ORCL> insert into dept values (33, 'test', 'test1 ');

1 row created.

SCOTT @ ORCL> commit;

Commit complete.

Target end:

SCOTT @ ORCL> select * from dept;

DEPTNO DNAME LOC

-------------------------------------

10 ACCOUNTING NEW YORK

20 RESEARCH DALLAS

30 SALES CHICAGO

40 OPERATIONS BOSTON

33 TEST TEST1

The test is successful.

Note: The Source and target end already have scott users and corresponding tables, so there is no data initialization process.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.