Presentation is loading. Please wait.

Presentation is loading. Please wait.

1 Configuring Advanced Replication Julian Dyke Independent Consultant Web Version - July 2009 juliandyke.com © 2009 Julian Dyke.

Similar presentations


Presentation on theme: "1 Configuring Advanced Replication Julian Dyke Independent Consultant Web Version - July 2009 juliandyke.com © 2009 Julian Dyke."— Presentation transcript:

1 1 Configuring Advanced Replication Julian Dyke Independent Consultant Web Version - July 2009 juliandyke.com © 2009 Julian Dyke

2 juliandyke.com © 2009 Julian Dyke 2 Introduction  This presentation describes a basic Advanced Replication multi-master configuration  The configuration is between two databases DB1 and DB2 running on servers node1 and node2 respectively  One table called TEAM from the GP schema is replicated  The sample configuration was developed in Oracle 10.2.0.4 on Linux 32-bit

3 juliandyke.com © 2009 Julian Dyke 3 Advanced Replication Replicated Objects  Create a user CREATE USER gp IDENTIFIED BY gp; GRANT DBA TO gp;  As the GP user create and populate a table to be replicated CREATE TABLE team ( team_code VARCHAR2(3), team_name VARCHAR2(30), country_code VARCHAR2(3) ); ALTER TABLE team ADD CONSTRAINT team_pk PRIMARY KEY (team_code); INSERT INTO team VALUES ('MCL','McLaren','GBR'); INSERT INTO team VALUES ('FER','Ferrari','FER'); COMMIT;  Note - table MUST have primary key constraint

4 juliandyke.com © 2009 Julian Dyke 4 Advanced Replication Replication Administrator  On each node as SYS (SYSDBA)  create a user called REPADMIN CREATE USER repadmin IDENTIFIED BY repadmin;  grant privileges to REPADMIN to create and manage the replicated environment BEGIN dbms_repcat_admin.grant_admin_any_schema (username=> 'REPADMIN'); END; /

5 juliandyke.com © 2009 Julian Dyke 5 Advanced Replication Register Propagator  On each node as SYS (SYSDBA)  register REPADMIN as a propagator BEGIN dbms_defer_sys.register_propagator (username => 'REPADMIN'); END; /  The propagator is responsible for propagating the deferred transaction queue to other master sites.

6 juliandyke.com © 2009 Julian Dyke 6 Advanced Replication Register Receiver  On each node as SYS (SYSDBA)  register REPADMIN as a receiver BEGIN dbms_repcat_admin.register_user_repgroup ( username => 'REPADMIN', privilege_type => 'RECEIVER', list_of_gnames => NULL ); END; /  The receiver receives the propagated deferred transactions sent by the propagator from other master sites.

7 juliandyke.com © 2009 Julian Dyke 7 Advanced Replication Schedule Purge  On each node as REPADMIN  schedule an hourly purge of the deferred transactions queue BEGIN dbms_defer_sys.schedule_purge ( next_date => SYSDATE, interval => 'SYSDATE + 1/24', delay_seconds => 0 ); END; /  Successfully completed deferred transactions should be purged to reduce the size of the deferred transactions queue

8 juliandyke.com © 2009 Julian Dyke 8 Advanced Replication Configure Network  On each node add network services to  $ORACLE_HOME/network/admin/tnsnames.ora DB1.JULIANDYKE.COM= (DESCRIPTION= (ADDRESS= (PROTOCOL=TCP)(HOST=node1)(PORT=1521)) (CONNECT_DATA = (SID=DB1)) ) DB2.JULIANDYKE.COM= (DESCRIPTION= (ADDRESS= (PROTOCOL=TCP)(HOST=node2)(PORT=1521)) (CONNECT_DATA = (SID=DB2)) )

9 juliandyke.com © 2009 Julian Dyke 9 Advanced Replication Database Links  In DB1  As SYS (SYSDBA) create public database link e.g. CREATE PUBLIC DATABASE LINK db2.juliandyke.com USING 'db2.juliandyke.com';  As REPADMIN create private database link e.g. CREATE DATABASE LINK db2.juliandyke.com CONNECT TO repadmin IDENTIFIED BY repadmin;  In DB2  As SYS (SYSDBA) create public database link e.g. CREATE PUBLIC DATABASE LINK db1.juliandyke.com USING 'db1.juliandyke.com';  As REPADMIN create private database link e.g. CREATE DATABASE LINK db1.juliandyke.com CONNECT TO repadmin IDENTIFIED BY repadmin;

10 juliandyke.com © 2009 Julian Dyke 10 Advanced Replication Scheduled Links  In each database as REPADMIN  Define a schedule for each database link  e.g. in DB1 BEGIN dbms_defer_sys.schedule_push ( destination => 'db2.juliandyke.com', interval => 'SYSDATE + (1/144)', next_date => SYSDATE, parallelism => 1, execution_seconds => 1500, delay_seconds => 120 ); END; /  In DB2 set the destination to db1.juliandyke.com

11 juliandyke.com © 2009 Julian Dyke 11 Advanced Replication Replication Group  In DB1 only as REPADMIN  Create a replication group called REPGROUP1 BEGIN dbms_repcat.create_master_repgroup (gname => 'REPGROUP1'); END; /

12 juliandyke.com © 2009 Julian Dyke 12 Advanced Replication Replication Objects  In DB1 only as REPADMIN  Create a replication object for GP.TEAM table BEGIN dbms_repcat.create_master_repobject ( gname => 'REPGROUP1', type => 'TABLE', sname => 'GP', oname => 'TEAM', use_existing_object => TRUE, copy_rows => TRUE ); END; /

13 juliandyke.com © 2009 Julian Dyke 13 Advanced Replication Add Master Databases  In DB1 only as REPADMIN  Add DB2 as a second master database in REPGROUP1 BEGIN dbms_repcat.add_master_database ( gname => 'REPGROUP1', master => 'db2.juliandyke.com', use_existing_objects => TRUE, copy_rows => TRUE, propagation_mode => 'ASYNCHRONOUS' ); END; /  Check new master has been added using: SELECT dblink FROM dba_repsites WHERE gname = 'REPGROUP1';

14 juliandyke.com © 2009 Julian Dyke 14 Advanced Replication Generate Replication Support  In DB1 only as REPADMIN  Generate replication support for GP.TEAM BEGIN dbms_repcat.generate_replication_support ( sname => 'GP', oname => 'TEAM', type => 'TABLE', min_communication => TRUE ); END; /

15 juliandyke.com © 2009 Julian Dyke 15 Advanced Replication Start Replication  In DB1 only as REPADMIN  Resume replication for REPGROUP1 BEGIN dbms_repcat.resume_master_activity (gname => 'REPGROUP1'); END; /

16 juliandyke.com © 2009 Julian Dyke 16 Thank you for your interest


Download ppt "1 Configuring Advanced Replication Julian Dyke Independent Consultant Web Version - July 2009 juliandyke.com © 2009 Julian Dyke."

Similar presentations


Ads by Google