--standby db for scn:
begin
for tablename in (select table_name from dba_capture_prepared_tables@oraweb.db1) loop
declare
iscn number;
begin
iscn := dbms_flashback.get_system_change_number();
dbms_apply_adm.set_table_instantiation_scn@oraweb.db2(
source_object_name => 'shenbao.'||tablename.table_name,
source_database_name => 'oraweb.db1',
instantiation_scn => iscn);
exception
when others then
null;
end;
end loop;
end;
--standby db for table data
insert into shenbao.lihj select * from shenbao.lihj@oraweb.db1 a
where not exists (select * from shenbao.lihj b
where a.object_name=b.object_name)
--standby db for start db
declare
app_name varchar2(100);
begin
select apply_name into app_name from dba_apply where rownum=1;
dbms_apply_adm.delete_all_errors(apply_name =>app_name);
dbms_apply_adm.start_apply(apply_name=>app_name);
exception
when others then
null;
end;
--pri db for create stream:
declare
v_tables dbms_utility.uncl_array;
begin
v_tables(1) := 'shenbao.lihj';
v_tables(2) := 'shenbao.VIRTUAL_COLUNN_TEST';
v_tables(3) := 'shenbao.VIRTUAL_COLUMN_PARTITION';
v_tables(4) := 'shenbao.VIRTUAL_COLUMN_PARTITION_pri';
dbms_streams_adm.maintain_tables(
table_names => v_tables,
source_directory_object => null,
destination_directory_object => null,
source_database => 'oraweb.db1',
destination_database => 'oraweb.db2',
perform_actions => true,
bi_directional => false,
include_ddl => true,
instantiation => dbms_streams_adm.instantiation_table_network);
end;
/
--select * from dba_apply_error
--select * from dba_apply
--select capture_name,status from dba_capture;
--select * from dict where table_name like '%capture%'
--select * from dba_capture_prepared_tables
begin
for tablename in (select table_name from dba_capture_prepared_tables@oraweb.db1) loop
declare
iscn number;
begin
iscn := dbms_flashback.get_system_change_number();
dbms_apply_adm.set_table_instantiation_scn@oraweb.db2(
source_object_name => 'shenbao.'||tablename.table_name,
source_database_name => 'oraweb.db1',
instantiation_scn => iscn);
exception
when others then
null;
end;
end loop;
end;
--standby db for table data
insert into shenbao.lihj select * from shenbao.lihj@oraweb.db1 a
where not exists (select * from shenbao.lihj b
where a.object_name=b.object_name)
--standby db for start db
declare
app_name varchar2(100);
begin
select apply_name into app_name from dba_apply where rownum=1;
dbms_apply_adm.delete_all_errors(apply_name =>app_name);
dbms_apply_adm.start_apply(apply_name=>app_name);
exception
when others then
null;
end;
--pri db for create stream:
declare
v_tables dbms_utility.uncl_array;
begin
v_tables(1) := 'shenbao.lihj';
v_tables(2) := 'shenbao.VIRTUAL_COLUNN_TEST';
v_tables(3) := 'shenbao.VIRTUAL_COLUMN_PARTITION';
v_tables(4) := 'shenbao.VIRTUAL_COLUMN_PARTITION_pri';
dbms_streams_adm.maintain_tables(
table_names => v_tables,
source_directory_object => null,
destination_directory_object => null,
source_database => 'oraweb.db1',
destination_database => 'oraweb.db2',
perform_actions => true,
bi_directional => false,
include_ddl => true,
instantiation => dbms_streams_adm.instantiation_table_network);
end;
/
--select * from dba_apply_error
--select * from dba_apply
--select capture_name,status from dba_capture;
--select * from dict where table_name like '%capture%'
--select * from dba_capture_prepared_tables