Friday 9 June 2017

GG integrated method unidirectional example

                                                            GG integrated method example
**********************************************************************************
Set the following parameters in DB pfile/spfile on both source and target;

alter system set enable_goldengate_replication=TRUE scope=both;
alter system set recyclebin=off scope=spfile;



If not put the database in archivelog mode.
shutdown immediate;

startup mount

alter database archivelog;

alter database open;

Enable force logging and supplemental logging in source

alter database force logging;

alter database add supplemental log data;


The force logging mode captures transactions even if nologging is specified for some operations by the end users or applications. The supplemantal log data is necessary so that GoldenGate is able to extract committed transactions out of the redo logs.

The next step is to create a GoldenGate admin user both databases: source and target


Create goldengate user on both source and target side:

src:

SQL> create user goldengate identified by oracle;

User created.

SQL> grant dba to goldengate;

Grant succeeded.

trg:

SQL> create user goldengate identified by oracle;

User created.

SQL> grant dba to goldengate;

Grant succeeded.


create a wallet and store the credentials

GGSCI (localhost.localdomain) 1> create wallet

Created wallet at location 'dirwlt'.

Opened wallet at location 'dirwlt'.

GGSCI (localhost.localdomain) 2> add credentialstore

Credential store created in ./dircrd/.

GGSCI (localhost.localdomain) 3> alter credentialstore add user goldengate@src password oracle alias gg_user

Credential store in ./dircrd/ altered.

GGSCI (localhost.localdomain) 5> info credentialstore

Reading from ./dircrd/:

Default domain: OracleGoldenGate

  Alias: gg_user
  Userid: goldengate@src


Create the wallet on target side also like above.

Add supplemental log data to the tables we want to replicate

GGSCI (localhost.localdomain) 2> dblogin userid goldengate@src
Password:
Successfully logged into database.

GGSCI (localhost.localdomain as goldengate@src) 3> add trandata goldengate.srtest

2017-06-08 04:08:33  WARNING OGG-06439  No unique key is defined for table SRTEST. All viable columns will be used to represent the key, but may not guarantee uniqueness. KEYCOLS may be used to define the key.

Logging of supplemental redo data enabled for table GOLDENGATE.SRTEST.
TRANDATA for scheduling columns has been added on table 'GOLDENGATE.SRTEST'.
TRANDATA for instantiation CSN has been added on table 'GOLDENGATE.SRTEST'.


Before we do any additional configuration make sure the GoldenGate manager is started on both hosts:

SRC

GGSCI (localhost.localdomain as goldengate@src) 4> info all

Program     Status      Group       Lag at Chkpt  Time Since Chkpt

MANAGER     RUNNING

TGR


GGSCI (localhost.localdomain as goldengate@src) 4> info all

Program     Status      Group       Lag at Chkpt  Time Since Chkpt

MANAGER     RUNNING


Now that the managers are configured we can continue with configuring the capture/extract process:

GGSCI (localhost.localdomain) 7> add extract extint,integrated tranlog,begin now
EXTRACT (Integrated) added.

GGSCI (localhost.localdomain) 8> add exttrail /gg/12c/src/dirdat/itrail/in,extract extint
EXTTRAIL added.

GGSCI (localhost.localdomain) 1> edit params extint

extract extint
useridalias gg_user
exttrail /gg/12c/src/dirdat/itrail/in
table goldengate.srtest;


For the integrated capture mode to work we now must register the capture process with the database:

GGSCI (localhost.localdomain) 9> dblogin useridalias gg_user
Successfully logged into database.

GGSCI (localhost.localdomain as goldengate@src) 10> register extract extint database

2017-06-08 04:59:46  INFO    OGG-02003  Extract EXTINT successfully registered with database at SCN 1658828.

Pump process
GGSCI (localhost.localdomain as goldengate@src) 11> edit params pump

extract pump
useridalias gg_user
rmthost 192.168.92.130,mgrport 7810
rmttrail /gg/12c/trg/dirdat/rtrail/rt
passthru
table goldengate.srtest;

GGSCI (localhost.localdomain as goldengate@src) 12> add extract pump,exttrailsource /gg/12c/src/dirdat/itrail/in begin now
EXTRACT added.
GGSCI (localhost.localdomain as goldengate@src) 14> add rmttrail /gg/12c/trg/dirdat/rtail/rt extract pump
RMTTRAIL added.
Now  we can start the extract:
GGSCI (localhost.localdomain) 2> start extract extint
Sending START request to MANAGER ...
EXTRACT EXTINT starting
GGSCI (localhost.localdomain) 12> start pump

Sending START request to MANAGER ...
EXTRACT PUMP starting


GGSCI (localhost.localdomain) 13> info all

Program     Status      Group       Lag at Chkpt  Time Since Chkpt

MANAGER     RUNNING
EXTRACT     RUNNING     EXTINT      00:00:10      00:00:08
EXTRACT     RUNNING     PUMP        00:12:44      00:00:04

replicat process must be configured on the the target system:
GGSCI (localhost.localdomain as goldengate@src) 6> edit params replic

replicat replic
useridalias ggtrg_user
ASSUMETARGETDEFS
MAP goldengate.srtest,TARGET goldengate.trtest;

As with the capture process on the source database the apply process on the target needs to get registered with the database:

GGSCI (localhost.localdomain as goldengate@src) 7> dblogin useridalias gg_user
 Successfully logged into database.
GGSCI (localhost.localdomain as goldengate@src) 8> add replicat replic integrated exttrail /gg/12c/trg/dirdat/rtrail/rt
REPLICAT (Integrated) added.
GGSCI (localhost.localdomain as goldengate@trg) 12>  register replicat replic database;
2017-06-08 08:50:17  INFO    OGG-02528  REPLICAT REPLIC successfully registered with database as inbound server OGG$REPLIC.
GGSCI (localhost.localdomain as goldengate@src) 9> start replicat replic

Sending START request to MANAGER ...
REPLICAT REPLIC starting


GGSCI (localhost.localdomain as goldengate@src) 10> info all

Program     Status      Group       Lag at Chkpt  Time Since Chkpt

MANAGER     RUNNING
REPLICAT    STARTING    REPLIC      00:00:00      00:01:27






1 comment: