源库caputre:'strmadmin_orcl1capture'获取日志的更改信息,放入'STRMADMIN.ORCL1_QUEUE'这个queue中,
'strmorcl1_propagation'从源库的queue中获取信息再传到remote queue 'STRMADMIN.ORCL2_QUEUE@orcl12'
1.两个库之间建dblink
2.两连建立strmadmin帐号,授予dba权限
3.BEGIN
DBMS_STREAMS_AUTH.GRANT_ADMIN_PRIVILEGE(
grantee => 'strmadmin',
grant_privileges => true);
END;
/
1.源库
BEGIN
DBMS_STREAMS_ADM.SET_UP_QUEUE(
QUEUE_TABLE=>'STRMADMIN.ORCL1_QUEUE_TABLE',
QUEUE_NAME=>'STRMADMIN.ORCL1_QUEUE',
QUEUE_USER=>'strmadmin');
END;
begin
dbms_streams_adm.add_table_rules(
table_name => 'linyu.test',
streams_type => 'capture',
streams_name => 'strmadmin_orcl1capture',
queue_name => 'STRMADMIN.ORCL1_QUEUE',
include_dml => TRUE,
include_ddl => false,include_tagged_lcr => false,inclusion_rule => true);
end;
begin
dbms_streams_adm.add_table_propagation_rules(
table_name => 'linyu.test',
streams_name => 'strmorcl1_propagation',
source_queue_name => 'STRMADMIN.ORCL1_QUEUE',
destination_queue_name => 'STRMADMIN.ORCL2_QUEUE@orcl12',
include_dml => true,
include_ddl => false,
include_tagged_lcr => false,
source_database => 'orcl1',
inclusion_rule => true,queue_to_queue => true);
end;
begin
dbms_capture_adm.start_capture(
capture_name => 'strmadmin_orcl1capture');
end;
2.目标库
BEGIN
DBMS_STREAMS_ADM.SET_UP_QUEUE(
QUEUE_TABLE=>'STRMADMIN.ORCL2_QUEUE_TABLE',
QUEUE_NAME=>'STRMADMIN.ORCL2_QUEUE',
QUEUE_USER=>'STRMADMIN');
END;
begin
dbms_streams_adm.add_table_rules(
table_name => 'linyu.test',
streams_type => 'APPLY',
streams_name => 'strmadmin_orcl2_apply',
queue_name => 'STRMADMIN.ORCL2_QUEUE',
include_dml => true,
include_ddl => false,
source_database => 'ORCL1');
end;
begin
dbms_apply_adm.start_apply(
apply_name => 'strmadmin_orcl2_apply');
end;
来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/7301064/viewspace-474739/,如需转载,请注明出处,否则将追究法律责任。
转载于:http://blog.itpub.net/7301064/viewspace-474739/