Note 741478 - FAQ: Materialized views

简介:
SAP Link 741478
Version 7
Release Status Released for Customer
Released on 2010-11-30 12:05:35
Priority Recommendations/additional info
Category FAQ
Primary Component BC-DB-ORA
Secondary Components BC-DB-ORA-DBA

 

 

Summary
Symptom
  1. 1. What are materialized views?
  1. 2. What are the differences between views and materialized views?
  1. 3. What can I use materialized views for?
  1. 4. Are materialized views used in the SAP environment?
  1. 5. What are the prerequisites for materialized views?
  1. 6. How do I create a materialized view?
  1. 7. How can I refresh a materialized view?
  1. 8. How do I create a materialized view?
  1. 9. Which Oracle DDIC views exist for materialized views?
  1. 10. What internal objects are created that relate to materialized views?
  1. 11. How are materialized views used in online reorganizations?
  1. 12. What problems can occur with materialized views?
  1. 13. Where do I find more information about materialized views?

Other terms

This note provides answers to Frequently Asked Questions (FAQs).

Solution
  1. 1. What are materialized views?

              Materialized views or snapshots are segments that contain the current or previous data of a table, a view or a join. You can update the data that was changed in the source objects since the creation of the materialized view immediately, at specific times or not at all.

              By default, materialized views as read-only.

  1. 2. What are the differences between views and materialized views?
  • A view always returns the current information from the source objects while a materialized view can also contain a previous state of the source objects, depending on the refresh mode.
  • In a regular view, the data must be retrieved from the source objects at runtime, which can lead to long runtimes for complex joins. A materialized view, however, can be compared with a table from which the system can read the data directly without overhead for joins.
  1. 3. What can I use materialized views for?
  • With materialized views, you can replicate data automatically to other systems.
  • The online table reorganization with DBMS_REDEFINITION is based on materialized views.
  • You can cache expensive queries as materialized views and refresh them periodically (which can be compared with the table buffering in R/3).
  1. 4. Are materialized views used in the SAP environment?

              Materialized views are not used in the SAP environment. The only exception is the online table reorganization with BRSPACE which uses materialized views implicitly.

              Since materialized views are not used in the R/3 system, they cannot be created in the ABAP Dictionary.

  1. 5. What are the prerequisites for materialized views?
  • By default, materialized views are based on primary key constraints. This means that a primary key constraint must be created on the table for this type of materialized view - otherwise ORA-12014 occurs. Alternatively, you can generate a materialized view based on the ROWID.
  • If you want to refresh the materialized view automatically, you must set the JOB_QUEUE_PROCESSES parameter to 1 or a higher value.
  • To create a materialized view, the database user must have the CREATE MATERIALIZED VIEW authorization.
  1. 6. How do I create a materialized view?

              You can create a simple materialized view with the following command:

CREATE MATERIALIZED VIEW MY_MAT_VIEW
<refresh_mode>
AS <select_statement>;

              <select_statement> contains the query that is used to create the materialized view.

              Refer to the Oracle online documentation for more complex definitions of materialized views. The possible values for <refresh_mode> are listed in the answer to the next question.

  1. 7. How can I refresh a materialized view?

              There are multiple refresh options that you can specify in <refresh_mode>. First of all, there are FAST, COMPLETE and FORCE refresh operations:

  • FAST: The data that you change in the source objects is logged in a log file for the materialized view. When you refresh, the system only needs to transfer the data to the materialized view. This method is used in the online reorganization. For a FAST refresh, the materialized view query must not be too complex and a log file for the materialized view must exist.
  • COMPLETE: The materialized view is rebuilt completely during the refresh operation.
  • FORCE: If possible, the system performs a FAST refresh, otherwise, it executes a COMPLETE refresh (default).

              In addition, you can specify a time for the refresh operation. For example:

  • NEVER REFRESH: The refresh is not performed automatically.
  • REFRESH FAST ON COMMIT: A FAST refresh is performed with every Commit.
  • REFRESH COMPLETE START WITH SYSDATE NEXT SYSDATE + 1/48: A COMPLETE refresh is performed as of now every 30 minutes (30 minutes equals 1 day multiplied by 1/48).
  • REFRESH FORCE START WITH TRUNC(SYSDATE) NEXT TRUNC(SYSDATE)+1/4: A FORCE refresh is performed at 12 am, 6 am, 12 pm and 6 pm.
  1. 8. How do I create a materialized view?

              You can use the following command to create a materialized view log for a table:

CREATE MATERIALIZED VIEW LOG ON <table>;

  1. 9. Which Oracle DDIC views exist for materialized views?
  • DBA_MVIEWS: Overview over the materialized views.
  • DBA_MVIEW_LOGS: Overview over the log files for the materialized views.
  1. 10. What internal objects are created that relate to materialized views?

              If you create a primary key constraint that is not supported by an existing index as the basis for a materialized view, Oracle creates an index internally with the prefix SYS_C.

              When you create a materialized view log, the system creates the objects MLOG$_<table> and RUPD$_<table>. MLOG$_<table> is the materialized view log which records all changes to the underlying table.

              When you create a ROWID based materialized view, the system creates an I_SNAP$_<table> index for the materialized view, which receives the column M_ROW$$.

  1. 11. How are materialized views used in online reorganizations?

              If you use BRSPACE to execute an online reorganization based on the Oracle package DBMS_REDEFINITION (refer to Note 646681), then materialized views are also implicitly used due to the implementation of DBMS_REDEFINITION. In general, what happens is this:

  • The target table with the name conention <table>#$ (see Note 541538) is treated as a materialized view of the source table <table>.
  • The program creates a materialized view log for the source table <table>. This means that the system creates the objects MLOG$_<table> and RUPD$_<table> implicitly.
  • If a primary index exists for the table to be reorganized, the online reorganization is executed on the basis of a primary key constraint. This means that the materialized view is also created on the basis of a primary key constraint. In turn, this means that an I_SNAP$_<table>#$ index is not necessary.
  • If no primary index exists, the reorganization takes place on the basis of a ROWID materialized view, so the I_SNAP$_<table>#$ is implicitly created.
  1. 12. What problems can occur with materialized views?
  • Problems with the table owner's default tablespace

           All implicit objects such as MLOG$_<table>, RUPD$_< table> and I_SNAP$_<table>#$ are created in the table owner's default tablespace. This may cause tablespace overflows and MAXEXTENTS problems under some circumstances, for example:

ORA-12008: error in materialized view refresh path
ORA-01632: max # extents (505) reached in index
          SAPR3.I_SNAP$_<table>
ORA-01652: unable to extend temp segment in tablespace <tsp>

           Therefore, take not of the following during the online reorganization:

  • Ensure that there is sufficient free space available in the table owner's default tablespace, and that problems relating to MAXEXTENTS can be avoided (such as by setting MAXEXTENTS -> UNLIMITED).
  • Avoid reorganizing large tables that have no primary index, since this means that the program must create large I_SNAP$ indexes implicitly.
  • Avoid online reorganizations in parallel with massive data chagnes to the tables to be reorganized, since otherwise the MLOG$ table grows very large.
  • Increased Redo log count

           For each periodic COMPLETE refresh of a materialized view, the system creates Redo information which can lead to a significant Redo log count.

  • ORA-12014: table does not contain a primary key constraint

           If you create a primary key materialized view for a table without primary key constraint, the system issues an ORA-12014 error message.

           You can create a primary key constraint with the following command:

ALTER TABLE <table> ADD PRIMARY_KEY (<column_list>);

  • ORA-12028: materialized view type is not supported by master site

           The system issues this error when you create materialized views with an Oracle databases Release 7 or earlier. If the system issues the error message when you reorganize a database version 9i or later online, parts of the Oracle DDICs may not have a current status yet or old Oracle packages may still exist under users such as SAPR3 or SAP<sid>.

  • ORA-12091: cannot online redefine table with materialized views

           If a materialized view or a log file for a materialized view already exists for a table, an online reorganization will lead to an ORA-12091 error message. The error occurs if the online reorganization for a table is stopped improperly and you then try to restart the online reorganization. To solve the problem, you must clean up the rest of the previous online reorganization as follows:

brspace -u / -f tbreorg -t <table_name> -a cleanup

           If you want to clean up the remainder of a large quantity of tables, you can also use "-t". However, this causes long runtime for the cleanup.

  • ORA-12092: cannot online redefine replicated table

           You are trying to reorganize a materialized view online. This is not possible.

  • ORA-12096: error in materialized view log on <table>

           If problems occur when you try to access a log file for a materialized view, the system issues an ORA-12096 error message which is followed by the actual error. If the ORA-12096 error message is accompanied by an ORA-00942 message, the problem may be due to an online reorganization that was only partially undone. In this case, you can drop the log file for the materialized view manually (after you have verified that it is no longer required):

DROP MATERIALIZED VIEW LOG ON <table>;

  • ORA-23413: table does not have a materialized view log

           If you try to create a FAST materialized view for a table without materialized view log, the system issues an ORA-23413 error message. The name of the materialized view log is always MLOG$_<table> and you can create the log with the following command:

CREATE MATERIALIZED VIEW LOG ON <table>;

  1. 13. Where do I find more information about materialized views?

              Refer to the Oracle online documentation for detailed information about materialized views:

Oracle9i Advanced Replication
-> 3 Materialized view Concepts and Architecture

Oracle9i SQL Reference
-> CREATE MATERIALIZED VIEW

              Refer to note 646681 for information about the online reorganization with BRSPACE

专注于企业信息化,最近对股票数据分析较为感兴趣,可免费分享股票个股主力资金实时变化趋势分析工具,股票交流QQ群:457394862
分类:  SAP Basis, SAP BI

本文转自沧海-重庆博客园博客,原文链接:http://www.cnblogs.com/omygod/archive/2012/01/19/2326077.html,如需转载请自行联系原作者


目录
相关文章
|
23天前
|
人工智能 自然语言处理 Shell
🦞 如何在 OpenClaw (Clawdbot/Moltbot) 配置阿里云百炼 API
本教程指导用户在开源AI助手Clawdbot中集成阿里云百炼API,涵盖安装Clawdbot、获取百炼API Key、配置环境变量与模型参数、验证调用等完整流程,支持Qwen3-max thinking (Qwen3-Max-2026-01-23)/Qwen - Plus等主流模型,助力本地化智能自动化。
33606 133
🦞 如何在 OpenClaw (Clawdbot/Moltbot) 配置阿里云百炼 API
|
5天前
|
人工智能 自然语言处理 监控
OpenClaw skills重构量化交易逻辑:部署+AI全自动炒股指南(2026终极版)
2026年,AI Agent领域最震撼的突破来自OpenClaw(原Clawdbot)——这个能自主规划、执行任务的智能体,用50美元启动资金创造了48小时滚雪球至2980美元的奇迹,收益率高达5860%。其核心逻辑堪称教科书级:每10分钟扫描Polymarket近千个预测市场,借助Claude API深度推理,交叉验证NOAA天气数据、体育伤病报告、加密货币链上情绪等多维度信息,捕捉8%以上的定价偏差,再通过凯利准则将单仓位严格控制在总资金6%以内,实现低风险高频套利。
2690 10
|
18天前
|
人工智能 安全 机器人
OpenClaw(原 Clawdbot)钉钉对接保姆级教程 手把手教你打造自己的 AI 助手
OpenClaw(原Clawdbot)是一款开源本地AI助手,支持钉钉、飞书等多平台接入。本教程手把手指导Linux下部署与钉钉机器人对接,涵盖环境配置、模型选择(如Qwen)、权限设置及调试,助你快速打造私有、安全、高权限的专属AI助理。(239字)
7228 21
OpenClaw(原 Clawdbot)钉钉对接保姆级教程 手把手教你打造自己的 AI 助手
|
17天前
|
人工智能 机器人 Linux
OpenClaw(Clawdbot、Moltbot)汉化版部署教程指南(零门槛)
OpenClaw作为2026年GitHub上增长最快的开源项目之一,一周内Stars从7800飙升至12万+,其核心优势在于打破传统聊天机器人的局限,能真正执行读写文件、运行脚本、浏览器自动化等实操任务。但原版全英文界面对中文用户存在上手门槛,汉化版通过覆盖命令行(CLI)与网页控制台(Dashboard)核心模块,解决了语言障碍,同时保持与官方版本的实时同步,确保新功能最快1小时内可用。本文将详细拆解汉化版OpenClaw的搭建流程,涵盖本地安装、Docker部署、服务器远程访问等场景,同时提供环境适配、问题排查与国内应用集成方案,助力中文用户高效搭建专属AI助手。
5104 12
|
20天前
|
人工智能 机器人 Linux
保姆级 OpenClaw (原 Clawdbot)飞书对接教程 手把手教你搭建 AI 助手
OpenClaw(原Clawdbot)是一款开源本地AI智能体,支持飞书等多平台对接。本教程手把手教你Linux下部署,实现数据私有、系统控制、网页浏览与代码编写,全程保姆级操作,240字内搞定专属AI助手搭建!
5881 23
保姆级 OpenClaw (原 Clawdbot)飞书对接教程 手把手教你搭建 AI 助手

热门文章

最新文章