I just started playing around with streams and followed the documentation below where I can data being moved from one table to another table in different DB's.
Is there a mechansim that I can use, which will allow me to stream all the tables for a user or does this have to be done on a table by table basis.
If can set it up for all the tables for a user can somebody please provide me with an example, while following the parameters/settings in the documentation below.
Oracle Streams Setup between two database
OverviewDatabase Version: 10.1.0.5.0Windows XP sp2
Database Name and TNS nameDB1, db1 (source)DB2, db2 (target)
Set up below parameters on both databases (db1, db2)
1. Enable ARCHIVELOG MODE on both databaseReference:
DB1SQL> conn sys@db1 as sysdbaEnter password:Connected.
SQL> create user strmadmin identified by strmadmin;
User created.
SQL> grant connect, resource, dba to strmadmin;
Grant succeeded.
SQL> exec dbms_streams_auth.grant_admin_privilege (grantee => 'strmadmin', grant_privileges => true);
PL/SQL procedure successfully completed.
SQL> grant select_catalog_role, select any dictionary to strmadmin;
Grant succeeded.
Target Database:
DB2SQL> conn sys@db2 as sysdbaEnter password:Connected.
SQL> create user strmadmin identified by strmadmin;
User created.
SQL> grant connect, resource, dba to strmadmin;
Grant succeeded.
SQL> exec dbms_streams_auth.grant_admin_privilege (grantee => 'strmadmin', grant_privileges => true);
PL/SQL procedure successfully completed.
SQL> grant select_catalog_role, select any dictionary to strmadmin;
Grant succeeded.
3. Setup INIT parametersSource Database:
DB1SQL> conn sys@db1 as sysdba
Enter password:
Connected.
SQL> alter system set global_names=true;
System altered.
SQL> alter system set streams_pool_size = 100 m;
System altered.
Target Database:
DB2SQL> conn sys@db2 as sysdba
Enter password:
Connected.
SQL> alter system set global_names=true;
System altered.
SQL> alter system set streams_pool_size = 100 m;
System altered.
4. Create Database Link Target Database:
DB1SQL> conn strmadmin/strmadmin@db1Connected.
SQL> create database link db2 connect to strmadmin identified by strmadmin using 'DB2';
Database link created.
Source Database:
DB2SQL> conn strmadmin/strmadmin@db2Connected.
SQL> create database link db1 connect to strmadmin identified by strmadmin using 'DB1';
Database link created.
5. Setup Source and Destination queuesSource Database:
DB1SQL> conn strmadmin/strmadmin@db1
Connected.
SQL> EXEC DBMS_STREAMS_ADM.SET_UP_QUEUE();
PL/SQL procedure successfully completed.
Target Database:
DB2SQL> conn strmadmin/strmadmin@db2Connected.
SQL> EXEC DBMS_STREAMS_ADM.SET_UP_QUEUE();
PL/SQL procedure successfully completed.
5. Setup Schema for streamsSchema: SCOTTTable: tryNOTE: Unlock scott schema because in 10g scott schema is locked by defaultSource Database:
DB1SQL> conn sys@db1 as sysdba
Enter password:
Connected.
SQL> alter user scott account unlock identified by tiger;
User altered.
SQL> conn scott/tiger@db1Connected.SQL> create table try ( no number primary key,name varchar2(20),ddate date);
Table created.
Target Database:
DB2SQL> conn sys@db2 as sysdbaEnter password:Connected.
SQL> alter user scott account unlock identified by tiger;
User altered.
SQL> conn scott/tiger@db2Connected.
SQL> create table try ( no number primary key,name varchar2(20),ddate date);
Table created.
7. Setup Supplemental logging at the source databaseSource Database:
DB1SQL> conn scott/tiger@db1Connected.
SQL> alter table try add supplemental log data (primary key,unique) columns;
Table altered.
8. Configure capture process at the source databaseSource Database:
DB1SQL> conn strmadmin/strmadmin@db1Connected.
SQL> exec dbms_streams_adm.add_table_rules ( table_name => 'scott.try', streams_type => 'capture', streams_name => 'capture_stream', queue_name=> 'strmadmin.streams_queue', include_dml => true, include_ddl => true, inclusion_rule => true);
PL/SQL procedure successfully completed.
Bookmarks