Your SlideShare is downloading. ×
0
Configuring Advanced Replication
Configuring Advanced Replication
Configuring Advanced Replication
Configuring Advanced Replication
Configuring Advanced Replication
Configuring Advanced Replication
Configuring Advanced Replication
Configuring Advanced Replication
Configuring Advanced Replication
Configuring Advanced Replication
Configuring Advanced Replication
Configuring Advanced Replication
Configuring Advanced Replication
Configuring Advanced Replication
Configuring Advanced Replication
Configuring Advanced Replication
Upcoming SlideShare
Loading in...5
×

Thanks for flagging this SlideShare!

Oops! An error has occurred.

×
Saving this for later? Get the SlideShare app to save on your phone or tablet. Read anywhere, anytime – even offline.
Text the download link to your phone
Standard text messaging rates apply

Configuring Advanced Replication

254

Published on

0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total Views
254
On Slideshare
0
From Embeds
0
Number of Embeds
0
Actions
Shares
0
Downloads
11
Comments
0
Likes
0
Embeds 0
No embeds

Report content
Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
No notes for slide

Transcript

  • 1. Configuring Advanced Replication Julian Dyke Independent Consultant Web Version - July 2009 juliandyke.com © 2009 Julian Dyke
  • 2. Introduction <ul><li>This presentation describes a basic Advanced Replication multi-master configuration </li></ul><ul><li>The configuration is between two databases DB1 and DB2 running on servers node1 and node2 respectively </li></ul><ul><li>One table called TEAM from the GP schema is replicated </li></ul><ul><li>The sample configuration was developed in Oracle 10.2.0.4 on Linux 32-bit </li></ul>
  • 3. Advanced Replication Replicated Objects <ul><li>Create a user </li></ul>CREATE USER gp IDENTIFIED BY gp; GRANT DBA TO gp; <ul><li>As the GP user create and populate a table to be replicated </li></ul>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 (&apos;MCL&apos;,&apos;McLaren&apos;,&apos;GBR&apos;); INSERT INTO team VALUES (&apos;FER&apos;,&apos;Ferrari&apos;,&apos;FER&apos;); COMMIT; <ul><li>Note - table MUST have primary key constraint </li></ul>
  • 4. Advanced Replication Replication Administrator <ul><li>On each node as SYS (SYSDBA) </li></ul><ul><ul><li>create a user called REPADMIN </li></ul></ul>CREATE USER repadmin IDENTIFIED BY repadmin; <ul><ul><li>grant privileges to REPADMIN to create and manage the replicated environment </li></ul></ul>BEGIN dbms_repcat_admin.grant_admin_any_schema (username=&gt; &apos;REPADMIN&apos;); END; /
  • 5. Advanced Replication Register Propagator <ul><li>On each node as SYS (SYSDBA) </li></ul><ul><ul><li>register REPADMIN as a propagator </li></ul></ul>BEGIN dbms_defer_sys.register_propagator (username =&gt; &apos;REPADMIN&apos;); END; / <ul><li>The propagator is responsible for propagating the deferred transaction queue to other master sites. </li></ul>
  • 6. Advanced Replication Register Receiver <ul><li>On each node as SYS (SYSDBA) </li></ul><ul><ul><li>register REPADMIN as a receiver </li></ul></ul>BEGIN dbms_repcat_admin.register_user_repgroup ( username =&gt; &apos;REPADMIN&apos;, privilege_type =&gt; &apos;RECEIVER&apos;, list_of_gnames =&gt; NULL ); END; / <ul><li>The receiver receives the propagated deferred transactions sent by the propagator from other master sites. </li></ul>
  • 7. Advanced Replication Schedule Purge <ul><li>On each node as REPADMIN </li></ul><ul><ul><li>schedule an hourly purge of the deferred transactions queue </li></ul></ul>BEGIN dbms_defer_sys.schedule_purge ( next_date =&gt; SYSDATE, interval =&gt; &apos;SYSDATE + 1/24&apos;, delay_seconds =&gt; 0 ); END; / <ul><li>Successfully completed deferred transactions should be purged to reduce the size of the deferred transactions queue </li></ul>
  • 8. Advanced Replication Configure Network <ul><li>On each node add network services to </li></ul><ul><ul><li>$ORACLE_HOME/network/admin/tnsnames.ora </li></ul></ul>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. Advanced Replication Database Links <ul><li>In DB1 </li></ul><ul><ul><li>As SYS (SYSDBA) create public database link e.g. </li></ul></ul>CREATE PUBLIC DATABASE LINK db2.juliandyke.com USING &apos;db2.juliandyke.com&apos;; <ul><ul><li>As REPADMIN create private database link e.g. </li></ul></ul>CREATE DATABASE LINK db2.juliandyke.com CONNECT TO repadmin IDENTIFIED BY repadmin; <ul><li>In DB2 </li></ul><ul><ul><li>As SYS (SYSDBA) create public database link e.g. </li></ul></ul>CREATE PUBLIC DATABASE LINK db1.juliandyke.com USING &apos;db1.juliandyke.com&apos;; <ul><ul><li>As REPADMIN create private database link e.g. </li></ul></ul>CREATE DATABASE LINK db1.juliandyke.com CONNECT TO repadmin IDENTIFIED BY repadmin;
  • 10. Advanced Replication Scheduled Links <ul><li>In each database as REPADMIN </li></ul><ul><ul><li>Define a schedule for each database link </li></ul></ul><ul><ul><li>e.g. in DB1 </li></ul></ul>BEGIN dbms_defer_sys.schedule_push ( destination =&gt; &apos;db2.juliandyke.com&apos;, interval =&gt; &apos;SYSDATE + (1/144)&apos;, next_date =&gt; SYSDATE, parallelism =&gt; 1, execution_seconds =&gt; 1500, delay_seconds =&gt; 120 ); END; / <ul><li>In DB2 set the destination to db1.juliandyke.com </li></ul>
  • 11. Advanced Replication Replication Group <ul><li>In DB1 only as REPADMIN </li></ul><ul><ul><li>Create a replication group called REPGROUP1 </li></ul></ul>BEGIN dbms_repcat.create_master_repgroup (gname =&gt; &apos;REPGROUP1&apos;); END; /
  • 12. Advanced Replication Replication Objects <ul><li>In DB1 only as REPADMIN </li></ul><ul><ul><li>Create a replication object for GP.TEAM table </li></ul></ul>BEGIN dbms_repcat.create_master_repobject ( gname =&gt; &apos;REPGROUP1&apos;, type =&gt; &apos;TABLE&apos;, sname =&gt; &apos;GP&apos;, oname =&gt; &apos;TEAM&apos;, use_existing_object =&gt; TRUE, copy_rows =&gt; TRUE ); END; /
  • 13. Advanced Replication Add Master Databases <ul><li>In DB1 only as REPADMIN </li></ul><ul><ul><li>Add DB2 as a second master database in REPGROUP1 </li></ul></ul>BEGIN dbms_repcat.add_master_database ( gname =&gt; &apos;REPGROUP1&apos;, master =&gt; &apos;db2.juliandyke.com&apos;, use_existing_objects =&gt; TRUE, copy_rows =&gt; TRUE, propagation_mode =&gt; &apos;ASYNCHRONOUS&apos; ); END; / <ul><li>Check new master has been added using: </li></ul>SELECT dblink FROM dba_repsites WHERE gname = &apos;REPGROUP1&apos;;
  • 14. Advanced Replication Generate Replication Support <ul><li>In DB1 only as REPADMIN </li></ul><ul><ul><li>Generate replication support for GP.TEAM </li></ul></ul>BEGIN dbms_repcat.generate_replication_support ( sname =&gt; &apos;GP&apos;, oname =&gt; &apos;TEAM&apos;, type =&gt; &apos;TABLE&apos;, min_communication =&gt; TRUE ); END; /
  • 15. Advanced Replication Start Replication <ul><li>In DB1 only as REPADMIN </li></ul><ul><ul><li>Resume replication for REPGROUP1 </li></ul></ul>BEGIN dbms_repcat.resume_master_activity (gname =&gt; &apos;REPGROUP1&apos;); END; /
  • 16. Thank you for your interest

×