--Noun description:
source--the database to be synchronized--
destination--the database to be synchronized
/*1. Create dblink:*/
--1. Create dblink on the destination database
drop database link dblink_anson;
Create public database link dblink_anson Connect to lg identified by lg using 'SDLGDB'; --源数据库的用户名、密码、服务器名
/*2. Create a snapshot:*/
--1. Execute the following statements on the source and destination databases at the same time to create the tables to be synchronized.
drop table tb_anson; create table tb_anson(c1 varchar2(12));
alter table tb_anson add constraint pk_anson primary key (C1);
--2. Test dblink on the target database
select * from tb_anson@dblink_anson;
select * from tb_anson;
--3. On the destination database, create a snapshot log of the table to be synchronized.
Create snapshot log on tb_anson;
--4. Create a snapshot, snapshot (the synchronized (source) database service must be started)
Create snapshot sn_anson as select * from mailto:tb_zhaozhenlong_1@dblink_zhaozhenlong_1;
--5. Set snapshot refresh time
Alter snapshot anson refresh fast Start with sysdate+1/24*60 next sysdate+10/24*60; --oracle自动在1分钟后进行第一次快速刷新,以后每隔10分钟快速刷新一次
Alter snapshot anson refresh complete Start with sysdate+30/24*60*60 next sysdate+1; --oracle自动在30钞后进行第一次完全刷新,以后每隔1天完全刷新一次
--6. Manually refresh snapshots
begin
dbms_refresh.refresh('"CS"."SN_ANSON"');
end;