1a- set up init parameter
global_names=true
job_queue_process=10 ( vary)
streams_pool_size= 200mb
2- set up streams admin on both side
CREATE TABLESPACE streams_tbs
DATAFILE '/u01/app/oracle/oradata/
TEST10G1/streams_tbs.dbf' SIZE 25M;
CREATE USER strmadmin
IDENTIFIED BY strmadmin
DEFAULT TABLESPACE streams_tbs
TEMPORARY TABLESPACE temp
QUOTA UNLIMITED ON streams_tbs;
GRANT CONNECT, RESOURCE, DBA
TO strmadmin;
BEGIN
DBMS_STREAMS_AUTH.GRANT_ADMIN_
PRIVILEGE(
grantee => 'strmadmin',
grant_privileges => true);
END;
/
GRANT SELECT_CATALOG_ROLE
TO strmadmin;
GRANT SELECT ANY DICTIONARY
TO strmadmin;
3- set up supplemental log on both side -( it may not be needed . but not sure)
4- create global name
alter database rename global_name to devora.con.world;
alter database rename global_name to testasm.con.world;
4a- create db link and test
SQL> create database link testasm.con.world
CONNECT TO strmadmin
identified by strmadmin
using 'testasm';
create database link devora.con.world
CONNECT TO strmadmin
identified by strmadmin
using 'devora';
5- create a directory on source side( testasm.con.world)
create or replace directory admin as '/home/oracle/streams';
6. run this script in source db (testasm )
BEGIN
DBMS_STREAMS_ADM.MAINTAIN_SCHEMAS(
schema_names => 'scott',
source_directory_object => 'admin',
destination_directory_object => 'admin',
source_database => 'testasm.con.world',
destination_database => 'devora.con.world',
perform_actions => false,
script_name => 'schema_replication.sql',
script_directory_object => 'admin',
dump_file_name =>'sc1.dmp',
capture_name => 'capture_scott',
capture_queue_table => 'rep_capture_queue_table',
capture_queue_name => 'rep_capture_queue',
capture_queue_user => null,
propagation_name => 'prop_scott',
apply_name => 'apply_scott',
apply_queue_table => 'rep_dest_queue_table',
apply_queue_name => 'rep_dest_queue',
apply_queue_user => null,
log_file => 'exp.log',
bi_directional => false,
include_ddl => true,
instantiation => dbms_streams_adm.instantiation_schema_network
);
END;
/
it will creat a output schema_replication.sql in source db admin directory
and then run the schema_replication.sql in source db and then
run the below script in source db( the only diff between the above and below script is perform_actions => true, )
BEGIN
DBMS_STREAMS_ADM.MAINTAIN_SCHEMAS(
schema_names => 'scott',
source_directory_object => 'admin',
destination_directory_object => 'admin',
source_database => 'testasm.con.world',
destination_database => 'devora.con.world',
perform_actions => true,
script_name => 'schema_replication.sql',
script_directory_object => 'admin',
dump_file_name =>'sc1.dmp',
capture_name => 'capture_scott',
capture_queue_table => 'rep_capture_queue_table',
capture_queue_name => 'rep_capture_queue',
capture_queue_user => null,
propagation_name => 'prop_scott',
apply_name => 'apply_scott',
apply_queue_table => 'rep_dest_queue_table',
apply_queue_name => 'rep_dest_queue',
apply_queue_user => null,
log_file => 'exp.log',
bi_directional => false,
include_ddl => true,
instantiation => dbms_streams_adm.instantiation_schema_network
);
END;
and then you may see data flowing from source to target.
1 comment:
hello...
I saw your post. where is the logfile stored?
how to get the log_file outout.
pl. mail me if you have the answer.
I did the same as mentioned by you. But source got 169 tables. I got inthe target only 163 tables
6 tables missed..
to check why the 6 tables missed. need to know the location of the log file. pl. calrify....
gln.sarma@gmail.com
Post a Comment