• Share
  • Email
  • Embed
  • Like
  • Save
  • Private Content
Configuring Advanced Replication
 

Configuring Advanced Replication

on

  • 390 views

 

Statistics

Views

Total Views
390
Views on SlideShare
390
Embed Views
0

Actions

Likes
0
Downloads
11
Comments
0

0 Embeds 0

No embeds

Accessibility

Categories

Upload Details

Uploaded via SlideShare as Microsoft PowerPoint

Usage Rights

© All Rights Reserved

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
  • Comment goes here.
    Are you sure you want to
    Your message goes here
    Processing…
Post Comment
Edit your comment

    Configuring Advanced Replication Configuring Advanced Replication Presentation Transcript

    • Configuring Advanced Replication Julian Dyke Independent Consultant Web Version - July 2009 juliandyke.com © 2009 Julian Dyke
    • 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
    • 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
    • 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; /
    • 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.
    • 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.
    • 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
    • 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)) )
    • 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;
    • 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
    • Advanced Replication Replication Group
      • In DB1 only as REPADMIN
        • Create a replication group called REPGROUP1
      BEGIN dbms_repcat.create_master_repgroup (gname => 'REPGROUP1'); END; /
    • 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; /
    • 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';
    • 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; /
    • Advanced Replication Start Replication
      • In DB1 only as REPADMIN
        • Resume replication for REPGROUP1
      BEGIN dbms_repcat.resume_master_activity (gname => 'REPGROUP1'); END; /
    • Thank you for your interest