Skip to main content

Bidirectional Replication GG ( Active-Active)

 Also called as active to active configuration 

Source will send the changes to target 

Both the sites are actively doing transactions and sending changes to each other 


There are several configuration need to take consideration while create active active configuration.

EG.

Conflict Detetion and resolution:

Conflict Resolution:

Resolveconflict Built in Methods:

Sequence Considerations:

Truncate considerations:


=================================

Setup:


edit param BE_SCOTT


EXTRACT BE_SCOTT

SETENV (ORACLE_HOME = "/u008/app/oracle/product/19.3.0/dbsoft")

SETENV (ORACLE_SID = "SRC")

useridalias boggsource

TRANLOGOPTIONS EXCLUDEUSER OGG_CLASS

--logallsupcols supports IR and conflict resolution feature

LOGALLSUPCOLS

--GETUPDATEBEFORES

TRANLOGOPTIONS integratedparams (max_sga_size 200, parallelism 2)

GETTRUNCATES

--ENCRYPTTRAIL AES192

exttrail ./dirdat/bl

TABLE BSCOTT.*,GETBEFORECOLS (ON UPDATE ALL,ON DELETE ALL);



---


add extract BE_SCOTT, integrated  TRANLOG , begin now 

ADD EXTTRAIL ./dirdat/bl, EXTRACT BE_SCOTT, megabytes 200


GGSCI (rac1.databasexpert.com as ogg_class@SRCDB) 36> open wallet


Opened wallet at location 'dirwlt'.


GGSCI (rac1.databasexpert.com as ogg_class@SRCDB) 37> add masterkey


Master key 'OGG_DEFAULT_MASTERKEY' added to wallet at location 'dirwlt'.


GGSCI (rac1.databasexpert.com as ogg_class@SRCDB) 38>



edit param BP_SCOTT


EXTRACT BP_SCOTT

useridalias boggsource

--RMTHOSTOPTIONS encrypt AES192

rmttrail ./dirdat/br

rmthost 192.168.56.40,mgrport 7809

TABLE BSCOTT.*;




add extract BP_SCOTT , exttrailsource ./dirdat/bl begin now

add rmttrail ./dirdat/br, extract BP_SCOTT 



edit param Br_scott


replicat br_scott

DBOPTIONS INTEGRATEDPARAMS(parallelism 2)

useridalias boggtarget

MAP BSCOTT.*, TARGET BSCOTT.*

COMPARECOLS (ON UPDATE ALL, ON DELETE ALL),

RESOLVECONFLICT (UPDATEROWEXISTS, (DEFAULT, OVERWRITE)),

RESOLVECONFLICT (INSERTROWEXISTS, (DEFAULT, OVERWRITE)),

RESOLVECONFLICT (DELETEROWEXISTS, (DEFAULT, OVERWRITE)),

RESOLVECONFLICT (UPDATEROWMISSING, (DEFAULT, IGNORE)),

RESOLVECONFLICT (DELETEROWMISSING, (DEFAULT, IGNORE));



add replicat BR_SCOTT, Integrated   exttrail ./dirdat/br


Reverse Configuration 



edit param BE_SCOTT


EXTRACT BE_SCOTT

SETENV (ORACLE_HOME = "/u008/app/oracle/product/19.3.0/db")

SETENV (ORACLE_SID = "TRGT")

useridalias boggtarget

TRANLOGOPTIONS EXCLUDEUSER OGG_CLASS

--logallsupcols supports IR and conflict resolution feature

LOGALLSUPCOLS

--GETUPDATEBEFORES

TRANLOGOPTIONS integratedparams (max_sga_size 200, parallelism 2)

--ENCRYPTTRAIL AES192

exttrail ./dirdat/bs

TABLE BSCOTT.*,GETBEFORECOLS (ON UPDATE ALL,ON DELETE ALL);



add extract BE_SCOTT, integrated  TRANLOG , begin now 

ADD EXTTRAIL ./dirdat/bs, EXTRACT BE_SCOTT, megabytes 200



edit param BP_SCOTT


EXTRACT BP_SCOTT

--RMTHOSTOPTIONS encrypt AES192

rmttrail ./dirdat/sb

rmthost 192.168.56.30,mgrport 7809

TABLE BSCOTT.*;


add extract BP_SCOTT , exttrailsource ./dirdat/bs begin now

add rmttrail ./dirdat/sb, extract BP_SCOTT 



edit param Br_scott


replicat Br_scott

DBOPTIONS INTEGRATEDPARAMS(parallelism 2)

useridalias boggsource

MAP BSCOTT.OGG_TEST, TARGET BSCOTT.OGG_TEST

COMPARECOLS (ON UPDATE ALL, ON DELETE ALL),

RESOLVECONFLICT (UPDATEROWEXISTS, (DEFAULT, OVERWRITE)),

RESOLVECONFLICT (INSERTROWEXISTS, (DEFAULT, OVERWRITE)),

RESOLVECONFLICT (DELETEROWEXISTS, (DEFAULT, OVERWRITE)),

RESOLVECONFLICT (UPDATEROWMISSING, (DEFAULT, IGNORE)),

RESOLVECONFLICT (DELETEROWMISSING, (DEFAULT, IGNORE));



add replicat BR_SCOTT, Integrated   exttrail ./dirdat/sb


 REGISTER EXTRACT BP_SCOTT, DATABASE---> rac3

 REGISTER EXTRACT BP_SCOTT, DATABASE---> rac4


DbLogin useridalias boggsource

GGSCI (rac3.databasexpert.com as bscott@SRC) 6> Add SchemaTrandata bscott;

DbLogin useridalias boggtarget

GGSCI (rac4.databasexpert.com as bscott@TRGT) 6> Add SchemaTrandata bscott;



create table BSCOTT.OGG_TEST (

  roll number(10) PRIMARY KEY ,

  name varchar2(10));


Test the insert on both the sides:


SQL>  select * from BSCOTT.OGG_TEST;


      ROLL NAME

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

       102 MRUNA---- from rac4 

       101 JAYESH---- from rac3



Replication is OK 



=========================================================================================

GGSCI (rac3.databasexpert.com as bscott@SRC) 47> info all


Program     Status      Group       Lag at Chkpt  Time Since Chkpt


MANAGER     RUNNING

EXTRACT     RUNNING     BE_SCOTT    00:00:00      00:00:00

EXTRACT     RUNNING     BP_SCOTT    00:00:00      00:00:01

EXTRACT     RUNNING     E_SCOTT     00:00:00      00:00:07

EXTRACT     RUNNING     IE_SCOTT    00:00:00      00:00:06

EXTRACT     RUNNING     IP_SCOTT    00:00:00      00:00:02

EXTRACT     RUNNING     P_SCOTT     00:00:00      00:00:02

REPLICAT    RUNNING     BR_SCOTT    00:00:00      00:00:08



======================================


RAC4

SQL> show parameter db_name


NAME                                 TYPE        VALUE

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

db_name                              string      TRGT

SQL>  insert into BSCOTT.OGG_TEST values(103,'DEEP');


1 row created.


SQL> commit;


Commit complete.


SQL> select * from BSCOTT.OGG_TEST;


      ROLL NAME

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

       102 MRUNA

       103 DEEP

       101 JAYESH



=================================


RAC3


SQL> select * from BSCOTT.OGG_TEST;


      ROLL NAME

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

       102 MRUNA

       103 DEEP

       101 JAYESH


insert into BSCOTT.OGG_TEST values(104,'ADU');


1 row created.


SQL> commit;


Commit complete.


SQL> select * from BSCOTT.OGG_TEST;


      ROLL NAME

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

       102 MRUNA

       103 DEEP

       101 JAYESH

       104 ADU

============================================


RAC4



SQL> select * from BSCOTT.OGG_TEST;


      ROLL NAME

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

       102 MRUNA

       103 DEEP

       101 JAYESH

       104 ADU


====================================

Comments

Popular posts from this blog

Hard dependency with ip address Oracle RAC Cluster.

Command error out due to hard dependency with ip address [-Node1]/app/grid/oracle/product/11.2.0/grid/bin>./crsctl relocate resource RDBMS_DB -n Node2 CRS-2527: Unable to start 'RDBMS_DB' because it has a 'hard' dependency on 'sDB' CRS-2525: All instances of the resource 'sDB' are already running; relocate is not allowed because the force option was not specified CRS-4000: Command Relocate failed, or completed with errors. [-Node1]/app/grid/oracle/product/11.2.0/grid/bin>./crsctl relocate resource sDB  -n Node2 CRS-2529: Unable to act on 'DB' because that would require stopping or relocating 'LISTENER_DB', but the force option was not specified CRS-4000: Command Relocate failed, or completed with errors. [-Node1]/app/grid/oracle/product/11.2.0/grid/bin>./crsctl relocate resource LISTENER_DB  -n Node2 CRS-2527: Unable to start 'LISTENER_DB' because it has a 'hard' dependency on 'sD...

19C NID ( Rename Database)

 [oracle@localhost ~]$ nid DBNEWID: Release 19.0.0.0.0 - Production on Thu Dec 23 00:05:36 2021 Copyright (c) 1982, 2019, Oracle and/or its affiliates.  All rights reserved. Keyword     Description                    (Default) ---------------------------------------------------- TARGET      Username/Password              (NONE) DBNAME      New database name              (NONE) LOGFILE     Output Log                     (NONE) REVERT      Revert failed change           NO SETNAME     Set a new database name only   NO APPEND      Append to output log           NO HELP        Displays these messages    ...

ORA-01017/ORA-28000 with AUDIT_TRAIL

With default profile in Oracle 11g, accounts are automatically locked 1 day ( PASSWORD_LOCK_TIME ) after 10 failed login attempt ( FAILED_LOGIN_ATTEMPTS ): SQL > SET lines 200 SQL > SET pages 200 SQL > SELECT * FROM dba_profiles WHERE PROFILE = 'DEFAULT' ORDER BY resource_name; PROFILE                         RESOURCE_NAME                      RESOURCE LIMIT ------------------------------ -------------------------------- -------- ---------------------------------------- DEFAULT                         COMPOSITE_LIMIT                 ...