Oracle資料庫snap的設定

來源:互聯網
上載者:User

snap用於從一個資料庫中提取一張或多張表的到本機資料庫,操作如下:

——名詞說明:源——被同步的資料庫

—— 目的——要同步到的資料庫

 /*一、建立dblink:*/

 ——1、在目的資料庫上,建立dblink

 drop database link rac;

create public

 database link rac connect to fzs identified by ljkj using 'vm';

——來源資料庫的使用者名稱、密碼、伺服器名,這裡的rac是資料庫連接名,用於以後的訪問,vm為串連來源資料庫的字串。

 /*二、建立快照:*/

——1、在源和目的資料庫上同時執行一下語句,建立要被同步的表

 create table big_table(c1 varchar2(12));

alter table big_table add constraint pk_big_table primary key (C1);

create table big_table(c1 varchar2(12));alter table big_table add constraint pk_big_table primary key (C1);

 ——2、在目的資料庫上,測試

dblink select * from big_table@rac;

select * from big_table; select * from big_table@rac;

select * from big_table;

 ——3、在來源資料庫上,建立要同步表的快照日誌

 create snapshot log on big_table;

create snapshot log on big_table;

 ——4、建立快照,快照(被同步(源)資料庫服務必須啟動)

create snapshot big as select * from big_table@rac;

create snapshot big as select * from big_table@rac;

——5、設定快照重新整理時間

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;

Alter snapshot anson refresh complete Start with sysdate+30/24*60*60 next sysdate+1;

 ——oracle自動在30鈔後進行第一次完全重新整理,以後每隔1天完全重新整理一次

——6、手動重新整理快照

begin dbms_refresh.refresh('"CS"."big"');

end; begin dbms_refresh.refresh('"FZS"."BIG"');

end;

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.