日期:2014-05-16 浏览次数:20605 次
alter system set global_names=true scope=both; alter system set "_job_queue_interval"=1 scope=spfile;
3,stream数据库用户strmadmin及权限 @both db
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');
hrdbprim = (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = 10.4.124.239)(PORT = 1521)) (CONNECT_DATA = (SERVER = DEDICATED) (SERVICE_NAME = hrdbprim) ) ) hrdb = (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = 10.4.124.233)(PORT = 1521)) (CONNECT_DATA = (SERVER = DEDICATED) (SERVICE_NAME = hrdb) ) )
conn strmadmin/STRM#123 BEGIN DBMS_STREAMS_ADM.SET_UP_QUEUE( queue_name => 'STREAMS_QUEUE', queue_table =>'STREAMS_QUEUE_TABLE', queue_user => 'STRMADMIN'); END; / conn sys/oracle as sysdba create public database link hrdb using 'hrdb'; conn strmadmin/STRM#123 create database link hrdb connect to strmadmin identified by STRM#123; @target db hrdb conn sys/oracle as sysdba create public database link HRDBPRIM using 'HRDBPRIM'; conn strmadmin/STRM#123 create database link HRDBPRIM connect to strmadmin identified by STRM#123;
b, @target hrdb 建stream队列
/* 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; /c, @source db 建捕获(capture)和传播PROPAGATION 规则
/*Step 3 -Connected to source db, create CAPTURE and PROPAGATION rules */ conn strmadmin/STRM#123@source BEGIN DBMS_STREAMS_ADM.ADD_GLOBAL_PROPAGATION_RULES( streams_name => 'STRMADMIN_PROP', source_queue_name => 'STRMADMIN.STREAMS_QUEUE', destination_queue_name => 'STRMADMIN.STREAMS_QUEUE@hrdb', include_dml => true, include_ddl => true, source_database => 'HRDBPRIM'); END; / BEGIN DBMS_STREAMS_ADM.ADD_GLOBAL_RULES( streams_type => 'CAPTURE', streams_name => 'STRMADMIN_CAPTURE', queue_name => 'STRMADMIN.STREAMS_QUEUE', include_dml => true, include_ddl => true, source_database => 'hrdbprim'); END; /
/*Step 4 - Connected as STRMADMIN at TARGET, create APPLY rules */ conn STRMADMIN/STRMADMIN@TARGET BEGIN DBMS_STREAMS_ADM.ADD_GLOBAL_RULES( streams_type => 'APPLY', streams_name => 'STRMADMIN_APPLY', queue_name => 'STRMADMIN.STREAMS_QUEUE', include_dml => true, include_ddl => true, source_database => 'hrdbprim'); END; / BEGIN DBMS_APPLY_ADM