To create a materialized view of several points of attention

Source: Internet
Author: User
Tags commit key
Create | view
1. If you create a base table that is a materialized view of another user table, you need to give the owner of the materialized view the following permissions:
Grant CREATE any materialized VIEW to username;
Grant SELECT any TABLE to username;
If you want to create a view of the refresh on commit, you also need the following permission:
Grant on COMMIT-REFRESH to username;

2. The syntax for creating a refresh on commit is as follows, this class of materialized views are immediately refreshed after a transaction commit on the base table
CREATE materialized VIEW Mv_t1
REFRESH FAST on COMMIT and PRIMARY KEY as SELECT * from KAMUS.T1;

3. If an on commit is not specified, then the default is on demand, and materialized views are refreshed only if the refresh process in the Dbms_mview package is manually invoked

4. Specified start with ... next ... option, the first time you create a full refresh, and then refresh periodically after the specified interval, in this case the refresh interval is 1 minutes.
The syntax is as follows:
CREATE materialized VIEW Mv_t1
REFRESH FAST START with sysdate NEXT sysdate+1/24/60 and PRIMARY KEY as SELECT * from KAMUS.T1;
Check the User_refresh view and the User_jobs view, we can find the start with ... next ... The syntax is that Oracle automatically creates a refresh group with the same name as the materialized view, and the Implicit_destroy property is Y, which means that the group is automatically deleted as long as the materialized view in that group is deleted. Also, creating a waht attribute in a job,job is Dbms_refresh.refresh (' SCOTT '.) Mv_t1 "');
Naturally, because automatic refreshes are done through a job, the initialization parameter job_queue_processes must be greater than 0 so that the job will run correctly.

5. You can create a refresh group on your own to refresh periodically, and my previous article has a way to create a refresh group:
Http://blog.csdn.net/kamus/archive/2004/09/18/108496.aspx


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.