Oracle StreamsOracle Streams enables the propagation and management of data, transactions andevents in a data stream either within a database, or from one database to another. Thestream routes published information to subscribed destinations. The result is a new featurethat provides greater functionality and flexibility than traditional solutions for capturing andmanaging events, and sharing the events with other databases and applications. As users’needs change, they can simply implement a new capability of Oracle Streams, withoutsacrificing existing capabilities.
Starting from release 9.2, Oracle has introduced a more flexible and efficient way of implementingreplication using Streams. Oracle Streams enables the sharing of data and events in a data stream, either within a database or from one database to another.In a nutshell, replication using Oracle Streams is implemented in the following way:1.-A background capture process is configured to capture changes made to tables,schemas, or the entiredatabase. The capture process captures changes from the redo log and formats each captured changeinto a logical change record (LCR). The capture process uses logminer to mine the redo/archive logs toformat LCRs.2.-The capture process enqueues LCR events into a queue that is specified.3.-This queue is scheduled to Propagate events from one queue to another in a different database.4.-A background apply process dequeues the events and applies them at the destination database.The sample code outlines the steps to set up one-way streams replication at Schema level.Partho = Global Database name of the Source (capture) SiteTanu = Global Database name of the Target (apply) SiteSTRMADMIN = Streams Administrator with password strmadminSCOTT = Source schema to be replicated – This schema is already installed on the source siteThe sample code replicates both DML and DDL.STEP 1.- Create user and the streams queue and the database links that will be used for propagation.There are two databases 1. Partho 2. Tanu.Creating a user “Strmadmin” in Partho. as well as in Tanu database.conn /as SYSDBAcreate user STRMADMIN identified by STRMADMIN;ALTER USER STRMADMIN DEFAULT TABLESPACE USERSTEMPORARY TABLESPACE TEMPQUOTA UNLIMITED ON USERS;GRANT CONNECT, RESOURCE, AQ_ADMINISTRATOR_ROLE,DBA to STRMADMIN;execute DBMS_STREAMS_AUTH.GRANT_ADMIN_PRIVILEGE(’STRMADMIN’);===============================================================connect STRMADMIN/STRMADMIN@parthoBEGIN