Oracle 10g Snapshot Operation method _oracle

Source: Internet
Author: User
Tags flushes

Accidentally heard of the Oracle database snapshot, the word I had a listen to be stunned, do not know what this is, and then spent a little time to study the next, the following is my summary of learning through the network

Snapshots are primarily for distributed databases, we have a table A in database a,a, we use data from table A in database B, so we can create a snapshot of database A in database B, which can improve our efficiency.

I understand that a snapshot is a copy of a table, and periodically copy a table to table B (including data)

Note: tables created with snapshots are read-only

How to create a snapshot :

1, the first need to establish a database in a snapshot of table a log

You must establish a snapshot log of table A to perform a quick refresh in the snapshot

Create snapshot log on A;

2, under the database B to build database a user database chain link

A only after a database chain is established to a database (user) Can the data be obtained from table A in the A database (user)

Create Database Link Link_test

Connect to a database user name (username) identified by a database password (password) using ' database name '


This diagram is a view of link creation with Pl/sql

3. Create a snapshot of a table under database B

Create snapshot t_a--> table name to be displayed in data b for a table snapshot in the future

REFRESH COMPLETE START with sysdate+1/24*60*60 NEXT sysdate+1/24*60

As SELECT * FROM A@link_test

SYSDATE+1/24*60*60: To set Oracle to perform refresh automatically in 1 seconds, NEXT sysdate+1/24*60

Indicates automatic refresh every 1 minutes

Description: Refresh is the refreshing method
The refresh mode is: COMPLETE (full refresh) and fast (quick refresh) two kinds,
And the start with is the time to begin execution.
Next is the time to execute
As the following is the query method that makes up the snapshot.

Refresh Method :

There are two ways to refresh a snapshot: Quick refresh and full refresh. A quick refresh requires the snapshot's primary table to exist first, and Oracle executes the snapshot query when full refresh, putting the results in the snapshot. Quick flushes are faster than full flushes because the quick refresh is less data that sends the primary database's data over the network to the snapshot, only the modified data in the primary table is routed, and the full results of the snapshot query are completely refreshed.

4, modify the snapshot

Alter Snapshot t_a Refresh Fast
Start with sysdate+1/2880 next sysdate+1

This SQL statement means: Set Oracle automatically after 30 seconds (30/24*60*60) for the first quick refresh, after every 1 days to quickly refresh

5. View the date the snapshot was last refreshed
SELECT Name,last_refresh
From All_snapshot_refresh_times

6, manually refresh the snapshot in the command interface to execute :
EXEC Dbms_snapshot. REFRESH (' t_a ', ' C ');
The first parameter is the name of the snapshot to be refreshed
The second parameter is the way to refresh, F----FAST, C---COMPLETE

7. Description :

A The Oracle database created a trigger for US based on the snapshot log (I didn't find it)

Tlog$_a and Snapshot Log table mlog$_a (this has been found);

Online friends said that when the snapshot set up a number of tables, views and so on, but I only found the table, the other did not find, hoping to get everyone's help.

Summary if there are any problems please point out, common progress.

Related Article

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.