Edit D:\app\Administrator\product\11.2.0\dbhome_1\oc4j\j2ee\oc4j_applications\applications\em\em\online_help\tdpii\tdpii_repcont024.htm
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> <head> <meta http-equiv="Content-Type" content="text/html; charset=us-ascii" /> <meta http-equiv="Content-Style-Type" content="text/css" /> <meta http-equiv="Content-Script-Type" content="text/javascript" /> <title>Tutorial: Configuring Two-Database Replication with Synchronous Captures</title> <meta name="generator" content="Oracle DARB XHTML Converter (Mode = ohj/ohw) - Version 5.1.1 Build 005" /> <meta name="date" content="2009-06-04T17:1:2Z" /> <meta name="robots" content="noarchive" /> <meta name="doctitle" content="Tutorial: Configuring Two-Database Replication with Synchronous Captures" /> <meta name="relnum" content="11g Release 2 (11.2)" /> <meta name="partnum" content="E10703-01" /> <link rel="copyright" href="./dcommon/html/cpyr.htm" title="Copyright" type="text/html" /> <link rel="stylesheet" href="./dcommon/css/blafdoc.css" title="Oracle BLAFDoc" type="text/css" /> <link rel="contents" href="toc.htm" title="Contents" type="text/html" /> <link rel="prev" href="tdpii_repcont023.htm" title="Previous" type="text/html" /> <link rel="next" href="tdpii_repcont025.htm" title="Next" type="text/html" /> <script src="./callback.js" type="text/javascript"></script> <noscript>Your browser does not support JavaScript. This help page requires JavaScript to render correctly.</noscript> </head> <body> <div class="zz-skip-header"><a href="#BEGIN">Skip Headers</a></div> <table class="simple oac_no_warn" summary="" cellspacing="0" cellpadding="0" width="100%"> <col width="86%" /> <col width="*" /> <tr valign="bottom"> <td align="left"></td> <td align="center"><a href="tdpii_repcont023.htm"><img src="./dcommon/gifs/leftnav.gif" alt="Previous" /><br /> <span class="icon">Previous</span></a> </td> <td align="center"><a href="tdpii_repcont025.htm"><img src="./dcommon/gifs/rightnav.gif" alt="Next" /><br /> <span class="icon">Next</span></a></td> </tr> </table> <p><a id="BABDEBBA" name="BABDEBBA"></a><a id="TDPII080" name="TDPII080"></a></p> <div class="sect2"><!-- infolevel="all" infotype="General" --> <h1>Tutorial: Configuring Two-Database Replication with Synchronous Captures<a id="sthref246" name="sthref246"></a><a id="sthref247" name="sthref247"></a><a id="sthref248" name="sthref248"></a><a id="sthref249" name="sthref249"></a><a id="sthref250" name="sthref250"></a><a id="sthref251" name="sthref251"></a><a id="sthref252" name="sthref252"></a></h1> <a name="BEGIN" id="BEGIN"></a> <p>The example in this topic configures an Oracle Streams replication environment that replicates data manipulation language (DML) changes to two tables in the <code>hr</code> schema. This example uses a synchronous capture at each database to capture these changes. In this example, the global names of the databases in the Oracle Streams replication environment are <code>sync1.example.com</code> and <code>sync2.example.com</code>. However, you can substitute any two databases in your environment to complete the example. See <a href="tdpii_repcont013.htm#CIHGHCGI">"About Two-Database Replication Environments"</a> for more information about two-database replication environments.</p> <p>Specifically, this example configures a two-database Oracle Streams replication environment that shares the <code>hr.employees</code> and <code>hr.departments</code> tables at the <code>sync1.example.com</code> and <code>sync2.example.com</code> databases. The two databases replicate all of the DML changes to these tables. The <code>hr</code> sample schema is installed by default with Oracle Database.</p> <div class="helpinfonote"> <p><span class="bold">Note: </span>A synchronous capture can only capture changes at the table level. It cannot capture changes at the schema or database level. You can configure a synchronous capture using the <a href="javascript:open('http://www.oracle.com/pls/db112/lookup?id=ARPLS308','newWindow').focus()"><code>ADD_TABLE_RULES</code></a> and <a href="javascript:open('http://www.oracle.com/pls/db112/lookup?id=ARPLS329','newWindow').focus()"><code>ADD_SUBSET_RULES</code></a> procedures in the <a href="javascript:open('http://www.oracle.com/pls/db112/lookup?id=ARPLS305','newWindow').focus()"><code>DBMS_STREAMS_ADM</code></a> package.</p> </div> <p><a href="#CIHHGJHC">Figure: Two-Database Replication Environment with Synchronous Captures</a> provides an overview of the environment created in this example.</p> <div class="figure"><a id="CIHHGJHC" name="CIHHGJHC"></a><a id="TDPII244" name="TDPII244"></a> <p class="titleinfigure">Two-Database Replication Environment with Synchronous Captures</p> <img src="img/tdpii505.gif" alt="Description of this figure follows" title="Description of this figure follows" longdesc="img_text/tdpii505.htm" /><br /> <a id="sthref253" name="sthref253" href="img_text/tdpii505.htm">Description of "Two-Database Replication Environment with Synchronous Captures"</a><br /> <br /></div> <!-- class="figure" --> <p class="orderedlisttitle">To configure this replication environment with synchronous captures: </p> <ol> <li> <p>Complete the following tasks to prepare for the two-database replication environment:</p> <ol> <li> <p>Configure network connectivity so that the two databases can communicate with each other. See <a href="topicid:ADMQS004">Configuring the Network Environment</a> for information about configuring network connectivity between databases.</p> </li> <li> <p>Configure an Oracle Streams administrator at each database that will participate in the replication environment. See <a href="tdpii_common_ii002.htm#BGBHDJHF">"Tutorial: Configuring an Oracle Streams Administrator"</a> for instructions. This example assumes that the Oracle Streams administrator is <code>strmadmin</code>.</p> </li> <li> <p>Set initialization parameters properly at each database that will participate in the Oracle Streams replication environment. See <a href="tdpii_repcont019.htm#BABDHIIH">"Preparing for Oracle Streams Replication"</a> for instructions.</p> </li> <li> <p>Ensure that the <code>hr.employees</code> and <code>hr.departments</code> tables exist at the two databases and are consistent at these databases. If the database objects exist at only one database, then you can use export/import to create and populate them at the other database. See <a href="javascript:open('http://www.oracle.com/pls/db112/lookup?id=SUTIL','newWindow').focus()"><span class="italic">Oracle Database Utilities</span></a> for information about export/import.</p> </li> </ol> </li> <li> <p>Create two <code>ANYDATA</code> queues at each database. For this example, create the following two queues at each database:</p> <ul> <li> <p>A queue named <code>capture_queue</code> owned by the Oracle Streams administrator <code>strmadmin</code>. This queue will be used by the synchronous capture at the database.</p> </li> <li> <p>A queue named <code>apply_queue</code> owned by the Oracle Streams administrator <code>strmadmin</code>. This queue will be used by the apply process at the database.</p> </li> </ul> <p>See <a href="tdpii_common_ii005.htm#CHDJHCAI">"Creating an ANYDATA Queue"</a> for instructions.</p> </li> <li><a id="CIHEIGAC" name="CIHEIGAC"></a> <p>Create a database link from each database to the other database:</p> <ol> <li> <p>Create a database link from the <code>sync1.example.com</code> database to the <code>sync2.example.com</code> database. The database link should be created in the Oracle Streams administrator's schema. Also, the database link should connect to the Oracle Streams administrator at the <code>sync2.example.com</code> database. Both the name and the service name of the database link must be <code>sync2.example.com</code>.</p> </li> <li> <p>Create a database link from the <code>sync2.example.com</code> database to the <code>sync1.example.com</code> database. The database link should be created in the Oracle Streams administrator's schema. Also, the database link should connect to the Oracle Streams administrator at the <code>sync1.example.com</code> database. Both the name and the service name of the database link must be <code>sync1.example.com</code>.</p> </li> </ol> <p>See <a href="tdpii_common_ii006.htm#BGBGIACD">"Tutorial: Creating a Database Link"</a> for instructions.</p> </li> <li> <p><a id="sthref255" name="sthref255"></a><a id="sthref256" name="sthref256"></a><a id="sthref257" name="sthref257"></a><a id="sthref258" name="sthref258"></a>Configure an apply process at the <code>sync1.example.com</code> database. This apply process will apply changes to the shared tables that were captured at the <code>sync2.example.com</code> database and propagated to the <code>sync1.example.com</code> database.</p> <ol> <li> <p>Open SQL*Plus and connect to the <code>sync1.example.com</code> database as the Oracle Streams administrator.</p> <p>See <a href="topicid:ADMQS0361">Starting SQL*Plus and Connecting to the Database</a> for more information about starting SQL*Plus.</p> </li> <li> <p>Create the apply process:</p> <pre xml:space="preserve" class="oac_no_warn"> BEGIN DBMS_APPLY_ADM.CREATE_APPLY( queue_name => 'strmadmin.apply_queue', apply_name => 'apply_emp_dep', apply_captured => FALSE); END; / </pre> <p>The <code>apply_captured</code> parameter is set to <code>FALSE</code> because the apply process applies changes in the persistent queue. These are changes that were captured by a synchronous capture. The <code>apply_captured</code> parameter should be set to <code>TRUE</code> only when the apply process applies changes captured by a capture process.</p> <p>Do not start the apply process.</p> </li> <li> <p>Add a rule to the apply process rule set:</p> <pre xml:space="preserve" class="oac_no_warn"> BEGIN DBMS_STREAMS_ADM.ADD_TABLE_RULES( table_name => 'hr.employees', streams_type => 'apply', streams_name => 'apply_emp_dep', queue_name => 'strmadmin.apply_queue', source_database => 'sync2.example.com'); END; / </pre> <p>This rule instructs the apply process <code>apply_emp_dep</code> to apply all DML changes to the <code>hr.employees</code> table that appear in the <code>apply_queue</code> queue. The rule also specifies that the apply process applies only changes that were captured at the <code>sync2.example.com</code> source database.</p> </li> <li> <p>Add an additional rule to the apply process rule set:</p> <pre xml:space="preserve" class="oac_no_warn"> BEGIN DBMS_STREAMS_ADM.ADD_TABLE_RULES( table_name => 'hr.departments', streams_type => 'apply', streams_name => 'apply_emp_dep', queue_name => 'strmadmin.apply_queue', source_database => 'sync2.example.com'); END; / </pre> <p>This rule instructs the apply process <code>apply_emp_dep</code> to apply all DML changes to the <code>hr.departments</code> table that appear in the <code>apply_queue</code> queue. The rule also specifies that the apply process applies only changes that were captured at the <code>sync2.example.com</code> source database.</p> </li> </ol> </li> <li> <p>Configure an apply process at the <code>sync2.example.com</code> database. This apply process will apply changes that were captured at the <code>sync1.example.com</code> database and propagated to the <code>sync2.example.com</code> database.</p> <ol> <li> <p>In SQL*Plus, connect to the <code>sync2.example.com</code> database as the Oracle Streams administrator.</p> <p>See <a href="javascript:open('http://www.oracle.com/pls/db112/lookup?id=ADMIN00102','newWindow').focus()"><span class="italic">Oracle Database Administrator's Guide</span></a> for information about connecting to a database in SQL*Plus.</p> </li> <li> <p>Create the apply process:</p> <pre xml:space="preserve" class="oac_no_warn"> BEGIN DBMS_APPLY_ADM.CREATE_APPLY( queue_name => 'strmadmin.apply_queue', apply_name => 'apply_emp_dep', apply_captured => FALSE); END; / </pre> <p>The <code>apply_captured</code> parameter is set to <code>FALSE</code> because the apply process applies changes in the persistent queue. These changes were captured by a synchronous capture. The <code>apply_captured</code> parameter should be set to <code>TRUE</code> only when the apply process applies changes captured by a capture process.</p> <p>Do not start the apply process.</p> </li> <li> <p>Add a rule to the apply process rule set:</p> <pre xml:space="preserve" class="oac_no_warn"> BEGIN DBMS_STREAMS_ADM.ADD_TABLE_RULES( table_name => 'hr.employees', streams_type => 'apply', streams_name => 'apply_emp_dep', queue_name => 'strmadmin.apply_queue', source_database => 'sync1.example.com'); END; / </pre> <p>This rule instructs the apply process <code>apply_emp_dep</code> to apply all DML changes that appear in the <code>apply_queue</code> queue to the <code>hr.employees</code> table. The rule also specifies that the apply process applies only changes that were captured at the <code>sync1.example.com</code> source database.</p> </li> <li> <p>Add an additional rule to the apply process rule set:</p> <pre xml:space="preserve" class="oac_no_warn"> BEGIN DBMS_STREAMS_ADM.ADD_TABLE_RULES( table_name => 'hr.departments', streams_type => 'apply', streams_name => 'apply_emp_dep', queue_name => 'strmadmin.apply_queue', source_database => 'sync1.example.com'); END; / </pre> <p>This rule instructs the apply process <code>apply_emp_dep</code> to apply all DML changes that appear in the <code>apply_queue</code> queue to the <code>hr.departments</code> table. The rule also specifies that the apply process applies only changes that were captured at the <code>sync1.example.com</code> source database.</p> </li> </ol> </li> <li> <p><a id="sthref259" name="sthref259"></a>Create a propagation to send changes from a queue at the <code>sync1.example.com</code> database to a queue at the <code>sync2.example.com</code> database:</p> <ol> <li> <p>In SQL*Plus, connect to the <code>sync1.example.com</code> database as the Oracle Streams administrator.</p> </li> <li> <p>Create the propagation that sends changes to the <code>sync2.example.com</code> database:</p> <pre xml:space="preserve" class="oac_no_warn"> BEGIN DBMS_STREAMS_ADM.ADD_TABLE_PROPAGATION_RULES( table_name => 'hr.employees', streams_name => 'send_emp_dep', source_queue_name => 'strmadmin.capture_queue', destination_queue_name => 'strmadmin.apply_queue@sync2.example.com', source_database => 'sync1.example.com', queue_to_queue => TRUE); END; / </pre> <p>The <code>ADD_TABLE_PROPAGATION_RULES</code> procedure creates the propagation and its positive rule set. This procedure also adds a rule to the propagation rule set that instructs it to send DML changes to the <code>hr.employees</code> table to the <code>apply_queue</code> queue in the <code>sync2.example.com</code> database.</p> </li> <li> <p>Add an additional rule to the propagation rule set:</p> <pre xml:space="preserve" class="oac_no_warn"> BEGIN DBMS_STREAMS_ADM.ADD_TABLE_PROPAGATION_RULES( table_name => 'hr.departments', streams_name => 'send_emp_dep', source_queue_name => 'strmadmin.capture_queue', destination_queue_name => 'strmadmin.apply_queue@sync2.example.com', source_database => 'sync1.example.com', queue_to_queue => TRUE); END; / </pre> <p>The <code>ADD_TABLE_PROPAGATION_RULES</code> procedure adds a rule to the propagation rule set that instructs it to send DML changes to the <code>hr.departments</code> table to the <code>apply_queue</code> queue in the <code>sync2.example.com</code> database.</p> </li> </ol> </li> <li> <p>Create a propagation to send changes from a queue at the <code>sync2.example.com</code> database to a queue at the <code>sync1.example.com</code> database:</p> <ol> <li> <p>In SQL*Plus, connect to the <code>sync2.example.com</code> database as the Oracle Streams administrator.</p> </li> <li> <p>Create the propagation that sends changes to the <code>sync1.example.com</code> database:</p> <pre xml:space="preserve" class="oac_no_warn"> BEGIN DBMS_STREAMS_ADM.ADD_TABLE_PROPAGATION_RULES( table_name => 'hr.employees', streams_name => 'send_emp_dep', source_queue_name => 'strmadmin.capture_queue', destination_queue_name => 'strmadmin.apply_queue@sync1.example.com', source_database => 'sync2.example.com', queue_to_queue => TRUE); END; / </pre> <p>The <code>ADD_TABLE_PROPAGATION_RULES</code> procedure creates the propagation and its positive rule set. This procedure also adds a rule to the propagation rule set that instructs it to send DML changes to the <code>hr.employees</code> table to the <code>apply_queue</code> queue in the <code>sync1.example.com</code> database.</p> </li> <li> <p>Add an additional rule to the propagation rule set:</p> <pre xml:space="preserve" class="oac_no_warn"> BEGIN DBMS_STREAMS_ADM.ADD_TABLE_PROPAGATION_RULES( table_name => 'hr.departments', streams_name => 'send_emp_dep', source_queue_name => 'strmadmin.capture_queue', destination_queue_name => 'strmadmin.apply_queue@sync1.example.com', source_database => 'sync2.example.com', queue_to_queue => TRUE); END; / </pre> <p>The <code>ADD_TABLE_PROPAGATION_RULES</code> procedure adds a rule to the propagation rule set that instructs it to send DML changes to the <code>hr.departments</code> table to the <code>apply_queue</code> queue in the <code>sync1.example.com</code> database.</p> </li> </ol> </li> <li><a id="CIHFIABB" name="CIHFIABB"></a> <p><a id="sthref260" name="sthref260"></a>Configure a synchronous capture at the <code>sync1.example.com</code> database:</p> <ol> <li> <p>In SQL*Plus, connect to the <code>sync1.example.com</code> database as the Oracle Streams administrator.</p> </li> <li> <p>Run the <code>ADD_TABLE_RULES</code> procedure to create the synchronous capture and add a rule to instruct it to capture changes to the <code>hr.employees</code> table:</p> <pre xml:space="preserve" class="oac_no_warn"> BEGIN DBMS_STREAMS_ADM.ADD_TABLE_RULES( table_name => 'hr.employees', streams_type => 'sync_capture', streams_name => 'sync_capture', queue_name => 'strmadmin.capture_queue'); END; / </pre></li> <li> <p>Add an additional rule to the synchronous capture rule set:</p> <pre xml:space="preserve" class="oac_no_warn"> BEGIN DBMS_STREAMS_ADM.ADD_TABLE_RULES( table_name => 'hr.departments', streams_type => 'sync_capture', streams_name => 'sync_capture', queue_name => 'strmadmin.capture_queue'); END; / </pre></li> </ol> <p>Running these procedures performs the following actions:</p> <ul> <li> <p>Creates a synchronous capture named <code>sync_capture</code> at the current database. A synchronous capture with the same name must not exist.</p> </li> <li> <p>Enables the synchronous capture. A synchronous capture cannot be disabled.</p> </li> <li> <p>Associates the synchronous capture with an existing queue named <code>capture_queue</code> owned by <code>strmadmin</code>.</p> </li> <li> <p>Creates a positive rule set for synchronous capture <code>sync_capture</code>. The rule set has a system-generated name.</p> </li> <li> <p>Creates a rule that captures DML changes to the <code>hr.employees</code> table and adds the rule to the positive rule set for the synchronous capture. The rule has a system-generated name.</p> </li> <li> <p>Prepares the <code>hr.employees</code> table for instantiation by running the <code>DBMS_CAPTURE_ADM.PREPARE_SYNC_INSTANTIATION</code> function for the table automatically.</p> </li> <li> <p>Creates a rule that captures DML changes to the <code>hr.departments</code> table and adds the rule to the positive rule set for the synchronous capture. The rule has a system-generated name.</p> </li> <li> <p>Prepares the <code>hr.departments</code> table for instantiation by running the <code>DBMS_CAPTURE_ADM.PREPARE_SYNC_INSTANTIATION</code> function for the table automatically.</p> </li> </ul> </li> <li> <p>Configure a synchronous capture at the <code>sync2.example.com</code> database:</p> <ol> <li> <p>In SQL*Plus, connect to the <code>sync2.example.com</code> database as the Oracle Streams administrator.</p> </li> <li> <p>Run the <code>ADD_TABLE_RULES</code> procedure to create the synchronous capture and add a rule to instruct it to capture changes to the <code>hr.employees</code> table:</p> <pre xml:space="preserve" class="oac_no_warn"> BEGIN DBMS_STREAMS_ADM.ADD_TABLE_RULES( table_name => 'hr.employees', streams_type => 'sync_capture', streams_name => 'sync_capture', queue_name => 'strmadmin.capture_queue'); END; / </pre></li> <li> <p>Add an additional rule to the synchronous capture rule set:</p> <pre xml:space="preserve" class="oac_no_warn"> BEGIN DBMS_STREAMS_ADM.ADD_TABLE_RULES( table_name => 'hr.departments', streams_type => 'sync_capture', streams_name => 'sync_capture', queue_name => 'strmadmin.capture_queue'); END; / </pre></li> </ol> <p>Step <a href="#CIHFIABB">8</a> describes the actions performed by these procedures at the current database.</p> </li> <li><a id="BEHGEJJI" name="BEHGEJJI"></a> <p>Set the instantiation SCN for the tables at the <code>sync2.example.com</code> database:</p> <ol> <li> <p>In SQL*Plus, connect to the <code>sync1.example.com</code> database as the Oracle Streams administrator.</p> </li> <li> <p><a id="sthref261" name="sthref261"></a><a id="sthref262" name="sthref262"></a>Set the instantiation SCN for the <code>hr.employees</code> table at the <code>sync2.example.com</code> database:</p> <pre xml:space="preserve" class="oac_no_warn"> DECLARE iscn NUMBER; -- Variable to hold instantiation SCN value BEGIN iscn := DBMS_FLASHBACK.GET_SYSTEM_CHANGE_NUMBER(); DBMS_APPLY_ADM.SET_TABLE_INSTANTIATION_SCN@sync2.example.com( source_object_name => 'hr.employees', source_database_name => 'sync1.example.com', instantiation_scn => iscn); END; / </pre></li> <li> <p>Set the instantiation SCN for the <code>hr.departments</code> table at the <code>sync2.example.com</code> database:</p> <pre xml:space="preserve" class="oac_no_warn"> DECLARE iscn NUMBER; -- Variable to hold instantiation SCN value BEGIN iscn := DBMS_FLASHBACK.GET_SYSTEM_CHANGE_NUMBER(); DBMS_APPLY_ADM.SET_TABLE_INSTANTIATION_SCN@sync2.example.com( source_object_name => 'hr.departments', source_database_name => 'sync1.example.com', instantiation_scn => iscn); END; / </pre></li> </ol> <p>An instantiation SCN is the lowest SCN for which an apply process can apply changes to a table. Before the apply process can apply changes to the shared tables at the <code>sync2.example.com</code> database, an instantiation SCN must be set for each table.</p> </li> <li> <p>Set the instantiation SCN for the tables at the <code>sync1.example.com</code> database:</p> <ol> <li> <p>In SQL*Plus, connect to the <code>sync2.example.com</code> database as the Oracle Streams administrator.</p> </li> <li> <p>Set the instantiation SCN for the <code>hr.employees</code> table at the <code>sync1.example.com</code> database:</p> <pre xml:space="preserve" class="oac_no_warn"> DECLARE iscn NUMBER; -- Variable to hold instantiation SCN value BEGIN iscn := DBMS_FLASHBACK.GET_SYSTEM_CHANGE_NUMBER(); DBMS_APPLY_ADM.SET_TABLE_INSTANTIATION_SCN@sync1.example.com( source_object_name => 'hr.employees', source_database_name => 'sync2.example.com', instantiation_scn => iscn); END; / </pre></li> <li> <p>Set the instantiation SCN for the <code>hr.departments</code> table at the <code>sync2.example.com</code> database:</p> <pre xml:space="preserve" class="oac_no_warn"> DECLARE iscn NUMBER; -- Variable to hold instantiation SCN value BEGIN iscn := DBMS_FLASHBACK.GET_SYSTEM_CHANGE_NUMBER(); DBMS_APPLY_ADM.SET_TABLE_INSTANTIATION_SCN@sync1.example.com( source_object_name => 'hr.departments', source_database_name => 'sync2.example.com', instantiation_scn => iscn); END; / </pre></li> </ol> </li> <li> <p><a id="sthref263" name="sthref263"></a>Start the apply process at each database:</p> <ol> <li> <p>In SQL*Plus, connect to the <code>sync1.example.com</code> database as the Oracle Streams administrator.</p> </li> <li> <p>Start the apply process:</p> <pre xml:space="preserve" class="oac_no_warn"> BEGIN DBMS_APPLY_ADM.START_APPLY( apply_name => 'apply_emp_dep'); END; / </pre></li> <li> <p>In SQL*Plus, connect to the <code>sync2.example.com</code> database as the Oracle Streams administrator.</p> </li> <li> <p>Start the apply process:</p> <pre xml:space="preserve" class="oac_no_warn"> BEGIN DBMS_APPLY_ADM.START_APPLY( apply_name => 'apply_emp_dep'); END; / </pre></li> </ol> <p>If you would rather start the apply processes using Enterprise Manager, then see <a href="tdpii_adcont007.htm#CHDIIAGC">"Starting and Stopping an Apply Process"</a> for instructions.</p> </li> <li> <p>Configure latest time conflict resolution for the <code>hr.departments</code> and <code>hr.employees</code> tables at the <code>sync1.example.com</code> and <code>sync2.example.com</code> databases. See <a href="tdpii_repcont025.htm#CIHIACBB">"Tutorial: Configuring Latest Time Conflict Resolution for a Table"</a> for instructions.</p> </li> </ol> <p>A two-database replication environment with the following characteristics is configured:</p> <ul> <li> <p>Each database has a synchronous capture named <code>sync_capture</code>. The synchronous capture captures all DML changes to the <code>hr.employees</code> <code>hr.departments</code> tables.</p> </li> <li> <p>Each database has a queue named <code>capture_queue</code>. This queue is for the synchronous capture at the database.</p> </li> <li> <p>Each database has an apply process named <code>apply_emp_dep</code>. The apply process applies all DML changes to the <code>hr.employees</code> table and <code>hr.departments</code> tables.</p> </li> <li> <p>Each database has a queue named <code>apply_queue</code>. This queue is for the apply process at the database.</p> </li> <li> <p>Each database has a propagation named <code>send_emp_dep</code>. The propagation sends changes from the <code>capture_queue</code> in the local database to the <code>apply_queue</code> in the other database. The propagation sends all DML changes to the <code>hr.employees</code> and <code>hr.departments</code> tables.</p> </li> <li> <p><a id="sthref264" name="sthref264"></a>Tags are used to avoid change cycling in the following way:</p> <ul> <li> <p>Each apply process uses the default apply tag. The default apply tag is the hexadecimal equivalent of <code>'00'</code> (double zero).</p> </li> <li> <p>Each synchronous capture only captures changes in a session with a <code>NULL</code> tag. Therefore, neither synchronous capture captures the changes that are being applied by the local apply process. The synchronous capture rules instruct the synchronous capture not to capture these changes.</p> </li> </ul> <p>See <a href="tdpii_repcont011.htm#BABICHGF">"About Tags for Avoiding Change Cycling"</a> for more information about how the replication environment avoids change cycling.</p> </li> </ul> <p class="orderedlisttitle">To check the Oracle Streams replication configuration: </p> <ol> <li> <p>At each database, complete the following steps to ensure that synchronous capture is configured:</p> <ol> <li> <p>Start SQL*Plus and connect to the database as the Oracle Streams administrator.</p> <p>See <a href="topicid:ADMQS0361">Starting SQL*Plus and Connecting to the Database</a> for more information about starting SQL*Plus.</p> </li> <li> <p>Query the <a href="javascript:open('http://www.oracle.com/pls/db112/lookup?id=REFRN20572','newWindow').focus()"><code>ALL_SYNC_CAPTURE</code></a> data dictionary view:</p> <pre xml:space="preserve" class="oac_no_warn"> SELECT CAPTURE_NAME FROM ALL_SYNC_CAPTURE; </pre> <p>Ensure that a synchronous capture named <code>sync_capture</code> exists at each database.</p> </li> </ol> </li> <li> <p>At each database, ensure that the propagation is enabled. To do so, follow the instructions in <a href="tdpii_adcont019.htm#CHDGEBHI">"Viewing Information About a Propagation"</a>, and check Status on the Propagation subpage.</p> </li> <li> <p>At each database, ensure that the apply process is enabled. To do so, follow the instructions in <a href="tdpii_adcont022.htm#CHDIGAED">"Viewing Information About an Apply Process"</a>, and check Status on the Apply subpage.</p> </li> </ol> <p class="orderedlisttitle">To replicate changes: </p> <ol> <li> <p>At one of the databases, make DML changes to the <code>hr.employees</code> table or <code>hr.departments</code> table.</p> </li> <li> <p>After some time has passed to allow for replication of the changes, use SQL*Plus to query the <code>hr.employees</code> or <code>hr.departments</code> table at the other database to view the changes.</p> </li> </ol> <div class="helpinfonotealso"> <h2>Related Topics</h2> <p><a href="tdpii_repcont004.htm#BABJJJDE">About Change Capture with a Synchronous Capture</a></p> <p><a href="tdpii_repcont014.htm#CIHJEIDB">About Hub-And-Spoke Replication Environments</a></p> <p><a href="tdpii_intro2ii004.htm#CFHJAAEA">When to Replicate Data with Oracle Streams</a></p> <p><a href="tdpii_adcont.htm#CHDHCDDJ">Administering an Oracle Streams Replication Environment</a></p> </div> </div> <!-- class="sect2" --> <!-- Start Footer --> <div class="footer"> <table class="simple oac_no_warn" summary="" cellspacing="0" cellpadding="0" width="100%"> <col width="86%" /> <col width="*" /> <tr> <td align="left"><span class="copyrightlogo">Copyright © 2007, 2009, Oracle and/or its affiliates. All rights reserved.</span><br /> <a href="./dcommon/html/cpyr.htm"><span class="copyrightlogo">Legal Notices</span></a></td> <td align="center"><a href="tdpii_repcont023.htm"><img src="./dcommon/gifs/leftnav.gif" alt="Previous" /><br /> <span class="icon">Previous</span></a> </td> <td align="center"><a href="tdpii_repcont025.htm"><img src="./dcommon/gifs/rightnav.gif" alt="Next" /><br /> <span class="icon">Next</span></a></td> </tr> </table> </div> <!-- class="footer" --> </body> </html>
Ms-Dos/Windows
Unix
Write backup
jsp File Browser version 1.2 by
www.vonloesch.de