日期:2014-05-16 浏览次数:20404 次
过程和database level基本一样,本篇只简单介绍下过程
说明:
source 为hrdbprim,target db为hrdb,此处的数据库名称必须和global_name一致
create user STRMADMIN identified by STRM#123; ALTER USER STRMADMIN DEFAULT TABLESPACE USERS TEMPORARY TABLESPACE TEMP QUOTA UNLIMITED ON USERS; GRANT CONNECT, RESOURCE, AQ_ADMINISTRATOR_ROLE,DBA to STRMADMIN; execute DBMS_STREAMS_AUTH.GRANT_ADMIN_PRIVILEGE('STRMADMIN');
connect STRMADMIN/STRM#123@hrdbprim BEGIN DBMS_STREAMS_ADM.SET_UP_QUEUE( queue_table => 'STREAMS_QUEUE_TABLE', queue_name => 'STREAMS_QUEUE', queue_user => 'STRMADMIN'); END; / --CREATE DATABASE LINK AT SOURCE as SYS @BOTH DB conn sys/df as sysdba create public database link HRDB using 'HRDB'; --CREATE DATABASE LINK AT SOURCE as STRMADMIN conn strmadmin/STRM#123 create database link HRDB connect to strmadmin identified by STRM#123;
/* Step 2 - Connect as the Streams Administrator in the target site TARGET and create the streams queue */ conn strmadmin/STRM#123 BEGIN DBMS_STREAMS_ADM.SET_UP_QUEUE( queue_name => 'STREAMS_QUEUE', queue_table =>'STREAMS_QUEUE_TABLE', queue_user => 'STRMADMIN'); END; /
/* STEP 4.- Add apply rules for the Schema at the destination database */ conn strmadmin/STRM#123 BEGIN DBMS_STREAMS_ADM.ADD_SCHEMA_RULES( schema_name => 'WJ', streams_type => 'APPLY ', streams_name => 'STREAM_APPLY', queue_name => 'STRMADMIN.STREAMS_QUEUE', include_dml => true, include_ddl => true, source_database => 'hrdbprim'); END; /d, @source DB
conn strmadmin/STRM#123 BEGIN DBMS_STREAMS_ADM.ADD_SCHEMA_RULES( schema_name => 'WJ', streams_type => 'CAPTURE', streams_name => 'STREAM_CAPTURE', queue_name => 'STRMADMIN.STREAMS_QUEUE', include_dml => true, include_ddl => true, source_database => 'hrdbprim'); END; /
conn strmadmin/STRM#123 BEGIN DBMS_STREAMS_ADM.ADD_SCHEMA_PROPAGATION_RULES( schema_name => 'WJ', streams_name => 'STREAM_PROPAGATE', source_queue_name => 'STRMADMIN.STREAMS_QUEUE', destination_queue_name => 'STRMADMIN.STREAMS_QUEUE@HRDB', include_dml => true, include_ddl =>