• Non ci sono risultati.

Adding Shared Objects to an Existing Multiple-Source Environment

If you set the recursive parameter to true in the SET_GLOBAL_

INSTANTIATION_SCN procedure or the SET_SCHEMA_INSTANTIATION_

SCN procedure, then a database link from the destination database to the source database is required. This database link must have the same name as the global name of the source database and must be accessible to the user who executes the procedure. See "Setting Instantiation SCNs Using the DBMS_

APPLY_ADM Package" on page 10-29 for instructions.

Alternatively, you can perform a metadata export/import to set the instantiation SCNs for existing database objects. If you choose this option, then make sure no rows are imported. Also, make sure the shared objects at the importing destination database are consistent with the source database that performed the export at the time of the export. If you are sharing DML changes only, then table level export/import is sufficient. If you are sharing DDL changes also, then additional considerations apply. See "Setting

Instantiation SCNs Using Export/Import" on page 10-28 for more information about performing a metadata export/import.

7. Start the apply processes you created in Step 3 using the START_APPLY procedure in the DBMS_APPLY_ADM package.

Adding Shared Objects to an Existing Multiple-Source Environment

You add existing database objects to an existing multiple-source environment by adding the necessary rules to the appropriate capture processes, propagations, and apply processes.

This example uses the following terms:

Populated database: A database that already contains the shared database objects being added to the multiple-source environment. You must have at least one populated database to add the objects to the environment.

Export database: A populated database on which you perform an export of the database objects you are adding to the environment. This export is used to

instantiate the added database objects at the import databases. You might not have an export database if all of the databases in the environment are populated

databases.

Import database: A database that does not contain the shared database objects before they are added to the multiple-source environment. You instantiate the shared database objects at an import database by performing an import of these database objects. You might not have any import databases if all of the databases in the environment are populated databases.

Before creating or altering capture or propagation rules in a running Streams

environment, make sure any propagations or apply processes that will receive LCRs as a result of the new or altered rules are configured to handle these LCRs. That is, the propagations or apply processes should exist, and each one should be associated with rule sets that handle the LCRs appropriately. If these propagations and apply

processes are not configured properly to handle these LCRs, then LCRs can be lost.

For example, suppose you want to add a new table to a Streams environment that already captures, propagates, and applies changes to other tables. Assume multiple capture processes in the environment will capture changes to this table, and multiple

See Also: "Add a Database to an Existing Streams Replication Environment" on page 19-7 for detailed example that adds a database to an existing single-source environment

Adding Shared Objects to an Existing Multiple-Source Environment

apply processes will apply changes to this table. In this case, you must add one or more table rules to the following rule sets:

The positive rule set for each apply process that will apply changes to the table.

The positive rule set for each propagation that will propagate changes to the table

The positive rule set for each capture process that will capture changes to the table If you perform administrative steps in the wrong order, you can lose LCRs. For example, if you add the rule to a capture process rule set first, without stopping the capture process, then the propagation will not propagate the changes if it does not have a rule that instructs it to do so, and the changes can be lost.

Figure 8–3 shows the additional configuration steps that must be completed to add shared database objects to a multiple-source Streams environment.

Figure 8–3 Example of Adding Shared Objects to a Multiple-Source Environment

Source / Destination Database

· Each additional object prepared for instantiation

· Appropriate rules for the added objects included in the rule sets for the capture process(es), propagation(s), and apply process(es)

· Instantiation SCN set for each additional object for each of the other source databases

· Conflict resolution for the added objects if necessary

· Each additional object prepared for instantiation

· Appropriate rules for the added objects included in the rule sets for the capture process(es), propagation(s), and apply process(es)

· Instantiation SCN set for each additional object for each of the other source databases

· Conflict resolution for the added objects if necessary

Adding Shared Objects to an Existing Multiple-Source Environment

To avoid losing LCRs, you should complete the configuration in the following order:

1. At each populated database, specify any necessary supplemental logging for the objects being added to the environment. See "Managing Supplemental Logging in a Streams Replication Environment" on page 9-3 for instructions.

2. Either stop all of the capture processes that will capture changes to the added objects, stop all of the propagations that will propagate changes to the added objects, or stop all of the apply process that will apply changes to the added objects:

Use the STOP_CAPTURE procedure in the DBMS_CAPTURE_ADM package to stop a capture process.

Use the STOP_PROPAGATION procedure in the DBMS_PROPAGATION_ADM package to stop a propagation.

Use the STOP_APPLY procedure in the DBMS_APPLY_ADM package to stop an apply process.

3. Add the relevant rules to the rule sets for the apply processes that will apply changes to the added objects. To add rules to the rule set for an apply process, you can run one of the following procedures:

DBMS_STREAMS_ADM.ADD_TABLE_RULES

DBMS_STREAMS_ADM.ADD_SUBSET_RULES

DBMS_STREAMS_ADM.ADD_SCHEMA_RULES

DBMS_STREAMS_ADM.ADD_GLOBAL_RULES

Excluding the ADD_SUBSET_RULES procedure, these procedures can add rules to the positive or negative rule set for an apply process. The ADD_SUBSET_RULES procedure can add rules only to the positive rule set for an apply process.

4. Add the relevant rules to the rule sets for the propagations that will propagate changes to the added objects. To add rules to the rule set for a propagation, you can run one of the following procedures:

DBMS_STREAMS_ADM.ADD_TABLE_PROPAGATION_RULES

DBMS_STREAMS_ADM.ADD_SUBSET_PROPAGATION_RULES

DBMS_STREAMS_ADM.ADD_SCHEMA_PROPAGATION_RULES

DBMS_STREAMS_ADM.ADD_GLOBAL_PROPAGATION_RULES

Excluding the ADD_SUBSET_PROPAGATION_RULES procedure, these procedures can add rules to the positive or negative rule set for a propagation. The ADD_

SUBSET_PROPAGATION_RULES procedure can add rules only to the positive rule set for a propagation.

5. Add the relevant rules to the rule sets used by each capture process that will capture changes to the added objects. To add rules to a rule set for an existing capture process, you can run one of the following procedures and specify the existing capture process:

DBMS_STREAMS_ADM.ADD_TABLE_RULES

DBMS_STREAMS_ADM.ADD_SUBSET_RULES

See Also: Oracle Streams Concepts and Administration for more information about completing these tasks

Adding Shared Objects to an Existing Multiple-Source Environment

DBMS_STREAMS_ADM.ADD_SCHEMA_RULES

DBMS_STREAMS_ADM.ADD_GLOBAL_RULES

Excluding the ADD_SUBSET_RULES procedure, these procedures can add rules to the positive or negative rule set for a capture process. The ADD_SUBSET_RULES procedure can add rules only to the positive rule set for a capture process.

When you a procedure in the DBMS_STREAMS_ADM package to add the capture process rules, it automatically runs the PREPARE_TABLE_INSTANTIATION, PREPARE_SCHEMA_INSTANTIATION, or PREPARE_GLOBAL_INSTANTIATION procedure in the DBMS_CAPTURE_ADM package for the specified table, specified schema, or entire database, respectively, if the capture process is a local capture process or a downstream capture process with a database link to the source database.

You must run the appropriate procedure to prepare for instantiation manually if any of the following conditions is true:

You use DBMS_RULE_ADM to create or modify rules in a capture process rule set.

You do not add rules for the added objects to a capture process rule set, because the capture process already captures changes to these objects. In this case, rules for the objects can be added to propagations and apply processes in the environment, but not to the capture process.

You use a downstream capture process with no database link to the source database.

If you must prepare for instantiation manually, then see "Preparing Database Objects for Instantiation at a Source Database" on page 10-1 for instructions.

After completing these steps, complete the steps in each of the following sections that apply to your environment. You might need to complete the steps in only one of these sections or in both of these sections:

For each populated database, complete the steps in "Configuring Populated Databases When Adding Shared Objects" on page 8-12. These steps are required only if your environment has more than one populated database.

For each import database, complete the steps in "Adding Shared Objects to Import Databases in an Existing Environment" on page 8-13.