C Copyright © 2006, Oracle. All rights reserved. Integrating with Oracle Streams
Copyright © 2006, Oracle. All rights reserved. C - 2 Objectives After completing this lesson, you should be able to do the following: Describe how Streams works in a heterogeneous environment Describe how Oracle Streams can be used to integrate data from other systems
Copyright © 2006, Oracle. All rights reserved. C - 3 Oracle-to-Oracle Data Sharing When configuring Streams between two Oracle databases, you configure different components at each site. In a heterogeneous environment, configuration is slightly different. Oracle Capture Apply Oracle Propagation Capture Apply
Copyright © 2006, Oracle. All rights reserved. C - 4 Oracle to Non-Oracle Data Sharing Non-Oracle database Oracle Apply Gateway Capture Heterogeneous Services
Copyright © 2006, Oracle. All rights reserved. C - 5 Oracle to Non-Oracle Data Sharing The capture process functions the same way. The apply process is configured at the Oracle database. No staging queue is created on the non-Oracle database. Only basic DML operations are supported. Captured DDL changes cannot be applied on the non- Oracle database. Error handlers and conflict handlers are not supported. –Conflict detection is supported.
Copyright © 2006, Oracle. All rights reserved. C - 6
Copyright © 2006, Oracle. All rights reserved. C - 7 Oracle to Non-Oracle Data Type Support When applying changes to a non-Oracle database, an apply process applies changes made to columns of only the following data types: CHAR, VARCHAR2 NCHAR, NVARCHAR2 NUMBER, DATE, RAW TIMESTAMP TIMESTAMP WITH TIME ZONE TIMESTAMP WITH LOCAL TIME ZONE INTERVAL YEAR TO MONTH INTERVAL DAY TO SECOND
Copyright © 2006, Oracle. All rights reserved. C - 8 Configuring an Apply Process for an Oracle to Non-Oracle Environment 1.Configure Oracle Net Services, the gateway, and any needed database links (using an explicit CONNECT TO clause). 2.Create an apply process: –Use the CREATE_APPLY procedure of DBMS_APPLY_ADM. –Specify a database link for the apply_database_link parameter. 3.Specify apply process rules. 4.Configure the apply process. 5.Instantiate the tables at the non-Oracle database. 6.Start the Streams processes at the source site.
Copyright © 2006, Oracle. All rights reserved. C - 9
Copyright © 2006, Oracle. All rights reserved. C - 10 Instantiating Tables in an Oracle to Non-Oracle Environment To instantiate tables at the non-Oracle site, perform the following steps: 1.Create tables at the non-Oracle system (if they do not already exist). 2.Prepare the tables for instantiation at the Oracle database. 3.Populate the non-Oracle table with data from the Oracle database that is consistent to a single SCN. 4.Set the instantiation SCN for the table at the Oracle database.
Copyright © 2006, Oracle. All rights reserved. C - 11
Copyright © 2006, Oracle. All rights reserved. C - 12 Non-Oracle to Oracle Data Sharing The user application is responsible for assembling changes at the non-Oracle database as LCRs and enqueuing into the Oracle database. Apply process remains the same: –Rule-based transformations during apply –Conflict detection and resolution Non-Oracle database Oracle Apply User application Enqueue Get changes
Copyright © 2006, Oracle. All rights reserved. C - 13 Non-Oracle to Oracle Streams Configuration 1.Create a Streams queue in the Oracle database. 2.Create an apply process with the apply_captured parameter set to FALSE in the Oracle database. 3.Add rules for LCRs to the apply process rule sets. 4.Start the apply process in the Oracle database. 5.At the non-Oracle site, create a procedure that constructs a row LCR and then enqueues it into the newly created Streams queue. 6.Use this procedure to begin creating and enqueuing LCRs.
Copyright © 2006, Oracle. All rights reserved. C - 14
Copyright © 2006, Oracle. All rights reserved. C - 15 Instantiation in a Non-Oracle to Oracle Environment It is not possible to automatically instantiate tables in an Oracle database whose source tables are in a non-Oracle database. Use the following general steps to manually instantiate the tables: –Use a non-Oracle utility to export the table as a flat file at the source site. –Create an empty table matching the exported table at the destination site. –Use SQL*Loader to load the contents of the flat file into the new table at the destination site.
Copyright © 2006, Oracle. All rights reserved. C - 16 Non-Oracle to Non-Oracle Data Sharing An Oracle database must act as an intermediate database between two non-Oracle databases: The custom user application assembles changes at one non-Oracle database and enqueues them in the Oracle database. The apply process in an Oracle database applies changes to a different non-Oracle database using Heterogeneous Services and a gateway.
Copyright © 2006, Oracle. All rights reserved. C - 17 Oracle Messaging Gateway The following non-Oracle systems are supported: IBM WebSphere MQ JMS (using Oracle JMS) IBM Websphere MQ Series TIBCO TIB/Rendezvous IBM Websphere MQ Series Oracle JDBC Propagation engine MQ driver Messaging Gateway agent
Copyright © 2006, Oracle. All rights reserved. C - 18 XML LCRs Streams has an XML schema for its LCR. Oracle supports multiple techniques for enqueuing these XML LCR messages into the Streams queues: –OCI –PL/SQL –JMS Some third-party vendors of heterogeneous database change capture also publish their own XML schemas for changes.
Copyright © 2006, Oracle. All rights reserved. C - 19 Oracle Call Interface for XML LCRs Is the preferred method of enqueuing the non-Oracle changes into the Oracle database Supports a complete set of transactional capabilities Can use OCIAQEnq or OCIAQEnqArray to enqueue XML LCRs Automatically converts the XML LCRs into the internal LCR representation used by Streams
Copyright © 2006, Oracle. All rights reserved. C - 20 PL/SQL Interface for LCRs Enqueues a single LCR or an array of LCRs Can be invoked from OCI programs Works with user-constructed LCRs, not XML LCRs Uses procedures in the DBMS_AQ package
Copyright © 2006, Oracle. All rights reserved. C - 21 Java Message Service (JMS) Java Message Service (JMS) is a messaging standard defined by Sun Microsystems, Oracle, IBM, and other vendors ( javax.jms package). The Oracle Java Message Service (OJMS) provides a Java API for Oracle, based on the JMS standard ( oracle.jms package): –Supports the standard JMS interfaces –Contains extensions to support administrative operations and other features that are not a part of the standard JMS support for Oracle Streams is available in both Oracle9 i Database Release 2 and Oracle Database 10g.
Copyright © 2006, Oracle. All rights reserved. C - 22 For More Information Messaging Gateway and PL/SQL Enqueue API: –Oracle Streams Advanced Queuing User’s Guide and Reference Heterogeneous support: –Oracle Heterogeneous Connectivity Administrator’s Guide –Oracle Transparent Gateway Administrator’s Guide Integration applications: –Oracle Streams Advanced Queuing User’s Guide and Reference –Streams Advanced Queuing Java API Reference –Java Developer's Guide –Oracle Call Interface Programmer’s Guide
Copyright © 2006, Oracle. All rights reserved. C - 23 Summary In this lesson, you should have learned how to: Describe how Streams works in a heterogeneous environment Describe how Oracle Streams can be used to integrate data from other systems
Copyright © 2006, Oracle. All rights reserved. C - 24