Skip Headers

Oracle9i Advanced Replication
Release 2 (9.2)

Part Number A96567-01
Go To Documentation Library
Home
Go To Product List
Book List
Go To Table Of Contents
Contents
Go To Index
Index

Master Index

Feedback

Go to previous page Go to next page

6
Planning Your Replication Environment

Before you begin to plan your replication environment, it is important to understand the replication concepts and architecture described in the previous chapters of this book. After you understand replication concepts and architecture, 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 replicated 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 addition, 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 referential 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 master group containing its table using either the Replication Management tool or the CREATE_MASTER_REPOBJECT procedure in the DBMS_REPCAT package.

Datatype Considerations

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

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

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

You 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 replicated tables. You should convert LONG datatypes to LOBs.

Oracle also does not support 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 replication of UROWID columns in master tables or updatable materialized views. However, UROWID columns are allowed in read-only materialized views.


Note:

Oracle does not support replication of LOB datatypes in replication environments where some sites are running Oracle7 release 7.3.


See Also:

Row-Level Dependency Tracking

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

Using the ROWDEPENDENCIES option improves performance and scalability when using parallel propagation, but this option also requires 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_id         NUMBER(6)  NOT NULL, 
  unit_price         NUMBER(8,2), 
  quantity           NUMBER(8)
  ) ROWDEPENDENCIES;

Oracle tracks the SCN for 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 Propagation 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 performance of a replication environment.

See Also:

Oracle9i Database Reference for more information about these initialization parameters

Table 6-1 Initialization Parameters Important for Replication (Page 1 of 3)
Parameter Values Description Recommendation
COMPATIBLE
Default: 8.1.0

Range: 8.1.0 to Current 
Release Number

Lets you use a new release, while at the same time guaranteeing backward compatibility with an earlier release. This ability is helpful in case it becomes necessary to revert to the earlier release.

This parameter specifies the release with which the Oracle server must maintain compatibility. Oracle servers with different compatibility levels can interoperate.

If you want to use any of the new replication features available in Oracle9i, then set this parameter to 9.0.1 or higher.

GLOBAL_NAMES
Default: false

Range: true or false

Specifies whether a database 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 environment, including both master sites and materialized view sites.

JOB_QUEUE_PROCESSES
Default: 0

Range: 0 to 1000

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 all groups at the site, and you must manually push and purge the deferred transaction queue.

You can change the setting for JOB_QUEUE_PROCESSES dynamically by using the ALTER SYSTEM statement.

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

Specifies the maximum number of concurrent open connections to remote databases in one session. These connections include the schema objects called database 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 least the number of master sites. For example, an environment with five master sites requires that OPEN_LINKS be set to at least 5.

PARALLEL_AUTOMATIC_TUNING

Default: false

Range: true or false

When set to true, Oracle determines the default values for initialization parameters that control parallel execution.

See Oracle9i Database Reference and Oracle9i Database Migration for details about using this initialization parameter.

PARALLEL_MAX_SERVERS

Default: Derived from the values of the following parameters:

CPU_COUNT
PARALLEL_AUTOMATIC_TUNING 
PARALLEL_ADAPTIVE_MULTI_USER

Range: 0 to 3599

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

If you use 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

Specifies the minimum number of parallel execution processes 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 process for each stream.

PROCESSES
Default: Derived from 
PARALLEL_MAX_SERVERS

Range: 6 to operating 
system dependent limit

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.

REPLICATION_DEPENDENCY_TRACKING
Default: true

Range: true or false 

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

true: enables dependency tracking.

false: allows read/write operations to the database to 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 your application will perform no read/write operations to the replicated tables.

SHARED_POOL_SIZE
Default: 16 MB
(64 MB if 64 bit)

Range: 300 KB to Operating 
System Dependent Limit
 

Specifies in bytes the size of the shared pool. The shared pool contains shared cursors, stored 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 Oracle server in a replication environment than in a non-replication environment.

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

UTL_FILE_DIR
Default: None

Range: Any valid directory 
path.
 

Specifies the default location for generated files. These files may be generated by the Replication Management tool or by the replication management API.

For example, an offline instantiation file for a deployment template can be placed in the directory specified by this initialization parameter.

Specify a valid directory.

Master Sites and Materialized View Sites

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

Table 6-2 Characteristics of Master 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 number 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

Note:

Master sites require either Oracle Enterprise Edition or Oracle Standard Edition. Oracle Standard Edition supports only single master site configurations. Materialized view sites running Oracle require one of the following: Oracle Enterprise Edition, Oracle Standard Edition, or Oracle Personal Edition. In addition, replication must be installed on all master sites and materialized view sites.


Advantages of Master Sites

Master sites have the following advantages:

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:

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:
  • The the Replication Management tool's online help for instructions on using the Setup Wizard to set up a materialized view site
  • Oracle9i Replication Management API Reference for instructions on using the replication management API to set up a materialized view site

Preparing for Materialized Views

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

The Replication Management tool's Setup Wizard automatically 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 Replication Management tool's online help for instructions on using tool to set up your materialized view site.

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 Oracle9i 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 Replication Management tool's Setup Wizard or the script in the Oracle9i Replication Management API Reference does to set up your materialized view site.

Create Materialized View Site Users

Each materialized view site needs several users to perform the administrative and refreshing activities at the materialized view site. You must create and grant the necessary 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 users. Usually, a proxy materialized view administrator and a proxy refresher are created.

Create Schemas at Materialized View Site

A schema containing a materialized view in a remote database must correspond to the schema that contains the master table in the master database. Therefore, identify the schemas that contain the master tables that you want to replicate with materialized views. After you have identified the target schemas at the master database, create the corresponding 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.world.

See Also:

If you are reviewing the steps in Oracle9i Replication Management API Reference, then the necessary schemas 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 database 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 creates 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 connections to the remote database using the specified account. Additionally, the remote account that the link uses must have the SELECT 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 should 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 the Replication Management tool's Setup Wizard, then these database links are created for you automatically.

See Also:

The information about security options in Oracle9i Replication Management API Reference for more information

After the administrative database links have been created, a private database link must be created connecting 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 that connects using the hr username and password.

Figure 6-1 Recommended Schema and Database Link Configuration

Text description of rep81056.gif follows
Text description of the illustration rep81056.gif


See Also:

Oracle9i Database Administrator's Guide for more information about database links

Assign Privileges

Both the creator and the owner of the materialized view must be able to issue the defining SELECT statement of the materialized view. The owner is the schema that contains 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 SELECT privileges to execute the defining SELECT statement.

See Also:

If you are reviewing the steps in Oracle9i Replication Management API Reference, then the necessary privileges are granted as part of the script described in instructions for 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 performed at the master site. Scheduling the purge operation again does not harm the master site, but may change the purge scheduling characteristics.

Schedule Push

Scheduling a push at the materialized view site automatically propagates the deferred transactions at the materialized view site to the associated target master site using a database link. These types of database links are called scheduled links. Typically, there is only a single scheduled link for each materialized view 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 handle 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 site has scheduled links to the other five sites. You typically need one process for each scheduled link. You may also want to add additional 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 purge scheduling, user-defined jobs, and the scheduled link. Also, you need at least one job queue process for each degree of parallelism.

Alternatively, if your users are responsible for manually refreshing the materialized view 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. 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 the job queue processes should "wake up" to execute jobs.

See Also:

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

Dynamically Altering the JOB_QUEUE_PROCESSES Setting

The JOB_QUEUE_PROCESSES initialization parameter is dynamic. Therefore, it can be modified using the ALTER SYSTEM command while an instance is running.

The following statement dynamically sets JOB_QUEUE_PROCESSES to 50:

ALTER SYSTEM SET JOB_QUEUE_PROCESSES = 50;

Whenever a dynamic parameter is modified using the ALTER SYSTEM command, Oracle records in the alert log the command that modifies the parameter. The ALTER SYSTEM command in the previous example modifies the global value of the parameter for all sessions in the instance, for the duration of the instance (until the database is shut down). If you shut down and restart the database, then Oracle uses the setting for JOB_QUEUE_PROCESSES in the initialization parameter file.

Editing Initialization Parameters Using Instance Management Tool

You can use the Edit Database dialog box of the Instance Management tool to configure the job queue processes at the materialized view site if you have a dedicated network link to the materialized view site or if you are able to schedule the network link. This operation is required because the Instance Management tool is not installed at the materialized view site in most cases, which means that the configuration must be done remotely from the master site. If remote configuration is not possible, then see the next section.

Complete the following to set your job processes using Instance Manager:

  1. Start Oracle Enterprise Manager Console.
  2. Select the database in the Navigator pane.
  3. Log in as a user with SYSDBA privileges.
  4. Expand the Instance Management tool.
  5. Select Configuration.
  6. On the General tab in the right pane, click the All Initialization Parameters button. The Edit Database dialog box.
  7. Edit the settings for the initialization parameters.
  8. Click the OK button.

    You can save this configuration, which is helpful if you use Instance Manager to manage your database.

    See Also:

    Oracle Enterprise Manager Administrator's Guide and the Instance Management tool's online help for more information on using the Instance Management tool

Manually Editing the Initialization Parameter File

If you do not have access to the Instance Management tool, then you can manually edit the initialization parameter file. Use a text editor to modify the contents of your initialization parameter file.

In most cases, all of the initialization parameters used in replication are grouped together under an "Advanced Replication" heading in your initialization parameter file. After you have modified the contents of your initialization parameter file, restart your database with these new settings.

See Also:

"Initialization Parameters" and the Oracle9i Database Reference for more information about initialization parameters important for Advanced Replication, and see Oracle9i Database Administrator's Guide for information on restarting your database.

Creating a Materialized View Log

Before creating materialized view groups and materialized 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 need the following privileges:

Logging Columns in the Materialized View Log

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

A collection column cannot be added to a materialized view log. Also, materialized view logs 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.orders@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 is an additional filter column and so must be logged.

Therefore, add orders.customer_id 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 table, 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-defined 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 the following statement:

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

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


Note:

To fast refresh a materialized view, you must add join columns in subqueries to the materialized 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 environments can be created in several different ways and from several different locations. In most cases, you should use deployment templates at the master site to locally precreate a materialized view environment that will be individually deployed to the target materialized view site.

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

Creating a Materialized View Environment Using the Replication Management Tool

See the Replication Management 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 information 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 Flowchart for Creating Materialized Views

Text description of rep81076.gif follows
Text description of the illustration rep81076.gif



Creating a Materialized View Environment Using the Replication Management API

The instructions for creating a deployment template in the Oracle9i Replication Management API Reference manual for information on using deployment templates to centrally pre-create a materialized view environment using the replication management API.

The instructions for creating a materialized view group the Oracle9i Replication Management API Reference manual for information on individually creating the materialized view environment with a direct connection to the remote materialized view site using the replication management API.

Avoiding Problems When Adding a New Materialized View Site

After you have created 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:

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

ORA-12004 REFRESH FAST cannot be used for materialized view materialized_view_
name
ORA-12034 materialized view log on materialized_view_name younger than last 
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:

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 dummy_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 the new materialized view site.
  3. Perform fast refresh of your production materialized views at the new materialized view site.
  4. Drop the dummy materialized view.

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 create a scheduled link, Oracle creates a job in the local job queue to push the deferred transaction queue to another site in the system. When Oracle propagates deferred transactions to a remote master site, it does so within the security context of the replication propagator.

You can configure a scheduled link to push information using serial or parallel propagation. 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 replication 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 schedule 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 that replication places on network resources.

See Also:

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

Scheduling Periodic Pushes

You can schedule periodic intervals between pushes of a site's deferred transaction queue to a remote destination. Examples of periodic intervals are once an hour or once a day. To do so, you 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
SCHEDULE_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 of 0 when configuring a scheduled link in any of the following places:

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 once an hour:

BEGIN
   DBMS_DEFER_SYS.SCHEDULE_PUSH (
      destination => 'orc2.world',
      interval => 'SYSDATE + (1/24)',
      next_date => SYSDATE,
      delay_seconds => 0);
END;
/
See Also:

Scheduling Continuous Pushes

Even when using Oracle's asynchronous replication mechanisms, you can configure a scheduled link to simulate continuous, real-time replication. To do so, use the DBMS_DEFER_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 setting

parallelism

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 duration of the entire interval. If the deferred transaction queue has no transactions to propagate for the amount of time specified by the delay_seconds parameter, then Oracle releases the resources used by the job and starts fresh when the next job queue process becomes available.

If you are using serial propagation by setting the parallelism 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, simulating continuous push is costly when the push job must initiate often.

The following is an example 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 Transaction 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 local 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:

Scheduling Periodic Purges

You can schedule periodic purges of a site's deferred transaction queue. Examples of periodic purges are purges that occur 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
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'

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 of 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;
/
See Also:

Scheduling Continuous Purges

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

Table 6-6 Settings to Schedule Periodic Purges
SCHEDULE_PURGE Procedure Parameter Value

delay_seconds

500000

interval

Lower than the delay_seconds setting

purge_method

dbms_defer_sys.purge_method_quick

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 "then 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.SCHEDULE_PURGE (
      next_date => SYSDATE,
      interval => 'SYSDATE + (1/144)',
      purge_method => dbms_defer_sys.purge_method_quick,
      delay_seconds => 500000);
END;
/

See Also:

Serial and Parallel Propagation

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 want to use serial propagation or parallel propagation.

Deployment Templates

If you plan to include materialized view sites in your replication 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

If you decide to use deployment templates, then you need to prepare your materialized view sites for instantiation. If a deployment template has been designed well, then little preparation is necessary at the remote materialized view site. This section describes the most common preparations that must be performed at the remote materialized view site. After any required preparations have been completed, you are ready to perform either an online or offline instantiation.

Use the following questions to assess which actions are necessary to prepare the remote materialized view site for instantiation:

The following sections provide guidance for the issues raised by each of these questions.

Network Connectivity

As with all replication environments, network connectivity is a key component in Advanced Replication. For Oracle Enterprise Edition, Oracle Standard Edition, and Oracle Personal Edition, verify that the remote materialized view site has a proper SQL*Net, Net8, or Oracle Net connection to the target master site.

See Also:

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

Database Version

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

Materialized View Site Setup

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 propagation and refreshing of data.

Materialized view site setup also includes scheduling several automated 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:

Create Necessary Schema

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

Create Database Links

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 template. The database links are required to populate the materialized view base tables during an online instantiation and are required for the proper 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, the data in your materialized views is packaged in the template itself and is applied locally when you instantiate the template. In general, if your materialized views will contain a large amount of data, then offline instantiation is preferred to minimize utilization of your network resources.

See Also:

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

Create Necessary Rollback Segment

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

See Also:

Oracle9i Replication Management API Reference for information about data dictionary views related to replication

Conflict Resolution

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

See Also:

Chapter 5, "Conflict Resolution Concepts and Architecture", for more information about avoiding conflicts and for information about the conflict resolution methods available to you if conflicts may occur

Security

Security may 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:

Oracle9i Replication Management API Reference for information about security options in a replication environment

Designing for Survivability

Survivability is the capability to continue running applications despite system or site failures. Survivability enables you to run applications on a fail over system, accessing the same, or very nearly the same, data as these systems accessed 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 rep81019.gif follows
Text description of the illustration rep81019.gif


Oracle Real Application Clusters versus Replication

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

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

The Oracle Real Application Clusters does not, however, provide survivability for site failures (such as power outages, flood, fire, or sabotage) that render an entire site, and thus the entire cluster 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 replicate 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 administrative procedures may be necessary to recover transactions at the failed site and to prevent data inconsistencies when restarting the failed site.


Note:

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


See Also:

Designing a Replication Environment for Survivability

If you choose to use the replication 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 must configure your system using one of the following methods, which are listed in order of increasing implementation difficulty:

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 connect-time failover

Database Backup and Recovery in Replication Systems

Databases using replication are distributed databases. Follow the guidelines for distributed database backups outlined in the Oracle9i Backup and Recovery Concepts when creating backups of replicated databases. Follow the guidelines for coordinated distributed recovery in the Oracle9i User-Managed Backup and Recovery 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 example, a restored master site may have propagated different transactions to different masters. You may need to perform extra steps to correct 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 outstanding distributed transactions before dropping and re-creating replicated objects. If the restored database was a master definition site for some replication environments, then you should designate a new master definition site before dropping and creating objects. Any materialized views mastered at the restored database should be fully refreshed, as well as any materialized views in the restored database.

To provide continued access to your data, you may need to 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 checks the objects in the acct replication group at a materialized view site to ensure that they have the appropriate object identifiers and status values:

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

The REPCAT_IMPORT_CHECK procedure in Oracle9i Replication Management API Reference


Go to previous page Go to next page
Oracle
Copyright © 1996, 2002 Oracle Corporation.

All Rights Reserved.
Go To Documentation Library
Home
Go To Product List
Book List
Go To Table Of Contents
Contents
Go To Index
Index

Master Index

Feedback