Oracle® Streams Replication Administrator's Guide 10g Release 1 (10.1) Part Number B10728-01 |
|
|
View PDF |
This chapter contains conceptual information about instantiation and Streams replication.
This chapter contains these topics:
In a Streams environment that shares a database object within a single database or between multiple databases, a source database is the database where changes to the object are generated in the redo log, and a destination database is the database where these changes are dequeued by an apply process. If a capture process captures, or will capture, such changes, and the changes will be applied locally or propagated to other databases and applied at destination databases, then you must instantiate these source database objects before you can replicate changes to the objects. If a database where changes to the source database objects will be applied is a different database than the source database, then the destination database must have a copy of these database objects.
In Streams, the following general steps instantiate a database object:
In some cases, Step 1 and Step 3 are completed automatically. For example, when you add rules for an object to the positive rule set for a capture process by running a procedure in the DBMS_STREAMS_ADM
package, the object is prepared for instantiation automatically. Also, when you use export/import or transportable tablespaces to copy database objects from a source database to a destination database, instantiation SCNs may be set for these objects automatically.
If the database object being instantiated is a table, then the objects at the source and destination database do not need to be an exact match. However, if some or all of the table data is replicated between the two databases, then the data that is replicated should be consistent when the table is instantiated. Whenever you plan to replicate changes to a database object, you must always prepare the object for instantiation at the source database and set the instantiation SCN for the object at the destination database. By preparing an object for instantiation, you are setting the lowest SCN for which changes to the object may need to be applied at destination databases. This SCN is called the ignore SCN. You should prepare a database object for instantiation after a capture process has been configured to capture changes to the object.
When you instantiate tables using export/import, transportable tablespaces, or RMAN, any table supplemental log group specifications are retained for the instantiated tables. That is, after instantiation, log group specifications for imported tables at the import database are the same as the log group specifications for these tables at the export database. If you do not want to retain supplemental log group specifications for tables at the import database, then you can drop specific supplemental log groups after import.
Database supplemental logging specifications are not retained during export/import, even if you perform a full database export/import. However, RMAN retains database supplemental logging specifications at the instantiated database.
The following sections provide more information about instantiation and Streams replication:
See Also:
|
The following procedures in the DBMS_CAPTURE_ADM
package prepare database objects for instantiation:
PREPARE_TABLE_INSTANTIATION
prepares a single table for instantiation.PREPARE_SCHEMA_INSTANTIATION
prepares for instantiation all of the database objects in a schema and all database objects added to the schema in the future.PREPARE_GLOBAL_INSTANTIATION
prepares for instantiation all of the database objects in a database and all database objects added to the database in the future.These procedures record the lowest SCN of each object for instantiation. SCNs subsequent to the lowest SCN for an object can be used for instantiating the object. These procedures also populate the Streams data dictionary for the relevant capture processes, propagations, and apply processes that capture, propagate, or apply changes made to the table, schema, or database being prepared for instantiation.
When you add rules to the positive rule set for a capture process by running a procedure in the DBMS_STREAMS_ADM
package, a procedure in the DBMS_CAPTURE_ADM
package is run automatically on the database objects whose changes will be captured by the capture process. The following table lists which procedure is run in the DBMS_CAPTURE_ADM
package when you run a procedure in the DBMS_STREAMS_ADM
package.
More than one call to prepare for instantiation is allowed. When capture process rules are created by the DBMS_RULE_ADM
package instead of the DBMS_STREAMS_ADM
package, you must run the appropriate procedure manually to prepare each table, schema, or database whose changes will be captured for instantiation, if you plan to apply changes that result from these capture process rules with an apply process.
If you are using downstream capture, and the downstream capture process uses a database link from the downstream database to the source database, then the objects are prepared for instantiation automatically. However, if the downstream capture process does not use a database link from the downstream database to the source database, then you must prepare the objects for instantiation manually.
Whenever you add, or modify the condition of, a capture process, propagation, or apply process rule for an object that is in a positive rule set, you must run the appropriate procedure to prepare the object for instantiation at the source database if any of the following conditions are met:
Whenever you remove, or modify the condition of, a capture process, propagation, or apply process rule for an object that is in a negative rule set, you must run the appropriate procedure to prepare the object for instantiation at the source database if any of the following conditions are met:
When any of these conditions are met for changes to a positive or negative rule set, you must prepare the relevant database objects for instantiation at the source database to populate any relevant Streams data dictionary that requires information about the source object, even if the object already exists at a remote database where the rules were added or changed.
The relevant Streams data dictionaries are populated asynchronously for both the local dictionary and all remote dictionaries. The procedure that prepares for instantiation adds information to the redo log at the source database. The local Streams data dictionary is populated with the information about the object when a capture process captures these redo entries, and any remote Streams data dictionaries are populated when the information is propagated to them.
See Also:
|
The following sections contain information about Streams instantiations that use Oracle Data Pump.
See Also:
|
During export, Oracle Data Pump automatically uses the Oracle Flashback feature to ensure that the exported data and the exported procedural actions for each object are consistent to a single point in time. When you perform an instantiation in a Streams environment, some degree of consistency is required. Using the Data Pump Export utility is sufficient to ensure this consistency for Streams instantiations.
If you are using an export dump file for other purposes in addition to a Streams instantiation, and these other purposes have more stringent consistency requirements than those provided by Data Pump's default export, then you can use the Data Pump Export utility parameters FLASHBACK_SCN
or FLASHBACK_TIME
for Streams instantiations. For example, if an export includes objects with foreign key constraints, then more stringent consistency may be required.
The following sections provide more information about Oracle Data Pump import and Streams instantiation.
During Data Pump import, an instantiation SCN is set at the import database for each database object that was prepared for instantiation at the export database before the Data Pump export was performed. The instantiation SCN settings are based on metadata obtained during Data Pump export.
A Data Pump import session may set its Streams tag to the hexadecimal equivalent of '00'
to avoid cycling the changes made by the import. Redo entries resulting from such an import have this tag value.
Whether the import session tag is set to the hexadecimal equivalent of '00'
depends on the export that is being imported. Specifically, the import session tag is set to the hexadecimal equivalent of '00'
in either of the following cases:
FULL
or SCHEMA
mode.TABLE
or TABLESPACE
mode and at least one table included in the export was prepared for instantiation at the export database before the export was performed.If neither one of these conditions is true for a Data Pump export that is being imported, then the import session tag is NULL
.
The STREAMS_CONFIGURATION
Data Pump Import utility parameter specifies whether to import any general Streams metadata that may be present in the export dump file. This import parameter is relevant only if you are performing a full database import. By default the STREAMS_CONFIGURATION
Import utility parameter is set to y
. Typically, specify y
if an import is part of a backup or restore operation.
The following objects are imported regardless of the STREAMS_CONFIGURATION
setting if the information is present in the export dump file:
SYS.AnyData
queues and their queue tablesDBMS_STREAMS_ADM
package are run, while non-Streams rules are rules created using the DBMS_RULE_ADM
package.
If the STREAMS_CONFIGURATION
parameter is set to n
, then information about Streams rules is not imported into the following data dictionary views: ALL_STREAMS_RULES
, ALL_STREAMS_GLOBAL_RULES
, ALL_STREAMS_SCHEMA_RULES
, ALL_STREAMS_TABLE_RULES
, DBA_STREAMS_RULES
, DBA_STREAMS_GLOBAL_RULES
, DBA_STREAMS_SCHEMA_RULES
, and DBA_STREAMS_TABLE_RULES
. However, regardless of the STREAMS_CONFIGURATION
parameter setting, information about these rules is imported into the ALL_RULES
, ALL_RULE_SETS
, ALL_RULE_SET_RULES
, DBA_RULES
, DBA_RULE_SETS
, DBA_RULE_SET_RULES
, USER_RULES
, USER_RULE_SETS
, and USER_RULE_SET_RULES
data dictionary views.
When the STREAMS_CONFIGURATION
Import utility parameter is set to y
, the import includes the following information, if the information is present in the export dump file; when the STREAMS_CONFIGURATION
Import utility parameter is set to n
, the import does not include the following information:
DBA_CAPTURE
data dictionary view.DBA_CAPTURE
data dictionary view.SYS.AnyData
queue that is used by a Streams client, either started or stopped. Streams clients include capture processes, propagations, apply process, and messaging clients. SYS.AnyData
queues themselves are imported regardless of the STREAMS_CONFIGURATION
Import utility parameter setting.DBA_APPLY_PROGRESS
data dictionary view, including applied message number, oldest message number (oldest SCN), apply time, and applied message create timeDBA_APPLY
data dictionary view.DBA_APPLY
data dictionary view.STREAMS_CONFIGURATION
parameter.This section describes parameters for the original Export and Import utilities that are relevant to Streams.
See Also:
|
The OBJECT_CONSISTENT
Export utility parameter specifies whether or not the Export utility repeatedly uses the SET
TRANSACTION
READ
ONLY
statement to ensure that the exported data and the exported procedural actions for each object are consistent to a single point in time. If OBJECT_CONSISTENT
is set to y
, then each object is exported in its own read-only transaction, even if it is partitioned. In contrast, if you use the CONSISTENT
Export utility parameter, then there is only one read-only transaction.
When you perform an instantiation in a Streams environment, some degree of consistency is required for the database objects being instantiated. The OBJECT_CONSISTENT
Export utility parameter is sufficient to ensure this consistency for Streams instantiations. If you are using an export dump file for other purposes in addition to a Streams instantiation, and these other purposes have more stringent consistency requirements than those provided by OBJECT_CONSISTENT
, then you can use Export utility parameters CONSISTENT
, FLASHBACK_SCN
, or FLASHBACK_TIME
for Streams instantiations. For example, if an export includes objects with foreign key constraints, then more stringent consistency may be required.
By default the OBJECT_CONSISTENT
Export utility parameter is set to n
. Specify y
when an export is performed as part of a Streams instantiation and no more stringent Export utility parameter is needed.
The following parameters for the original Import utility are relevant to Streams.
The STREAMS_INSTANTIATION
Import utility parameter specifies whether to import Streams instantiation metadata that may be present in the export dump file. When this parameter is set to y
, and the export dump file contains the metadata for instantiation SCNs, an instantiation SCN is set at the import database for each database object imported.
In addition, when this parameter is set to y
, the import session sets its Streams tag to the hexadecimal equivalent of '00'
to avoid cycling the changes made by the import. Redo entries resulting from the import have this tag value.
By default the STREAMS_INSTANTIATION
Import utility parameter is set to n
. Specify y
when an import is performed as part of a Streams instantiation.
The STREAMS_CONFIGURATION
Import utility parameter behaves the same for the original Import utility and the Data Pump Import utility.
See Also:
"The STREAMS_CONFIGURATION Data Pump Import Utility Parameter" for more information about this parameter |