Oracle 10g snapshot Operation Method

Source: Internet
Author: User

I accidentally heard about the snapshot of the oracle database. I was stunned when I first heard it. I didn't know what it was, and I spent some time studying it, the following is my summary on network learning.

Snapshots are mainly used in distributed databases. We have database A and table A in database a. We need to use the data in Table A in database B, at this time, we can create A snapshot of database A in database B, which can improve our efficiency.

I understand that snapshots are used to copy a table to table B at regular intervals)

Note:Tables created from snapshots are read-only.

How to Create a snapshot:

1. Create A snapshot log for table a in database.

You can perform a quick refresh in a snapshot only when you create a snapshot log for table.

Create snapshot log on;

2. Create A database link to database A under database B.

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

Create database link link_test

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

This figure shows how to use pl/SQL to create a link view.

3. Create a snapshot of Table a under database B

Create snapshot t_a --> The Name Of The table displayed for the snapshot of Table a in data B 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: indicates that oracle is automatically refreshed in 1 second, And next sysdate + 1/24*60

Indicates automatic refresh once every 1 minute.

Note:REFRESH is the REFRESH method.
There are two refresh Methods: COMPLETE (full refresh) and FAST (FAST refresh,
Start with indicates the execution START time.
Next is the Next execution time.
In the future, AS is the method for querying snapshots.

Refresh Method:

There are two ways to refresh a snapshot: Quick refresh and full refresh. A snapshot log exists in the master table that requires a snapshot for quick refresh. When a snapshot is completely refreshed, oracle executes a snapshot query and places the result to the snapshot. Quick refresh is faster than full refresh, because Quick refresh only needs to transmit the modified data in the master table because there is less data sent from the master database to the snapshot through the network, and completely refresh all the results of the snapshot query to be sent.

4. modify a snapshot

Alter snapshot t_a refresh fast
Start with sysdate + 1/2880 next sysdate + 1

Meaning of this SQL statement: Set oracle to automatically refresh for the first time after 30 seconds (30/24*60*60), and then refresh every other day

5. view the last refresh date of the snapshot.
Select name, LAST_REFRESH
FROM ALL_SNAPSHOT_REFRESH_TIMES

6. manually refresh the snapshot and execute it on the command interface.:
EXEC DBMS_SNAPSHOT.REFRESH ('t_ A', 'C ');
The first parameter is the snapshot name to be refreshed.
The second parameter is the refresh method, F----FAST, C---COMPLETE

7. Description:

A) When snapshot logs are created, the oracle database creates a-based trigger for US (I did not find it)

Tlog $ _ a and snapshot log table mlog $ _ a (this is already found );

My online friend said that some tables and views were created during snapshot creation, but I only found the tables, and others were not found. I hope you can help me.

If you have any questions, please point them out and make progress together.

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.