My Oracle Support Banner

Invalid Materialized View (Doc ID 1072040.1)

Last updated on JANUARY 26, 2020

Applies to:

Oracle Database - Enterprise Edition - Version 10.2.0.1 to 10.2.0.4 [Release 10.2]
Oracle Database Cloud Schema Service - Version N/A and later
Oracle Database Exadata Cloud Machine - Version N/A and later
Oracle Cloud Infrastructure - Database Service - Version N/A and later
Oracle Database Exadata Express Cloud Service - Version N/A and later
Information in this document applies to any platform.

Symptoms

Some materialized views have status invalid, however, they compile with no errors.  The mview itself is a straight forward mview. So, this status seems inconsistent.  It appears the mview goes INVALID when we convert to a FAST REFRESH Mechanism.

Changes

NOTE: In the images and/or the document content below, the user information and data used represents fictitious data from the Oracle sample schema(s) or Public Documentation delivered with an Oracle database product.  Any similarity to actual persons, living or dead, is purely coincidental and not intended in any manner.

The Materialized view was created as:

SQL> CREATE MATERIALIZED VIEW "<OWNER_SCHEMA>"."<MView_Name>"  REFRESH FORCE
 ON DEMAND AS
 SELECT "<Table_Name>"."EMPNO" "EMPNO","<Table_Name>"."ENAME" "ENAME",
 "<Table_Name>"."JOB" "JOB","<Table_Name>"."MGR" "MGR","<Table_Name>"."HIREDATE"
 "HIREDATE","<Table_Name>"."SAL" "SAL","<Table_Name>"."COMM" "COMM",
 "<Table_Name>"."DEPTNO" "DEPTNO"
 FROM "<OWNER_SCHEMA>"."<Table_Name>"@<DBLINK_NAME> "<Table_Name>";


When this is viewed in the DBA_OBJECTS view, it appears as VALID:

SQL> select OWNER, OBJECT_NAME, OBJECT_TYPE, CREATED, STATUS from dba_objects a where a.owner='<OWNER_SCHEMA>' and a.object_type='MATERIALIZED VIEW' and a.object_name in ('<MView_Name>');

OWNER OBJECT_NAME OBJECT_TYPE        CREATED   STATUS
------------------------------------------------------
<OWNER_SCHEMA> <MView_Name>         MATERIALIZED VIEW 29-01-2010 VALID


When this is viewed in the DBA_MVIEWS view, it appears as VALID:

SQL> select OWNER,MVIEW_NAME, MASTER_LINK, REFRESH_MODE, LAST_REFRESH_DATE, COMPILE_STATE from dba_mviews a where a.owner='<OWNER_SCHEMA>' and a.mview_name in ('<MView_Name>');

OWNER MVIEW_NAME MASTER_LINK REFRESH_MODE LAST_REFRESH_DATE COMPILE_STATE
------------------------------ --------------------------------------------
<OWNER_SCHEMA> <MView_Name>          @<DBLINK_NAME> DEMAND        29-01-2010 18:09:    VALID


Alter the mview to be fast refreshable:

SQL> ALTER MATERIALIZED VIEW "<OWNER_SCHEMA>"."<MView_Name>" REFRESH FAST;

Check the DBA_MVIEWS and DBA_OBJECTS views again:

SQL> select OWNER,MVIEW_NAME, MASTER_LINK, REFRESH_MODE, LAST_REFRESH_DATE, COMPILE_STATE from dba_mviews a where a.owner='<OWNER_SCHEMA>' and a.mview_name in ('<MView_Name>');

OWNER MVIEW_NAME MASTER_LINK REFRESH_MODE LAST_REFRESH_DATE COMPILE_STATE
------------------------------ ------------------------------------------- -
<OWNER_SCHEMA> <MView_Name> @<DBLINK_NAME> DEMAND 29-01-2010 18:09: COMPILATION_ERROR

SQL> select OWNER, OBJECT_NAME, OBJECT_TYPE, CREATED, STATUS from dba_objects a where a.owner='<OWNER_SCHEMA>' and a.object_type='MATERIALIZED VIEW' and a.object_name in ('<MView_Name>');

OWNER OBJECT_NAME OBJECT_TYPE CREATED STATUS
-----------------------------------------------------
<OWNER_SCHEMA> <MView_Name> MATERIALIZED VIEW 29-01-2010 INVALID

Cause

To view full details, sign in with your My Oracle Support account.

Don't have a My Oracle Support account? Click to get started!


In this Document
Symptoms
Changes
Cause
Solution


My Oracle Support provides customers with access to over a million knowledge articles and a vibrant support community of peers and Oracle experts.