SAP Link | |
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
This note provides answers to Frequently Asked Questions (FAQs). Solution
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.
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.
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.
There are multiple refresh options that you can specify in <refresh_mode>. First of all, there are FAST, COMPLETE and FORCE refresh operations:
In addition, you can specify a time for the refresh operation. For example:
You can use the following command to create a materialized view log for a table: CREATE MATERIALIZED VIEW LOG ON <table>;
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$$.
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:
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:
For each periodic COMPLETE refresh of a materialized view, the system creates Redo information which can lead to a significant Redo log count.
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>);
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>.
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 cleanupIf 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.
You are trying to reorganize a materialized view online. This is not possible.
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>;
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>;
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 VIEWRefer to note 646681 for information about the online reorganization with BRSPACE |