Settings of Oracle Database snap

Source: Internet
Author: User

Snap is used to extract one or more tables from a database to the local database. The operations are as follows:

-- Glossary: Source-database to be synchronized

-- Purpose -- database to be synchronized

/* 1. Create a dblink :*/

-- 1. Create dblink on the target database

Drop database link rac;

Create public

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

-- The username, password, and server name of the source database. The rac here is the database connection name for future access. The vm is the string used to connect to the source database.

/* 2. Create a snapshot :*/

-- 1. Execute the statement on both the source and target databases to create the table to be synchronized.

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. Test on the target database

Dblink select * from big_table @ rac;

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

Select * from big_table;

-- 3. Create a snapshot log for the table to be synchronized in the source database

Create snapshot log on big_table;

Create snapshot log on big_table;

-- 4. Create a snapshot. the snapshot must be started when the Database Service is synchronized (source)

Create snapshot big as select * from big_table @ rac;

Create snapshot big as select * from big_table @ rac;

-- 5. Set the snapshot refresh time

Alter snapshot anson refresh fast Start with sysdate + 1/24*60 next sysdate + 10/24*60;

-- Oracle automatically performs the first quick refresh in 1 minute, and then refresh every 10 minutes.

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 automatically performs the first full refresh after 30 banknote, and then completely refresh every other day

-- 6. manually refresh the snapshot

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

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

End;

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

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.