Hello
I have set up Streams between two databases on the same box. The data is being streamed to different schemas and I have used a transformation. The sysntax is below:
--DESTINATION (MINEDEV)
create tablespace tbs_streams
datafile '/orasis/MINEDEV/streams01.dbf'
size 1000m
logging
extent management local
segment space management auto;
-----------------------------------------------------------------------------------------------------------------------------
--create user
create user STRADMIN identified by sys
default tablespace tbs_streams
temporary tablespace temp;
-----------------------------------------------------------------------------------------------------------------------------
--grant privileges
grant DBA, IMP_FULL_DATABASE, EXP_FULL_DATABASE to STRADMIN;
BEGIN
DBMS_STREAMS_AUTH.GRANT_ADMIN_PRIVILEGE(
grantee => 'stradmin',
grant_privileges => true);
END;
/
commit;
-----------------------------------------------------------------------------------------------------------------------------
--create database link (run as stradmin)
create database link MCSDEV01 connect to stradmin identified by sys using 'MCSDEV01';
--------------------------------------------------------------------------------------------------------------------
--create apply queue
exec dbms_streams_adm.set_up_queue(queue_name =>'APPLY_CENREPLIRPT');
-----------------------------------------------------------------------------------------------------------------
++++++++++++++
---SOURCE (MCSDEV01)
--create tablespace
create tablespace tbs_streams
datafile '/oradata/MCSDEV01/streams01.dbf'
size 1000m
logging
extent management local
segment space management auto;
----------------------------------------------------------------------------------------------------------------------------
--create user
create user STRADMIN identified by sys
default tablespace tbs_streams
temporary tablespace temp;
-----------------------------------------------------------------------------------------------------------------------------
--grant privileges
grant DBA, IMP_FULL_DATABASE, EXP_FULL_DATABASE to STRADMIN;
BEGIN
DBMS_STREAMS_AUTH.GRANT_ADMIN_PRIVILEGE(
grantee => 'stradmin',
grant_privileges => true);
END;
/
commit;
-----------------------------------------------------------------------------------------------------------------------------
--create database link (run as stradmin)
create database link MINEDEV connect to stradmin identified by sys using 'MINEDEV';
-----------------------------------------------------------------------------------------------------------------------------
--create capture queue
exec dbms_streams_adm.set_up_queue(queue_name => 'CAPTURE_CENREPLIRPT');
-----------------------------------------------------------------------------------------------------------------------------
--add supplemental logging on destination
alter table dev_p2.MCSRPTORDNOTSENT
add supplemental log data (all) columns;
alter table dev_p2.MCSRPTSTOCKVAL
add supplemental log data (all) columns;
-----------------------------------------------------------------------------------------------------------------------------
----
--add table rules for capture (MCSRPTORDNOTSENT TABLE)
begin
DBMS_STREAMS_ADM.ADD_TABLE_RULES(
table_name => 'DEV_P2.MCSRPTORDNOTSENT',
streams_type => 'capture',
streams_name => 'CAPTURE_CENREPLIRPT',
queue_name => 'stradmin.CAPTURE_CENREPLIRPT',
include_dml => true,
include_ddl => true,
include_tagged_lcr => false,
inclusion_rule => true);
END;
/
---------------------
--add table rules for capture (MCSRPTSTOCKVAL TABLE)
--get insert LCR's only
begin
DBMS_STREAMS_ADM.ADD_TABLE_RULES(
table_name => 'DEV_P2.MCSRPTSTOCKVAL',
streams_type => 'capture',
streams_name => 'CAPTURE_CENREPLIRPT',
queue_name => 'stradmin.CAPTURE_CENREPLIRPT',
include_dml => true,
include_ddl => true,
include_tagged_lcr => false,
and_condition =>':lcr.get_command_type() = ''INSERT''',
inclusion_rule => true);
END;
/
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
--do this at source
--add table rules for propagation (MCSRPTORDNOTSENT TABLE)
BEGIN
DBMS_STREAMS_ADM.ADD_TABLE_PROPAGATION_RULES(
table_name => 'DEV_P2.MCSRPTORDNOTSENT',
streams_name => 'PROPAGATION_CENREPLIRPT',
source_queue_name => 'stradmin.CAPTURE_CENREPLIRPT',
destination_queue_name => 'stradmin.APPLY_CENREPLIRPT@MINEDEV',
include_dml => true,
include_ddl => true,
source_database => 'MCSDEV01');
END;
/
---------------------------------------
--add table rules for propagation (MCSRPTSTOCKVAL TABLE)
BEGIN
DBMS_STREAMS_ADM.ADD_TABLE_PROPAGATION_RULES(
table_name => 'DEV_P2.MCSRPTSTOCKVAL',
streams_name => 'PROPAGATION_CENREPLIRPT',
source_queue_name => 'stradmin.CAPTURE_CENREPLIRPT',
destination_queue_name => 'stradmin.APPLY_CENREPLIRPT@MINEDEV',
include_dml => true,
include_ddl => true,
source_database => 'MCSDEV01');
END;
/
--enable propagation to change table owner from dev_p2 to cen_repli (dml only)
begin
dbms_streams_adm.rename_schema (
rule_name=>'MCSRPTSTOCKVAL89',
from_schema_name=>'DEV_P2',
to_schema_name=>'CEN_REPLI');
end;
/
begin
dbms_streams_adm.rename_schema (
rule_name=>'MCSRPTORDNOTSENT86',
from_schema_name=>'DEV_P2',
to_schema_name=>'CEN_REPLI');
end;
/
-----------------------------------------------------------------------------------------------------------------------------
--enable grants to the tables to the stradmin user (run on destination)
connect cen_repli/cen_repli
grant all on MCSRPTSTOCKVAL to stradmin;
grant all on MCSRPTORDNOTSENT to stradmin;
-----------------------------------------------------------------------------------------------------------------------------
-----
--add table rules for apply (MCSRPTORDNOTSENT TABLE)
BEGIN
DBMS_STREAMS_ADM.ADD_TABLE_RULES(
table_name => 'CEN_REPLI.MCSRPTORDNOTSENT',
streams_type => 'apply',
streams_name => 'APPLY_CENREPLIRPT',
queue_name => 'stradmin.APPLY_CENREPLIRPT',
include_dml => true,
include_ddl => true,
include_tagged_lcr => false,
source_database => 'MCSDEV01');
END;
/
-------
--add table rules for apply (MCSRPTSTOCKVAL TABLE)
BEGIN
DBMS_STREAMS_ADM.ADD_TABLE_RULES(
table_name => 'CEN_REPLI.MCSRPTSTOCKVAL',
streams_type => 'apply',
streams_name => 'APPLY_CENREPLIRPT',
queue_name => 'stradmin.APPLY_CENREPLIRPT',
include_dml => true,
include_ddl => true,
include_tagged_lcr => false,
source_database => 'MCSDEV01',
and_condition =>':lcr.get_command_type() = ''INSERT''');
END;
/
-------------------------------------------------------------------------------------------------------------------
--prepare the tables for instantiation (AT SOURCE)
exec dbms_capture_adm.prepare_table_instantiation('DEV_P2.MCSRPTSTOCKVAL');
exec dbms_capture_adm.prepare_table_instantiation('DEV_P2.MCSRPTORDNOTSENT');
--get scn (AT SOURCE)
select dbms_flashback.get_system_change_number from dual;
-----------------------------------------------------------------------------------------------------------------------------
--apply the scn at destination
begin
DBMS_APPLY_ADM.SET_table_INSTANTIATION_SCN(
source_object_name => 'DEV_P2.MCSRPTSTOCKVAL',
source_database_name => 'MCSDEV01',
instantiation_scn => 6433730);
END;
/
begin
DBMS_APPLY_ADM.SET_table_INSTANTIATION_SCN(
source_object_name => 'DEV_P2.MCSRPTORDNOTSENT',
source_database_name => 'MCSDEV01',
instantiation_scn => 6433730);
END;
/
------------------------------------------------------------------------------------------------------------------------------------------
I have started apply, capture and propagation through OEM and have inserted some data into one of the destination tables but the data is not streaming across. No error messages are listed either!!! Could someone please help?
Thanks