5 Configuring Implicit Capture
Implicit capture means that a capture process or a synchronous capture captures and enqueues database changes automatically. A capture process captures changes in the redo log, while a synchronous capture captures data manipulation language (DML) changes with an internal mechanism. Both capture processes and synchronous captures reformat the captured changes into logical change records (LCRs) and enqueue the LCRs into an ANYDATA
queue.
The following topics describe configuring implicit capture:
Each task described in this chapter should be completed by an Oracle Streams administrator that has been granted the appropriate privileges, unless specified otherwise.
See Also:
-
Oracle Streams Concepts and Administration for more information about implicit capture
-
"Configuring an Oracle Streams Administrator on All Databases"
5.1 Configuring a Capture Process
You can create a capture process that captures changes either locally at the source database or remotely at a downstream database. A downstream capture process runs on a downstream database, and redo data from the source database is copied to the downstream database. A downstream capture process captures changes in the copied redo data at the downstream database.
You can use any of the following procedures to create a local capture process:
Each of the procedures in the DBMS_STREAMS_ADM
package creates a capture process with the specified name if it does not already exist, creates either a positive rule set or negative rule set for the capture process if the capture process does not have such a rule set, and can add table rules, schema rules, or global rules to the rule set.
The CREATE_CAPTURE
procedure creates a capture process, but does not create a rule set or rules for the capture process. However, the CREATE_CAPTURE
procedure enables you to specify an existing rule set to associate with the capture process, either as a positive or a negative rule set, a first SCN, and a start SCN for the capture process. Also, to create a capture process that performs downstream capture, you must use the CREATE_CAPTURE
procedure.
The following sections describe configuring a capture process:
Note:
When a capture process is started or restarted, it might need to scan redo log files with a FIRST_CHANGE#
value that is lower than start SCN. Removing required redo log files before they are scanned by a capture process causes the capture process to abort. You can query the DBA_CAPTURE
data dictionary view to determine the first SCN, start SCN, and required checkpoint SCN for a capture process. A capture process needs the redo log file that includes the required checkpoint SCN, and all subsequent redo log files. See Oracle Streams Concepts and Administration for more information about the first SCN and start SCN for a capture process.
Note:
-
You can configure an entire Oracle Streams environment, including capture processes, using procedures in the
DBMS_STREAMS_ADM
package or Oracle Enterprise Manager Cloud Control. See Simple Oracle Streams Replication Configuration. -
After creating a capture process, avoid changing the
DBID
or global name of the source database for the capture process. If you change either theDBID
or global name of the source database, then the capture process must be dropped and re-created. See "Changing the DBID or Global Name of a Source Database". -
To configure downstream capture, the source database must be an Oracle Database 10g Release 1 or later database.
5.1.1 Preparing to Configure a Capture Process
The following tasks must be completed before you configure a capture process:
-
Complete the following tasks in "Tasks to Complete Before Configuring Oracle Streams Replication".
-
If you plan to create a real-time or an archived-log downstream capture process that uses redo transport services to transfer archived redo log files to the downstream database automatically, then complete the steps in "Configuring Log File Transfer to a Downstream Capture Database".
-
If you plan to create a real-time downstream capture process, then complete the steps in "Adding Standby Redo Logs for Real-Time Downstream Capture".
-
Create an
ANYDATA
queue to associate with the capture process, if one does not exist. See "Creating an ANYDATA Queue" for instructions. The examples in this chapter assume that the queue used by the capture process isstrmadmin.streams_queue
. Create the queue on the same database that will run the capture process.
5.1.2 Configuring a Local Capture Process
The following sections describe using the DBMS_STREAMS_ADM
package and the DBMS_CAPTURE_ADM
package to create a local capture process.
This section contains the following examples:
5.1.2.1 Configuring a Local Capture Process Using DBMS_STREAMS_ADM
To configure a local capture process using the DBMS_STREAMS_ADM
package, complete the following steps:
See Also:
-
Oracle Streams Concepts and Administration for more information about rules
5.1.2.2 Configuring a Local Capture Process Using DBMS_CAPTURE_ADM
To configure a local capture process using the DBMS_CAPTURE_ADM
package, complete the following steps:
See Also:
Oracle Streams Concepts and Administration for more information about rules
5.1.2.3 Configuring a Local Capture Process with Non-NULL Start SCN
This example runs the CREATE_CAPTURE
procedure in the DBMS_CAPTURE_ADM
package to create a local capture process with a start SCN set to 223525
. This example assumes that there is at least one local capture process at the database, and that this capture process has taken at least one checkpoint. You can always specify a start SCN for a new capture process that is equal to or greater than the current SCN of the source database. To specify a start SCN that is lower than the current SCN of the database, the specified start SCN must be higher than the lowest first SCN for an existing local capture process that has been started successfully at least once and has taken at least one checkpoint.
You can determine the first SCN for existing capture processes, and whether these capture processes have taken a checkpoint, by running the following query:
SELECT CAPTURE_NAME, FIRST_SCN, MAX_CHECKPOINT_SCN FROM DBA_CAPTURE;
Your output looks similar to the following:
CAPTURE_NAME FIRST_SCN MAX_CHECKPOINT_SCN ------------------------------ ---------- ------------------ CAPTURE_SIMP 223522 230825
These results show that the capture_simp
capture process has a first SCN of 223522
. Also, this capture process has taken a checkpoint because the MAX_CHECKPOINT_SCN
value is non-NULL
. Therefore, the start SCN for the new capture process can be set to 223522
or higher.
To configure a local capture process with a non-NULL
start SCN, complete the following steps:
See Also:
-
Oracle Database PL/SQL Packages and Types Reference for more information about setting the
first_scn
andstart_scn
parameters in theCREATE_CAPTURE
procedure
5.1.3 Configuring a Downstream Capture Process
This section describes configuring a real-time or archived-log downstream capture process.
This section contains these topics:
5.1.3.1 Configuring a Real-Time Downstream Capture Process
To create a capture process that performs downstream capture, you must use the CREATE_CAPTURE
procedure. The example in this section describes creating a real-time downstream capture process that uses a database link to the source database. However, a real-time downstream capture process might not use a database link.
This example assumes the following:
-
The source database is
dbs1.example.com
and the downstream database isdbs2.example.com
. -
The capture process that will be created at
dbs2.example.com
uses thestrmadmin.streams_queue
. -
The capture process will capture DML changes to the
hr.departments
table.
This section contains an example that runs the CREATE_CAPTURE
procedure in the DBMS_CAPTURE_ADM
package to create a real-time downstream capture process at the dbs2.example.com
downstream database that captures changes made to the dbs1.example.com
source database. The capture process in this example uses a database link to dbs1.example.com
for administrative purposes. The name of the database link must match the global name of the source database.
Note:
You can configure multiple real-time downstream capture processes that captures changes from the same source database, but you cannot configure real-time downstream capture for multiple source databases at one downstream database.
See Also:
Oracle Streams Concepts and Administration for conceptual information about real-time downstream capture
Complete the following steps:
5.1.3.2 Configuring an Archived-Log Downstream Capture Process
This section describes configuring an archived-log downstream capture process that either assigns log files implicitly or explicitly.
This section contains these topics:
5.1.3.2.1 Configuring an Archived-Log Downstream Capture Process that Assigns Logs Implicitly
To create a capture process that performs downstream capture, you must use the CREATE_CAPTURE
procedure. The example in this section describes creating an archived-log downstream capture process that uses a database link to the source database for administrative purposes. The name of the database link must match the global name of the source database.
This example assumes the following:
-
The source database is
dbs1.example.com
and the downstream database isdbs2.example.com
. -
The capture process that will be created at
dbs2.example.com
uses thestreams_queue
owned bystrmadmin
. -
The capture process will capture data manipulation language (DML) changes made to the
hr.departments
table atdbs1.example.com
. -
The capture process assigns log files implicitly. That is, the downstream capture process automatically scans all redo log files added by redo transport services or added manually from the source database to the downstream database.
Complete the following steps:
5.1.3.2.2 Configuring an Archived-Log Downstream Capture Process that Assigns Logs Explicitly
To create a capture process that performs downstream capture, you must use the CREATE_CAPTURE
procedure. This section describes creating an archived-log downstream capture process that assigns redo log files explicitly. That is, you must use the DBMS_FILE_TRANSFER
package, FTP, or some other method to transfer redo log files from the source database to the downstream database, and then you must register these redo log files with the downstream capture process manually.
In this example, assume the following:
-
The source database is
dbs1.example.com
and the downstream database isdbs2.example.com
. -
The capture process that will be created at
dbs2.example.com
uses thestreams_queue
owned bystrmadmin
. -
The capture process will capture data manipulation language (DML) changes made to the
hr.departments
table atdbs1.example.com
. -
The capture process does not use a database link to the source database for administrative actions.
Complete the following steps:
5.1.4 After Configuring a Capture Process
If you plan to configure propagations and apply processes that process logical change records (LCRs) captured by the new capture process, then perform the configuration in the following order:
- Create all of the queues that will be required propagations and apply processes in the replication environment. See "Creating an ANYDATA Queue".
- Create all of the propagations that will propagate LCRs captured by the new capture process. See "Creating Oracle Streams Propagations Between ANYDATA Queues".
- Create all of the apply processes that will dequeue and process LCRs captured by the new capture process. See Configuring Implicit Apply. Configure each apply process to apply captured LCRs.
- Instantiate the tables for which the new capture process captures changes at all destination databases. See Instantiation and Oracle Streams Replication for detailed information about instantiation.
- Use the
START_APPLY
procedure in theDBMS_APPLY_ADM
package to start the apply processes that will process LCRs captured by the new capture process. - Use the
START_CAPTURE
procedure in theDBMS_CAPTURE_ADM
package to start the new capture process.
Note:
Other configuration steps might be required for your Oracle Streams environment. For example, some Oracle Streams environments include transformations, apply handlers, and conflict resolution.
5.2 Configuring Synchronous Capture
You can use any of the following procedures to create a synchronous capture:
Both of the procedures in the DBMS_STREAMS_ADM
package create a synchronous capture with the specified name if it does not already exist, create a positive rule set for the synchronous capture if it does not exist, and can add table rules or subset rules to the rule set.
The CREATE_SYNC_CAPTURE
procedure creates a synchronous capture, but does not create a rule set or rules for the synchronous capture. However, the CREATE_SYNC_CAPTURE
procedure enables you to specify an existing rule set to associate with the synchronous capture, and it enables you to specify a capture user other than the default capture user.
The following sections describe configuring a synchronous capture:
5.2.1 Preparing to Configure a Synchronous Capture
The following tasks must be completed before you configure a synchronous capture:
-
Complete the following tasks in "Tasks to Complete Before Configuring Oracle Streams Replication".
-
Create
ANYDATA
queues to associate with the synchronous capture, if they do not exist. See "Creating an ANYDATA Queue" for instructions. The queue must be a commit-time queue. The examples in this chapter assume that the queue used by synchronous capture isstrmadmin.streams_queue
. Create the queue in the same database that will run the synchronous capture. -
Create
ANYDATA
queues to associate with the propagations that will propagate logical change records (LCRs) captured by the synchronous capture and apply processes that will dequeue and process LCRs captured by the synchronous capture, if they do not exist. See "Creating an ANYDATA Queue" for instructions. -
Create all of the propagations that will propagate LCRs captured by the new synchronous capture. See "Creating Oracle Streams Propagations Between ANYDATA Queues".
-
Create all of the apply processes that will dequeue and process LCRs captured by the new synchronous capture. See "Creating an Apply Process for Persistent LCRs with DBMS_APPLY_ADM". Configure each apply process to apply persistent LCRs by setting the
apply_captured
parameter toFALSE
in theDBMS_APPLY_ADM.CREATE_APPLY
procedure. Do not start the apply process until after the instantiation performed in "After Configuring a Synchronous Capture" is complete. -
Ensure that the Oracle Streams administrator is granted
DBA
role. The Oracle Streams administrator must be grantedDBA
role to create a synchronous capture.
5.2.2 Configuring a Synchronous Capture Using the DBMS_STREAMS_ADM Package
When you run the ADD_TABLE_RULES
or ADD_SUBSET_RULES
procedure to create a synchronous capture, set the streams_type
parameter in these procedures to sync_capture
. A rule created by the ADD_TABLE_RULES
procedure instructs the synchronous capture to capture all data manipulation language (DML) changes to the table. A rule created by the ADD_SUBSET_RULES
procedure instructs the synchronous capture to capture a subset of the DML changes to the table.
This example assumes the following:
-
The source database is
dbs1.example.com
. -
The synchronous capture that will be created uses the
strmadmin.streams_queue
queue. -
The synchronous capture that will be created captures the results of DML changes made to the
hr.departments
table. -
The capture user for the synchronous capture that will be created is the Oracle Streams administrator
strmadmin
.
Complete the following steps to create a synchronous capture using the DBMS_STREAMS_ADM
package:
5.2.3 Configuring a Synchronous Capture Using the DBMS_CAPTURE_ADM Package
This section contains an example that runs procedures in the DBMS_CAPTURE_ADM
package and DBMS_STREAMS_ADM
package to configure a synchronous capture.
This example assumes the following:
-
The source database is
dbs1.example.com
. -
The synchronous capture that will be created uses the
strmadmin.streams_queue
queue. -
The synchronous capture that will be created uses an existing rule set named
sync01_rule_set
in thestrmadmin
schema. -
The synchronous capture that will be created captures the results of a subset of the DML changes made to the
hr.departments
table. -
The capture user for the synchronous capture that will be created is
hr
. Thehr
user must have privileges to enqueue into thestreams_queue
.
Complete the following steps to create a synchronous capture using the DBMS_CAPTURE_ADM
package:
5.2.4 After Configuring a Synchronous Capture
If you configured propagations and apply processes that process logical change records (LCRs captured) by the new synchronous capture, then complete the following steps:
- Instantiate the tables for which the new synchronous capture captures changes at all destination databases. See Instantiation and Oracle Streams Replication for detailed information about instantiation.
- Use the
START_APPLY
procedure in theDBMS_APPLY_ADM
package to start the apply processes that will process LCRs captured by the new synchronous capture.
Note:
Other configuration steps might be required for your Oracle Streams environment. For example, some Oracle Streams environments include transformations, apply handlers, and conflict resolution.