物化视图无法在提交刷新时设置

时间:2018-02-15 04:37:16

标签: sql oracle materialized-views

我尝试根据另一个创建此物化视图,但不断收到错误:

Error report -
ORA-12054: cannot set the ON COMMIT refresh attribute for the materialized view
12054. 00000 -  "cannot set the ON COMMIT refresh attribute for the materialized view"
*Cause:    The materialized view did not satisfy conditions for refresh at
           commit time.
*Action:   Specify only valid options.

查看:

CREATE MATERIALIZED VIEW MV_LLATTRDATA_MAX_VERSIONS
    NOLOGGING
    BUILD IMMEDIATE 
    REFRESH FAST ON COMMIT WITH ROWID
    ENABLE QUERY REWRITE
    AS 
        SELECT AD.DEFID, AD.ATTRID, MAX(AD.VERNUM) AS MAX_VERNUM, MIN(AD.DEFVERN) AS MAX_DEFVERN
        FROM   CSTST.MV_LLATTRDATA_PARTITIONED_TEST AD, DTREE DT -- dtree is a view
        WHERE AD.ID = DT.DATAID   
        GROUP BY AD.DEFID, AD.ATTRID;

我在基表上设置了日志,我不太清楚还有什么要检查。

1 个答案:

答案 0 :(得分:0)

在使用ROWID选项创建快速刷新MV时,应该考虑某些限制。

  

WITH ROWID子句

     

指定WITH ROWID以创建rowid实体化视图。如果物化视图不包括主表的所有主键列,则Rowid物化视图很有用。 Rowid物化视图必须基于单个表,并且不能包含以下任何内容:

     

不同或聚合功能

     

GROUP BY或CONNECT BY子句

     

子查询

     

加入

     

设置操作

CREATE MATERIALIZED VIEW