List all of MV inoracle:

select owner, query, query_len 
from dba_mviews 

See content of aMV:

select *from dba_mviewswhere owner='CNTL_DATA'

A materialized viewis a database object that contains the results of a query. For example, it maybe a local copy of data located remotely, or may be a subset of the rows and/orcolumns of a table or join result, or may be a summary based on aggregations ofa table’s data. Materialized views, which store data based on remote tables,are also known as snapshots. A snapshot can be redefined as a materializedview.

In any database managementsystem for following the relational model, a view is a virtual tablerepresenting the result of a database query. Whenever a query or an updateaddresses an ordinary view’s virtual table, the DBMS converts these intoqueries or updates against the underlying base tables. A materialized viewtakes a different approach in which the query result is cached as a concretetable that may be updated from the original base tables from time to time. Thisenables much more efficient access, at the cost of some data being potentiallyout-of-date. It is most useful in data warehousing scenarios, where frequentqueries of the actual base tables can be extremely expensive.

In addition, becausethe materialized view is manifested as a real table, anything that can be doneto a real table can be done to it, most importantly building indexes on anycolumn, enabling drastic speedups in query time. In a normal view, it’s typicallyonly possible to exploit indexes on columns that come directly from (or have amapping to) indexed columns in the base tables; often this functionality is notoffered at all. Materialized views were implemented first by the OracleDatabase: the Query rewrite feature was added from version 8i. They are alsosupported in Sybase SQL Anywhere.  In IBMDB2, they are called “materialized query tables”; MS SQL called “indexed views”.

Example syntax tocreate a materialized view in oracle:

CREATE MATERIALIZED VIEW MV_MY_VIEW
REFRESH FAST START WITH SYSDATE
   NEXT SYSDATE + 
     AS SELECT * FROM <table_name>;

Oracle usesmaterialized views to replicate data to non-master sites in a replication environmentand to cache expensive queries in a data warehouse environment.

A materialized viewis a replica of a target master from a single point in time. The master can beeither a master table at a master site or a master materialized view at amaterialized view site. Whereas in multimaster replication tables arecontinuously updated by other master sites, materialized views are update fromone or more masters through individual batch updates, known as a refreshes,from a single master site or master materialized view site.

MaterializedView Connected to a Single Master Site

When a materializedview is fast refreshed, Oracle must examine all of the changes to the mastertable or master materialized view since the last refresh to see if any apply tothe materialized view. Therefore, if any changes were made to the master sincethe last refresh, then a materialized view refresh takes some time to apply thechanges to the materialized view. If, however, no changes at all were made tothe master since the last refresh of a materialized view, then the materializedview refresh should be very quick.

You can usematerialized views to achieve one or more of the following goals:

  1. Ease Network Loads

If one of your goals is to reduce network loads, then you can usematerialized views to distribute your corporate database to regional sites.Instead of the entire company accessing a single database server, user load isdistributed across multiple database servers. Through the use of multitiermaterialized views, you can create materialized views based on othermaterialized views, which enables you to distribute user load to an evengreater extent because clients can access materialized view sites instead ofmaster sites. To decrease the amount of data that is replicated, a materializedview can be a subset of a master table or master materialized view.Whilemultimaster replication also distributes a corporate database among multiplesites, the networking requirements for multimaster replication are greater thanthose for replicating with materialized views because of the transaction bytransaction nature of multimaster replication. Further, the ability ofmultimaster replication to provide real-time or near real-time replication mayresult in greater network traffic, and might require a dedicated network link.Materializedviews are updated through an efficient batch process from a single master siteor master materialized view site. They have lower network requirements anddependencies than multimaster replication because of the point in time natureof materialized view replication. Whereas multimaster replication requiresconstant communication over the network, materialized view replication requiresonly periodic refreshes.In addition to not requiring a dedicated networkconnection, replicating data with materialized views increases dataavailability by providing local access to the target data. These benefits,combined with mass deployment and data subsetting (both of which also reducenetwork loads), greatly enhance the performance and reliability of yourreplicated database.

  1. Create a Mass Deployment Environment

Deployment templates allow you to pre-create amaterialized view environment locally. You can then use deployment templates toquickly and easily deploy materialized view environments to support sales forceautomation and other mass deployment environments. Parameters allow you tocreate custom data sets for individual users without changing the deploymenttemplate. This technology enables you to roll out a database infrastructure tohundreds or thousands of users.

  1. Enable Data Subsetting

Materialized views allow you to replicate data basedon column- and row-level subsetting, while multimaster replication requiresreplication of the entire table. Data subsetting enables you to replicateinformation that pertains only to a particular site. For example, if you have aregional sales office, then you might replicate only the data that is needed inthat region, thereby cutting down on unnecessary network traffic.

  1. Enable Disconnected Computing

Materialized views do not require a dedicatednetwork connection. Though you have the option of automating the refreshprocess by scheduling a job, you can manually refresh your materialized viewon-demand, which is an ideal solution for sales applications running on alaptop. For example, a developer can integrate the replication management APIfor refresh on-demand into the sales application. When the salesperson hascompleted the day's orders, the salesperson simply dials up the network anduses the integrated mechanism to refresh the database, thus transferring theorders to the main office.

A materialized viewcan be either read-only, updatable, or writeable. Users cannot perform datamanipulation language (DML) statements on read-only materialized views, butthey can perform DML on updatable and writeable materialized views.

Read-OnlyMaterialized Views

You can make amaterialized view read-only during creation by omitting the FOR UPDATE clauseor disabling the equivalent option in the Replication Management tool.Read-only materialized views use many of the same mechanisms as updatablematerialized views, except that they do not need to belong to a materializedview group.

In addition, usingread-only materialized views eliminates the possibility of a materialized viewintroducing data conflicts at the master site or master materialized view site,although this convenience means that updates cannot be made at the remotematerialized view site. The following is an example of a read-only materializedview:

CREATE MATERIALIZEDVIEW hr.employees AS

SELECT * FROM hr.employees@orc1.world;

UpdatableMaterialized Views

You can make amaterialized view updatable during creation by including the FOR UPDATE clauseor enabling the equivalent option in the Replication Management tool. Forchanges made to an updatable materialized view to be pushed back to the masterduring refresh, the updatable materialized view must belong to a materializedview group.Updatable materialized views enable you to decrease the load onmaster sites because users can make changes to the data at the materializedview site. The following is an example of an updatable materialized view:

CREATE MATERIALIZEDVIEW hr.departments FOR UPDATE AS

SELECT * FROM hr.departments@orc1.world;

The followingstatement creates a materialized view group:

BEGIN

DBMS_REPCAT.CREATE_MVIEW_REPGROUP (

gname => 'hr_repg',

master => 'orc1.world',

propagation_mode => 'ASYNCHRONOUS');

END;

/

The followingstatement adds the hr.departments materialized view to the materialized viewgroup, making the materialized view updatable:

BEGIN

DBMS_REPCAT.CREATE_MVIEW_REPOBJECT (

gname => 'hr_repg',

sname => 'hr',

oname => 'departments',

type => 'SNAPSHOT',

min_communication => TRUE);

END;

/

WriteableMaterialized Views

A writeablematerialized view is one that is created using the FOR UPDATE clause but is notpart of a materialized view group. Users can perform DML operations on awriteable materialized view, but if you refresh the materialized view, thenthese changes are not pushed back to the master and the changes are lost in thematerialized view itself. Writeable materialized views are typically allowedwherever fast-refreshable read-only materialized views are allowed.

Materialized View in Oracle - Concepts and Architecture的更多相关文章

  1. oracle view and MATERIALIZED VIEW

    View http://blog.csdn.net/tianlesoftware/article/details/5530618 MATERIALIZED VIEW http://blog.csdn. ...

  2. Oracle数据库零散知识07 -- Materialized view(转)

    物化视图是一种特殊的物理表,“物化”(Materialized)视图是相对普通视图而言的.普通视图是虚拟表,应用的局限性大,任何对视图的查询,Oracle都实际上转换为视图SQL语句的查询.这样对整体 ...

  3. MySQL 5.6 Reference Manual-14.2 InnoDB Concepts and Architecture

    14.2 InnoDB Concepts and Architecture 14.2.1 MySQL and the ACID Model 14.2.2 InnoDB Multi-Versioning ...

  4. [terry笔记]物化视图 materialized view基础学习

    一.物化视图定义摘录:     物化视图是包括一个查询结果的数据库对像(由系统实现定期刷新数据),物化视图不是在使用时才读取,而是预先计算并保存表连接或聚集等耗时较多的操作结果,这样在查询时大大提高了 ...

  5. What is the difference between Views and Materialized Views in Oracle?

    aterialized views are disk based and update periodically base upon the query definition. Views are v ...

  6. MATERIALIZED VIEW

    Oracle的实体化视图提供了强大的功能,可以用在不同的环境中,实体化视图和表一样可以直接进行查询.实体化视图可以基于分区表,实体化视图本身也可以分区. 主要用于预先计算并保存表连接或聚集等耗时较多的 ...

  7. Advanced Replication同步复制实验(基于Trigger&基于Materialized View)

    1. 高级复制和流复制介绍 1.1 高级复制(Advanced Replication) 高级复制也称为对称复制,分为多主体站点复制(Multiple Master Rplication).物化视图站 ...

  8. 物化视图(materialized view) 实现数据迁移、数据定时同步

    近日公司有一个9i 的Oracle数据库,运行效率低下.想要将其升级到11G. 但是升级之前 要将数据进行同步,好在表不是很多.只有三张表.业务压力也不大,就想到了使用物 化视图的方式将数据同步过来. ...

  9. ORA-12052: cannot fast refresh materialized view

    SQL> execute dbms_mview.refresh ('TX_FAIL_LOG_DAY_MV', 'f'); BEGIN DBMS_MVIEW.REFRESH ('TX_FAIL_L ...

随机推荐

  1. PHP 8大安全函数

    1. mysql_real_escape_string() 这个函数对于在PHP中防止SQL注入攻击很有帮助,它对特殊的字符,像单引号和双引号,加上了“反斜杠”,确保用户的输入在用它去查询以前已经是安 ...

  2. Java多线程实现......(1,继承Thread类)

    MyThread.java 中的代码: public class MyThread extends Thread{ private int startPrint,printCount; private ...

  3. Ubuntu基本设置

    (1)  为了启用 root 帐号 (也就是 设置一个口令) 使用: sudo passwd root 1.设置IP, 终端输入 sudo gedit /etc/network/interfaces ...

  4. FPGA知识大梳理(一)对FPGA行业的一点感言

    今天想开始把这FPGA行业的知识点做一个大整理,从个人感想,到语法,到器件基础,难点攻克,到项目应用.把自己这几年接触到的知识做一个全面的回顾,看看自己这几年走过的路. 人生无常,几年的跌跌撞撞勉强算 ...

  5. linux 进程通信

    IPC: 管道,FIFO,信号,消息队列(system v/ posix),共享内存(system v/  posix),socket 同步机制: 互斥锁,条件变量,记录上锁, 信号量(system ...

  6. QRadionButton 圆点样式

    QRadioButton::indicator {    width: 13px;    height: 13px;} QRadioButton::indicator::unchecked {     ...

  7. C#_会员管理系统:开发五(用户注册)

    创建一个新的用户注册窗体(VIPRegistration.cs): 用户注册窗体(VIPRegistration.cs)详细代码如下: using System; using System.Colle ...

  8. arduino电子琴(2015-11-04)

    前言 这是论坛上一个坛友问的问题,想做一个可变音调的电子琴,想着正好练练手,就顺手做一下. 接线图

  9. 基于FPGA的DW8051移植(一)

    最近 半个月都在移植8051,看到DW8051内核资料比较齐全又是新思发布的,所以就开始玩弄 可是这半个月的努力几近白费 —— 移植失败了,不知道从何着手这个内核.可能大家能找到不同的版本,我的是最初 ...

  10. WPF: 针对Windows 8优化菜单栏和工具栏

    原文 WPF: 针对Windows 8优化菜单栏和工具栏 目录 1. 关于菜单图标大小 2. 关于IsEnabled和工具栏图标 3. 针对.NET 3.x的菜单栏和工具栏外观 返回目录 1. 关于菜 ...