Skip Headers

Oracle® Database Advanced Replication
10g Release 1 (10.1)
Part Number B10732-01
Go to Documenta
tion Home
Home
Go to Book List
Book List
Go to Table of Contents
Contents

Go to Index
Index
Go to Master Index
Master Index
Go to Feed
back page
Feedback

Go to previous page
Previous
Go to next page
Next
View PDF

6
Planning Your Replication Environment

Before you begin to plan your replication environment, it is important to understand the rep lication concepts and architecture described in the previous chapters of this book. After you understand replication concepts and arc hitecture, this chapter presents important considerations for planning a replication environment.

This chapter contains these topics:

Considerations for Replicated Tables

The following sections discuss considerations for tables you plan to use in a replication environment.

Primary Keys

If possible, each replicated table should have a primary key. Where a primary key is not possible, each replicate d table must have a set of columns that can be used as a unique identifier for each row of the table. If the tables that you plan to use in your replication environment do not have a primary key or a set of unique columns, then alter these tables accordingly. In add ition, if you plan to create any primary key materialized views based on a master table or master materialized view, then that master must have a primary key.

Foreign Keys

When replicating tables with foreign key ref erential constraints, Oracle Corporation recommends that you always index foreign key columns and replicate these indexes, unless no updates and deletes are allowed in the parent table. Indexes are not replicated automatically. To replicate an index, add it to the m aster group containing its table using either the Replication Management tool or the CREATE_MASTER_REPOBJECT procedure i n the DBMS_REPCAT package.

Datatype Considerations

Advanced Replicatio n supports the replication of tables and materialized views with columns that use the following datatypes:

  • VARCHAR2
  • NVARCHAR2
  • NUMBER
  • DATE
  • TIMESTAMP
  • TIMESTAMP WITH TIME ZONE
  • TIMESTAMP LOCAL TIME ZONE
  • INTERVAL YEAR TO MONTH
  • INTERVAL DAY TO SECOND
  • RAW
  • ROWID
  • CHAR
  • NCHAR
  • < a name="22286">User-defined datatypes

Oracle also supports the replication of table s and materialized views with columns that use the following large object types:

  • Binary LOB (BLOB)
  • Character LOB (CLOB )
  • National character LOB (NCLOB)

The deferred and synchronous remote procedure call mechanism used for multimaster replication propagates only the piece-w ise changes to the supported LOB datatypes when piece-wise updates and appends are applied to these LOB columns. Also, you cannot ref erence LOB columns in a WHERE clause of a materialized view's defining query.

Yo u can replicate tables and materialized views that use user-defined types, including column objects, object tables, REFs , varrays, and nested tables.

Oracle does not support the replication of columns that use the LONG and LONG RAW datatypes. Oracle simply omits columns containing these datatypes from repl icated tables. You should convert LONG datatypes to LOBs.

Oracle also does not s upport the replication of external or file-based LOBs (BFILEs). Attempts to configure tables containing columns of this datatype as master tables return an error message.

Oracle also does not support the replicati on of UROWID columns in master tables or updatable materialized views. However, UROWID columns are allowed in read-only materialized views.

See Als o:
< !--TOC=h2-"20110"-->

Row-Level Dependency Tracking

When you create a table, you can specify the following options for tracking sys tem change numbers (SCN)s:

  • NOROWDEPENDENCIES, the d efault, specifies that the SCN is tracked at the data block level.
  • ROWDEPE NDENCIES specifies that the SCN is tracked for each row in the table.

Using the ROWDEPENDENCIES option improves performance and scalability when using parallel propagation, but this option also requir es six bytes of additional storage space for each row.

The following SQL statement creates a table with the ROWDEPENDENCIES option:

CREATE TABLE order_items 
  (order_id          NUMBER(12), 
  line_item_id       NUMBER(3)  NOT NULL, 
  product_i
d         NUMBER(6)  NOT NULL, 
  unit_price         NUMBER(8,2), 
  quantity           NUMBE
R(8)
  ) ROWDEPENDENCIES;

Oracle tracks the SCN f or each row in this order_items table. You can also use the ROWDEPENDENCIES option in a CREATE CLUSTER statement if your tables are part of a cluster.

See Also:

"Data Propag ation Dependency Maintenance" for more information about the ROWDEPENDENCIES option

Initialization Parameters

Table 6-1 lists initialization parameters that are important for the operation, reliability, and performa nce of a replication environment. This table specifies whether each parameter is modifiable. A modifiable initialization parameter ca n be modified using the ALTER SESSION or ALTER SYSTEM statement while an instance is running.

Table 6-1 Initialization Parameters Important for Advanced Replication  
Parameter Values Description Recommendation
GLOBAL_NAMES

Default: false

Range: true or false

Modifiable?: Yes

Specifies whether a datab ase link is required to have the same name as the database to which it connects.

GLOBAL_NAMES must be set to true at each database that is participating in your replication env ironment, including both master sites and materialized view sites.

JOB_QUEUE_PROCESSES

Default: 0

Range: 0 to 1000

Modifiable?: Yes

Specifies the number of Jn job queue processes for each instance (J000 . .. J999). Job queue processes handle requests created by DBMS_JOB.

When JOB_QUEUE_PROCESSES is set to 0 at a site, you must apply administrative requests manually for a ll groups at the site, and you must manually push and purge the deferred transaction queue.

This parameter should be set to at least 1, and should be set to the same value as the maximum number of jobs that can run simultaneously plus one.

OPEN_LINKS

Default: 4

Range: 0 to 255

Modifiable?: No

Specifies the maximum number of concurrent open connections to remote databases in one session. These connections include the schema objects called databas e links, as well as external procedures and cartridges, each of which uses a separate process.

If you are using synchronous replication, OPEN_LINKS must be set to at le ast the number of master sites. For example, an environment with five master sites requires that OPEN_LINKS be set to at least 5.

PARALLEL_MAX_SERVERS

Default: Derived from the values of the following paramete rs:

CPU_COUNT

PARALLEL_AUTOMATIC_TUN ING

PARALLEL_ADAPTIVE_MULTI_USER

Range: 0 to 3599

Mo difiable?: Yes

Specifies the maximum number of parallel exec ution processes and parallel recovery processes for an instance. As demand increases, Oracle will increase the number of processes fr om the number created at instance startup up to this value.

If you us e parallel propagation, then make sure the value of this parameter is set high enough to support it.

PARALLEL_MIN_SERVERS

Default: 0

Range: 0 to value of PARALLEL_MAX_SERVERS

Modifiable?: Yes

Specifies the minimum number of parallel execution proc esses for the instance. This value is the number of parallel execution processes Oracle creates when the instance is started.

If you use parallel propagation, then make sure you have at least one proces s for each stream.


PROCESSES

Default: Derived from PARALLEL_MAX_SERVERS

Range: 6 to operating system dependent limit

Modifiable?: No

Specifies the maximum number of operating system user processes that can simultaneously connect to Oracle.

Make sure the value of this parameter allows for all background processes, such as locks, job queue processes, and parallel execution processes.

R
EPLICATION_DEPENDENCY_TRACKING

Default: true

Range: true or fals e

Modifiable?: No

Enables or disables dependency tracking for read/write operations to the database. Dependency tracking is es sential for propagating changes in a replication environment in parallel.

true: e nables dependency tracking.

false: allows read/write operations to the database t o run faster, but does not produce dependency information for Oracle to perform parallel propagation.

Typically, specify true. Do not specify false unless you are sure that you r application will perform no read/write operations to the replicated tables.

SHARED_POOL_SIZE

Def ault:

32-bit platforms: 32 MB, rounded up to the nearest gr anule size

64-bit platforms: 84 MB, rounded up to the nearest granul e size

Range: The granule size to operating system-dependent lim it

Modifiable?: Yes

Specifies in bytes the size of the shared pool. The shared pool contains shared cursors, sto red procedures, control structures, and other structures. Larger values improve performance in multiuser systems. Smaller values use less memory.

Typically, the shared pool should be larger for an Oracl e server in a replication environment than in a non-replication environment.

You can monitor u tilization of the shared pool by querying the view V$SGASTAT.

See Also:

Oracle Database Reference for more information abo ut these initialization parameters

Master Sites and Materialized View Sites

When you are planning your replication environment, you need to decide whether the sites participating in the replic ation environment will be master sites or materialized view sites. Consider the characteristics and advantages of both types of repli cation sites when you are deciding whether a particular site in your replication environment should be a master site or a materialize d view site. One replication environment can support both master sites and materialized view sites.

Table 6-2 Characteristics of M aster Sites and Materialized View Sites
Master Sites Materialized View Sites

Typically communicate with a small number of other master sites, and may communicate with a large n umber of materialized view sites

Communicate with one master site or one master materialized view site

Contain large amounts of data that are full copies of the other master sites' data

Contain small amounts of data that can be subsets of the master site's or master materialized view site 's data

Typically communicate continuously with short intervals between data propagation

Communicate periodically with longer intervals between bulk data transfers

Advantages of Master Sites

Master sites have the following advantages:

  • Support for highly available data access by remote sites
  • Provide better support for frequent data manipulation language (DML) changes because changes are propagated automatically and, ty pically, at short intervals
  • Allow simultaneous DML changes and data propagation without locking tables
  • Can provide failover protection

To set up a master site, use either the Replication Management tool's Setup Wizard or the replication management API.

See Also:

Advantages of Materialized View Sites

Materialized view sites have the following advantages:

  • Support disconnected computing
  • Can co ntain a subset of its master site's or master materialized view site's data

To set up a materialized view site, you can use either the Replication Management tool's Setup Wizard or the replication management API.

See Also:

Preparing for Materialized Views

Most problems encounter ed with materialized view replication result from not preparing the environment properly. There are four essential tasks that you mus t perform before you begin creating your materialized view environment:

The Replication Management tool's Setup Wizard aut omatically performs these tasks. The following discussion is provided to help you understand the replication environment and to help those who use the replication management API. After running Setup Wizard, create the necessary materialized view logs. See the Replic ation Management tool's online help for instructions on using tool to set up your materialized view site.

< div align="center">
See Also:

"Creating a Materialized View Log"

If you are not able to use the Replication Management tool, then review the "Set Up Materialized View Sites" section in Chapter 2 of the O racle Database Advanced Replication Management API Reference for detailed instructions on setting up your materialized view site using the replication management API.

The following sections describe what the Replicati on Management tool's Setup Wizard or the script in the Oracle Database Advanced Replication Management API Reference does to set up your materialized view site.

Create Materialized View Site Users

Each materialized view site needs severa l users to perform the administrative and refreshing activities at the materialized view site. You must create and grant the necessar y privileges to the materialized view administrator and to the refresher.

Create Master Site Users

You need equivalent proxy users at the target master site to perform tasks on behalf of the materialized view site us ers. Usually, a proxy materialized view administrator and a proxy refresher are created.

A schema containing a materialized view in a remote database must correspond to the sc hema that contains the master table in the master database. Therefore, identify the schemas that contain the master tables that you w ant to replicate with materialized views. After you have identified the target schemas at the master database, create the correspondi ng accounts with the same names at the remote database. For example, if all master tables are in the sales schema of the ny.world database, then create a corresponding sales schema in the materialized view database sf.wor ld.

See Also:

If you are reviewing the steps in Oracle Database Advanced Replication Management API Reference, then the necessary schem as are created as part of the script described in the instructions for creating a materialized view group

Create Database Links

The defining query of a materialized view may use one or more da tabase links to reference remote table data. Before creating materialized views, the database links you plan to use must be available . Furthermore, the account that a database link uses to access a remote database defines the security context under which Oracle crea tes and subsequently refreshes a materialized view.

To ensure proper behavior, a materialized view's defining query must use a database link that includes an embedded user name and password in its definition; you cannot use a public database link when creating a materialized view. A database link with an embedded name and password always establishes connect ions to the remote database using the specified account. Additionally, the remote account that the link uses must have the SELE CT privileges necessary to access the data referenced in the materialized view's defining query.

Before creating your materialized views, you need to create several administrative database links. Specifically, you shoul d create a PUBLIC database link from the materialized view site to the master site. Doing so makes defining your private database links easier because you do not need to include the USING clause in each link. You also need private database links from the materialized view administrator to the proxy administrator and from the propagator to the receiver, but, if you use th e Replication Management tool's Setup Wizard, then these database links are created for you automatically.

See Also:

The information about security options in Oracle Database Advanced Replication Management API Reference for more information

After the administrative database links have been created, a private database link must be created conne cting each replicated materialized view schema at the materialized view database to the corresponding schema at the master database. Be sure to embed the associated master database account information in each private database link at the materialized view database. For example, the hr schema at a materialized view database should have a private database link to the master database th at connects using the hr username and password.

Figure 6-1 Recommended Schema and Database Link Configuration

Text description of repln056.gif follows

Text description of the illustration repln05 6.gif

For multimaster replication, there must be no Virtual Private Database (VPD) restri ctions on the replication propagator and receiver schemas. For materialized views, the defining query for the materialized view may n ot be modified by VPD. VPD must return a NULL policy for the schema that performs both the create and refresh of the mat erialized view. Creating a remote materialized view with a non-NULL VPD policy will not generate an error but may yield incorrect results.

See Also: < /td>

Assign Privileges

Both the creator and the owner of the materia lized view must be able to issue the defining SELECT statement of the materialized view. The owner is the schema that co ntains the materialized view. If a user other than the replication or materialized view administrator creates the materialized view, then that user must have the CREATE MATERIALIZED VIEW privilege and the appropriate SELE CT privileges to execute the defining SELECT statement.

See Also:

If you are reviewing the steps in < em class="Variable">Oracle Database Advanced Replic ation Management API Reference, then the necessary privileges are granted as part of the script described in instructions fo r creating a materialized view group. Privilege requirements are also described in "Required Privileges for Materialized View Operations"

Schedule Purge at Master Site

To keep the size of the deferred transaction queues in check, schedule a purge operation to remove all successfully completed deferred transactions from the deferred transaction queue. This operation may have already been pe rformed at the master site. Scheduling the purge operation again does not harm the master site, but may change the purge scheduling c haracteristics.

Schedule Push

Scheduling a push at the materialized view site autom atically propagates the deferred transactions at the materialized view site to the associated target master site using a database lin k. These types of database links are called scheduled links. Typically, there is only a single scheduled link for each materialized v iew group at a materialized view site, because a materialized view group only has a single target master site.

Allocate Job Queue Processes

It is important that you have allocated sufficient job queue processes to ha ndle the automation of your replication environment. The job queue processes automatically propagate the deferred transaction queue, purge the deferred transaction queue, refresh materialized views, and so on.

For multimaster replication, each site has a scheduled link to each of the other master sites. For example, if you have six master sites, then each s ite has scheduled links to the other five sites. You typically need one process for each scheduled link. You may also want to add add itional job processes for purging the deferred transaction queue and other user-defined jobs.

By the nature of materialized view replication, each materialized view site typically has one scheduled link to the master database and requires at least one job process. Materialized view sites typically require between one and three job processes, depending on pu rge scheduling, user-defined jobs, and the scheduled link. Also, you need at least one job queue process for each degree of paralleli sm.

Alternatively, if your users are responsible for manually refreshing the materialized vie w through an application interface, then you do not need to create a scheduled link and your materialized view site requires one less job process.

The job queue processes are defined using the JOB_QUEUE_PROCESSES initialization parameter in the initialization parameter file for your database. This initialization parameter is modifiable. Therefo re, you can modify it while an instance is running. You can set up your job queue processes in any of the following ways:

Oracle automatically determines the interval for job queue processes. That is, Oracle determines when th e job queue processes should "wake up" to execute jobs.

See Also:

"Initialization Parameters" and the Oracle Database Reference for information about JOB_QUEUE_PROCESSES

Creating a Materialized View Log

Before creating materialized view groups and ma terialized views for a remote materialized view site, make sure you create the necessary materialized view logs at the master site or master materialized view site. A materialized view log is necessary for every master table or master materialized view that supports at least one materialized view with fast refreshes.

To create a materialized view log, you n eed the following privileges:

  • CREATE ANY TABLE
  • CREATE ANY TRIGGER< /li>
  • SELECT (on the materialized view log's master)
  • COMMENT ANY TABLE

    See Also:

    The "Creating Mate rialized View Logs" topic in the Replication Management tool's online help for detailed information about creating materialized view logs at the master site or master materialized view site with the Replication Management tool. To access this topic in the online hel p, open Materialized View Replication in the Help Contents.

Logging Columns in the Materializ ed View Log

When you create a materialized view log, you can add c olumns to the log when necessary. To fast refresh a materialized view, the following types of columns must be added to the materializ ed view log:

  • A column referenced in the WHERE claus e of a subquery that is not part of an equi-join and is not a primary key column. These columns are called filter columns.
  • A column in an equi-join that is not a primary key column, if the subquery is either many to many or one to many. If the subquery is many to one, then you do not need to add the join column to the materialized view log.

A collection column cannot be added to a materialized view log. Also, materialized view lo gs are not required for materialized views that are complete refreshed.

For example, consider the following DDL:

1) CREATE MATERIALIZED VIEW oe.customers REFRESH FAST AS

2)  SELECT * FROM oe.customers@orc1.world c
3)  WHERE EXISTS
4)    (SELECT * FROM oe.orde
rs@orc1.world o
5)     WHERE c.customer_id = o.customer_id AND o.order_total > 20000);




Notice in line 5 of the preceding DDL that three columns are referenced in the WHERE clause. Columns orders.customer_id and customers.customer_id are referenced as part of the equi-join clause. Because customers.customer_id is a primary key column, it is logged by default, but orders.customer_id is not a primary key column and so must be added to the materialized view log. Also, the column orders.order_total i s an additional filter column and so must be logged.

Therefore, add orders.customer_id< /code> and orders.order_total the materialized view log for the oe.orders table.

To create the materialized view log with these columns added, issue the following statement:

CREATE MATERIALIZED VIEW LOG ON oe.orders 
  WITH PRIMARY KEY (customer_id,order_total);

If a materialized view log already exists on the oe.customers tabl e, you can add these columns by issuing the following statement:

ALTER MATERIALIZED VIEW LOG
ON oe.orders ADD (customer_id,order_total);

If you are using user-def ined datatypes, then the attributes of column objects can be logged in the materialized view log. For example, the oe.customers table has the cust_address.postal_code attribute, which can be logged in the materialized view log by issuing th e following statement:

ALTER MATERIALIZED VIEW LOG ON oe.customers ADD (cust_address.postal_c
ode);

You are encouraged to analyze the defining queries of your plan ned materialized views and identify which columns must be added to your materialized view logs. If you try to create or refresh a mat erialized view that requires an added column without adding the column to the materialized view log, then your materialized view crea tion or refresh may fail.


Note:

To fast refresh a materialized view, you must add join columns in subqueries to the materialize d view log if the join column is not a primary key and the subquery is either many to many or one to many. If the subquery is many to one, then you do not need to add the join column to the materialized view log.


See Also:

Creating a Materialized View Environment

Materialized view e nvironments can be created in several different ways and from several different locations. In most cases, you should use deployment t emplates at the master site to locally precreate a materialized view environment that will be individually deployed to the target mat erialized view site.

You can also individually create the materialized view environment by es tablishing a connection to the materialized view site and building the materialized view environment directly.

Creating a Materialized View Enviro nment Using the Replication Management Tool

See the Replication M anagement tool's online help for information on using deployment templates to centrally create a materialized view environment using the Replication Management tool.

See the Replication Management tool's online help for inform ation on individually creating the materialized view environment with a direct connection to the remote materialized view site using the Replication Management tool.

Figure 6-2 Fl owchart for Creating Materialized Views

Text description of repln076.gi
f follows

Text description of the illustration repln076.gif

Creating a Materialized View Environment Using the Replication Management API

The instructions for creati ng a deployment template in the O racle Database Advanced Replication Management API Reference manual for information on using deployment templates to central ly pre-create a materialized view environment using the replication management API.

The instr uctions for creating a materialized view group the Oracle Database Advanced Replication Management API Reference manual for information on individually cr eating the materialized view environment with a direct connection to the remote materialized view site using the replication manageme nt API.

Avoid ing Problems When Adding a New Materialized View Site

After you have c reated a materialized view environment with one or more materialized view sites, you may need to add new materialized view sites. You may encounter problems when you try to fast refresh the materialized views you create at a new materialized view site if both of the following conditions are true:

  • Materialized views at the new ma terialized view site and existing materialized views at other materialized view sites are based on the same master table or master ma terialized view.
  • Existing materialized views can be refreshed while you create t he new materialized views at the new materialized view site.

The problem arises when th e materialized view logs for the masters are purged before a new materialized view can perform its first fast refresh. If this happen s and you try to fast refresh the materialized views at the new materialized view site, then you may encounter the following errors:< /p>

ORA-12004 REFRESH FAST cannot be used for materialized view materialized_v
iew_
name
ORA-12034 materialized view log on materialized_view_name younger than las
t 
refresh

If you receive these errors, then the only solution is to perform a complete refresh of the new materialized view.

To avoid this problem, choose one of the following options:

  • Use deployment templates to create the m aterialized view environment at materialized view sites. You will not encounter this problem if you use deployment templates.

    See Also:

    Chapter 4, "Deployment Templates Concepts and Architecture" for information about deployment templates

  • Create a dummy materiali zed view at the new materialized view site before you create your production materialized views. The dummy materialized view ensures that the materialized view log will not be purged while your production materialized views are being created.

If you choose to create a dummy materialized view at the materialized view site, complete the following steps:

  1. Create a dummy materialized view called d ummy_mview based on the master table or master materialized view. For example, to create a dummy materialized view based on a master table named sales, issue the following statement at the new materialized view site:
    CREATE MATERIALIZED VIEW dummy_mview REFRESH FAST AS 
      SELECT * FROM pr.sales@orc1.world WHERE 1=0; 
    
    
  2. Create your production materialized views at t he new materialized view site.
  3. Perform fast refresh of your production ma terialized views at the new materialized view site.
  4. Drop the dummy materi alized view.

Interoperability in an Advanced Replication Environment

If you p lan to configure an Advanced Replication environment that involves different releases of Oracle at different replication sites, then your environment must meet the following requirements:

Guidelines for Scheduled Links

A scheduled link determines how a master site propagates its deferred transaction queue to another master site, or how a materialized view site propagates its deferred transaction queue to its master site or master materialized view site. When you cre ate a scheduled link, Oracle creates a job in the local job queue to push the deferred transaction queue to another site in the syste m. When Oracle propagates deferred transactions to a remote master site, it does so within the security context of the replication pr opagator.

You can configure a scheduled link to push information using serial or parallel pro pagation. In general, you should use parallel propagation, even if you set the parallelism parameter to 1.

Before creating the scheduled links for a replication environment, carefully consider how you want replica tion to occur globally throughout the system. For example, you may choose to propagate deferred transactions at intervals, with time in between these intervals when the deferred transactions are not propagated. In this case, you must decide how often and when to sch edule pushes. Alternatively, if you want to simulate real-time (or synchronous) replication, then you may want to have each scheduled link continuously push a master site's deferred transaction queue to its destination.

Also, you may want to schedule pushes at a time of the day when connectivity is guaranteed or when communications costs are lowest, such as during evening hours. Furthermore, you may want to stagger the scheduling for links among all master sites to distribute the load th at replication places on network resources.

See Also:

"Serial and Parallel Propagation" for more information about issues related to serial and parallel propagation

Scheduling Per iodic Pushes

You can schedule periodic intervals between pushes of a s ite's deferred transaction queue to a remote destination. Examples of periodic intervals are once an hour or once a day. To do so, yo u can use the DBMS_DEFER_SYS.SCHEDULE_PUSH procedure and specify the settings shown in Table  6-3.

Table 6-3 Settings to Schedule Periodic Pushes
SCHEDUL E_PUSH Procedure Parameter Value

delay_seconds

0

interval

An appropriate date expression; for example , to specify an interval of one hour, use 'sysdate + 1/24'

You can also use the Replication Management tool to schedule periodic pushes. To do so, set Delay Seconds to the default value o f 0 when configuring a scheduled link in any of the following places:

  • The Replication Management tool's Setup Wizard
  • The Edit Push Schedule dial og box

Then configure the interval (the "then push every" control) to push the deferred transaction queue periodically.

The following is an example that schedules a periodic push o nce an hour:

BEGIN
   DBMS_DEFER_SYS.SCHEDULE_PUSH (

      destination => 'orc2.world',
      interval => 'SYSDATE + (1/24)',
      next_dat
e => SYSDATE,
      delay_seconds => 0);
END;
/
See Also:

Sched uling Continuous Pushes

Even when using Oracle's asynchronous repl ication mechanisms, you can configure a scheduled link to simulate continuous, real-time replication. To do so, use the DBMS_DE FER_SYS.SCHEDULE_PUSH procedure and specify the settings shown in Table 6-4.

Table 6-4 Settings to Simulate Continuous Push
SCHEDULE_PUSH Procedure Parameter Value

delay_seconds

1200

interval

Lower than the delay_seconds sett ing

parallel ism

1 or higher

execution_seconds

Higher than the delay_seconds setting

With this configuration, Oracle continues to push transactions that enter the deferred transaction queue for the durat ion of the entire interval. If the deferred transaction queue has no transactions to propagate for the amount of time specified by th e delay_seconds parameter, then Oracle releases the resources used by the job and starts fresh when the next job queue p rocess becomes available.

If you are using serial propagation by setting the parallelis m parameter to 0 (zero), then you can simulate continuous push by reducing the settings of the delay_seconds and interval parameters to an appropriate value for your environment. However, if you are using serial propagation, simulati ng continuous push is costly when the push job must initiate often.

The following is an examp le that simulates continual pushes:

BEGIN
   DBMS_DEFER_SYS.SCHEDULE_PUSH
 (
      destination => 'orc2.world',
      interval => 'SYSDATE + (1/144)',
      next_date => SYSDATE,
      parallelism => 1,
      execution_seconds =
> 1500,
      delay_seconds => 1200);
END;
/
See Also:

Guidelines for Scheduled Purges of a Deferred Tr ansaction Queue

A scheduled purge determines how a master site or materialized view site purges applied transactions from its deferred transaction queue. When you use the Replication Management tool' s Setup Wizard to set up a master site or materialized view site, Oracle creates a job in each site's local job queue to purge the lo cal deferred transaction queue on a regular basis. Carefully consider how you want purging to occur before configuring the sites in a replication environment. For example, consider the following options:

  • You can synchronize the pushing and purging of a site's deferred transaction queue. For example, you can configure continuous pushing and purging of the transaction queue. This type of configuration can offer performance advantages because it is likely that i nformation about recently pushed transactions is already in the server's buffer cache for the corresponding purge operation.
  • When a server is not CPU bound, you can schedule continuous purging of the deferred tran saction queue to keep the size of the queue as small as possible.
  • For servers th at experience a high-volume of transaction throughput during normal business hours, you can schedule purges to occur during off-peak hours if you can store an entire day's deferred transactions.

Scheduling Periodic Purges

You can schedule periodic purges of a site's deferred transaction queue. Examples of periodic purges are purges that occu r once a day or once a week. To do so, you can use the DBMS_DEFER_SYS.SCHEDULE_PURGE procedure and specify the settings shown in Table 6-5.

Table 6-5 Settings to Schedule Periodic Purges
< /table>

You can also use the Replication Management tool's Setup Wizard, or the Purge sub tab of the Schedule tab on the Administration property sheet to schedule periodic purges. To do so, set Delay Seconds to the default value o f 0 (zero). Then configure the interval (the "then purge every" control) to purge the deferred transaction queue.

The following is an example that schedules a periodic purge once a day:


BEGIN
   DBMS_DEFER_SYS.SCHEDULE_PURGE (
      next_date => SYSDATE,

     interval => 'SYSDATE + 1',
      delay_seconds => 0);
END;
/
<
/pre>


SCHEDULE_PURGE Procedure Parameter Value

delay_seconds

0

interval

An appropriate date expression; for example, to specify an interval of one day, use 'sysdate + 1'

See Also:

Scheduling Continuous Purges

To configure continuous purging of a site's deferred transaction queue, you can use the DB MS_DEFER_SYS.SCHEDULE_PURGE procedure and specify the settings shown in Table 6-6.

Tab le 6-6 Settings to Schedule Periodic Purges
< /table>

You can also use the Replication Management tool to configure continuous purge. To do so, on the Purge sub tab of the Schedule tab on the Administration property sheet, set Delay Seconds to 500,000 and set interval (the "t hen purge every" control) to a value less than the Delay Seconds setting.

The following is an example that simulates continuous purges:

BEGIN
   DBMS_DEFER_SYS.SCHEDU
LE_PURGE (
      next_date => SYSDATE,
      interval => 'SYSDATE + (1/144)',
      purge_method => dbms_defer_sys.purge_method_quick,
      delay_seconds => 500000);
END;
/

SCHEDULE_PURGE Procedure Par ameter Value

delay_seconds

500000

inter val

Lower than the delay_seconds setting

purge_method< /p>

dbms_defer_sys.purge_method_quick

See Also:

< font face="Arial, Helvetica, sans-serif" color="#330099">Serial and Parallel Propagation

< /a>

When you create the scheduled links for a replication environment, each link can asynchronously propagate changes to a destination using either serial or parallel propagation. Before you configure your replication environment, decide whether you w ant to use serial propagation or parallel propagation.

  • With seri al propagation, Oracle propagates replicated transactions one at a time in the same order that they are committed on the source syste m. To configure a scheduled link with serial propagation, set the parallelism parameter to 0 (zero) in the DBMS_DE FER_SYS.SCHEDULE_PUSH procedure. Or, using the Replication Management tool, set the Parallel Propagation Processes control to 0 in the Edit Push Schedule dialog box.
  • With parallel propagation, Oracle propag ates replicated transactions using multiple parallel streams for higher throughput. When necessary, Oracle orders the execution of de pendent transactions to preserve data integrity. To configure a scheduled link with parallel propagation, set the parallelism parameter to 1 or higher in the DBMS_DEFER_SYS.SCHEDULE_PUSH procedure. Or, using the Replication Management tool, set the Parallel Propagation Processes control to 1 or higher in the Edit Push Schedule dialog box. Typically, you should use parall el propagation.

    See Also:

Deployment Templat es

If you plan to include materialized view sites in your replicat ion environment, then consider using deployment templates to create the replicated objects at the materialized view sites.

See Also:

Chapter 4, "Deployment Templates Concepts and Architecture" for information about deployment templates

Preparing Materialized View Sites for Instantiation of Deployment Templates

Network Connectivity

As with all replication environments, network connectivity is a key componen t in Advanced Replication. Verify that the remote materialized view site has a proper SQL*Net, Net8, or Oracle Net connection to the target master site.

See Also:

Oracle Net Services Administrator's Guide for information about setting up an Oracle network connection

Database Versio n

The materialized view site must have an Oracle release 8.1.5 or high er database to instantiate a deployment template. If your materialized view site does not meet the database version requirements, the n you need to upgrade your database at the materialized view site before instantiating a deployment template.

Materialized View Site Setup< /h4>

Each materialized view site needs several users that have special privileges to support a materialized view site. In addition to having the administrative privileges, these users also participate in the propaga tion and refreshing of data.

Materialized view site setup also includes scheduling several au tomated jobs to handle the automatic refreshing of the materialized view (optional) and the purging of the deferred transaction queue .

You can set up your materialized view site with:

  • Replication Management Tool: You can connect to the remote materialized view site with the Replication Management tool and use the Setup Wizard.

    See Also:

    The Replication Management tool's onlin e help for instructions on setting up your materialized view site with the Replication Management tool

  • Replication Management API: Using the replication ma nagement API to setup your materialized view site is an ideal solution when you are not able to connect to the remote materialized vi ew site with the Replication Management tool. When you build a SQL script containing the API calls to setup your materialized view si te, you can also add the DDL and API calls to complete the remaining preparation (such as creating any necessary schemas, database li nks, and rollback segments, as described in the following three sections). The script that you create should be distributed with the offline instantiation file and executed before the offline instantiation file.

See Also:

Oracle Database Advanced Replication Management API Referen ce for instructions on setting up your materialized view site with the replication management API

Creat e Necessary Schemas

If the deployment template that you are instantiat ing creates objects in multiple schemas, then make sure that all of the necessary schemas have been created. Additionally, the user i nstantiating the deployment template must have the appropriate CREATE privileges on that schema. For example, if the dep loyment template will create a procedure in schema oe and the user hr is instantiating the template, then < code>hr must have the CREATE ANY PROCEDURE privilege on schema oe.

Create Database Link s

While it is advantageous to include the DDL to create all necessary database links for a remote materialized view site in the deployment template, it is not required. If the database link DDL is not in the deployment template, then manually create the database links to the target master site prior to instantiating the deployment tem plate. The database links are required to populate the materialized views during an online instantiation and are required for the pro per maintenance of the materialized view environment.

Online or Offline Instantiation

You have the option of performing online or offline instantiation of deployment templates at materialized view sites. With online instantiation, the data in your materialized views is pulled from the master site during instantiation. With offline instantiation, t he data in your materialized views is packaged in the template itself and is applied locally when you instantiate the template. In ge neral, if your materialized views will contain a large amount of data, then offline instantiation is preferred to minimize utilizatio n of your network resources.

See Also:

"Deployment Template Packaging and Instantiation" for more information about online and offline instantiation

< /a>

Create Necessary Rollback Segments

If the deployment template that you are instantiating will use specif ic rollback segments that do not currently exist at the remote materialized view site, then create the necessary rollback segments. T o see if your template objects use the default rollback segment or a specific rollback segment, query the DBA_REPCAT_TEMPLATE_O BJECTS data dictionary view.

See Also:

Oracle Database Advanced Replication Management API Reference for information about data diction ary views related to replication

Conflict Resolution

Asynch ronous multimaster and updatable materialized view replication environments must address the possibility of replication conflicts tha t may occur when, for example, two transactions originating from different sites update the same row at nearly the same time. If poss ible, plan your replication environment to avoid the possibility of conflicts. If data conflicts may occur in your replication enviro nment, then you need a mechanism to ensure that the conflict is resolved in accordance with your business rules and to ensure that th e data converges correctly at all sites.

See Also:

Chapter 5, "Conflict Resolution Conc epts and Architecture", for more information about avoiding conflicts and for information about the conflict resolution methods a vailable to you if conflicts may occur

Security

Security ma y be a concern in both multimaster and materialized view replication environments. You should plan your security strategy before you configure your replication environment.

See Also:

Oracle Database Advanced Replication Management API Reference for informa tion about security options in a replication environment

Designing for Survivability

Survivability is the capability to continue running applications despite system or site failures. Survivabi lity enables you to run applications on a fail over system, accessing the same, or very nearly the same, data as these systems access ed on the primary system when it failed. As shown in Figure 6-3, the Oracle server provides two different technologies for accomplishing survivability: multimaster replication and Oracle Real Application Clusters.

Figure 6-3 Survivability Methods: Replication Or Oracle Real Application Clusters

Text description of repln019.gif follows < p>Text description of the illustration repln019.gif

Oracle Real Application Clusters supports fail over to surviving systems whe n a system supporting an instance of the Oracle server fails. Oracle Real Application Clusters requires a cluster or massively parall el hardware platform, and thus is applicable for protection against processor system failures in the local environment where the clus ter or massively parallel system is running.

In these environments, the Oracle Real Applicati on Clusters is a good solution for survivability -- supporting high transaction volumes with no lost transactions or data inconsisten cies in the event of an instance failure. If an instance fails, then a surviving instance of the Oracle Real Application Clusters aut omatically recovers any incomplete transactions. Applications running on the failed system can execute on the fail over system, acces sing all data in the database.

The Oracle Real Application Clusters does not, however, provid e survivability for site failures (such as power outages, flood, fire, or sabotage) that render an entire site, and thus the entire c luster or massively parallel system, inoperable. To provide survivability for site failures, you can use the multimaster replication to maintain a replica of a database at a geographically remote location. In addition, you can use multimaster replication to replicat e data between sites running different operating systems or different releases of Oracle or both.

Should the local system fail, the application can continue to execute at the remote site. Using multimaster replication, some ad ministrative procedures may be necessary to recover transactions at the failed site and to prevent data inconsistencies when restarti ng the failed site.


Note< /strong>:

You can also configure standby database to protect an Oracle database f rom site failures.


See Also:

Designing a R eplication Environment for Survivability

If you choose to use the repl ication facility for survivability, then consider the following issues:

You must carefully design your system to deal with these situations. The next section explains this process.

Implementing a Survivable System

Advanced Replication provides survivability against site failures by using multiple replicated master sites. You mu st configure your system using one of the following methods, which are listed in order of increasing implementation difficulty:

< ul class="LB1">
  • The failover site is used for read access only. That is, no updates a re allowed at the failover site, even when the primary site fails.
  • After a failu re, the primary site is restored from the fail over site using export/import, or through full backup.
  • Full conflict resolution is employed for all data/transactions. This requires careful design and implementation . You must ensure proper resolution of conflicts that can occur when the primary site is restored, such as duplicate transactions.
  • Provide your own special applications-level routines and procedures to deal with t he inconsistencies that occur when the primary site is restored, and the queued transactions from the active fail over system are pro pagated and applied to the primary site.
  • You can use Oracle Net to configure automatic connect-time failover, which enables Oracle Net to fail over to a different master site if the first master site fails. You configure automatic connect-time failover in your tnsnames.ora file by setting the FAILOVER option to on and specifying multiple connect descriptors.

    See Also:

    Oracle Net Services Administrator's Guide for more information about configuring conne ct-time failover

    Database Recovery in Replication Environments

    Databases using replication are distributed databases. Follow the guidelines for coordinated distributed recovery in the Oracle Database Backup and Recovery Adva nced User's Guide when recovering a replication database.

    If you fail to follow the coordinated distributed recovery guidelines, then there is no guarantee that your replication databases will be consistent. For examp le, a restored master site may have propagated different transactions to different masters. You may need to perform extra steps to co rrect for an incorrect recovery operation. One such method is to drop and re-create all replicated objects in the recovered database.


    Recommendation:

    Remove pending deferred transactions and deferred error records from the restored database, and resolve any ou tstanding distributed transactions before dropping and re-creating replicated objects. If the restored databa se was a master definition site for some replication environments, then you should designate a new master definition site before drop ping and creating objects. Any materialized views mastered at the restored database should be fully refreshed, as well as any materia lized views in the restored database.

    To provide continued access to your data, you may need t o change master definition sites (assuming the database being recovered was the master definition site), or change the master site of materialized view sites (assuming their master site is being recovered).


    Performing Checks on Imported Data

    After performing an export/import of a replicated object or an object used by Advanced Replication, such as the DBA_REPSITES data dictionary view, you should run the REPCAT_IMPORT_CHECK procedure in the DBMS_REPCAT package.

    In the following example, the procedure c hecks the objects in the acct replication group at a materialized view site to ensure that they have the appropriate obj ect identifiers and status values:

    BEGIN
    DBMS_REPCAT.REPCAT_IMPORT_CHECK(
     gname     =>   'hr_repg',
                                     master    =>   FALSE);
    END;
    
    /
    
    See Also:

    The REPCAT_IMPORT_CHECK procedure in Oracle Database Advanced Replication Manageme nt API Reference