应用FAST ON COMMED REFRESH MATERIALIZIN VIEW IN时出错

时间:2014-07-31 13:58:02

标签: sql oracle materialized-views

应用FAST ON COMMED REFRESH MATERIALIZIN VIEW IN时出错。

CREATE MATERIALIZED VIEW Prueba     
BUILD IMMEDIATE
--REFRESH COMPLETE
REFRESH FAST ON COMMIT
AS SELECT DISTINCT IMAGENES.TOTAL
  ,LISTAGG(OBDA.OBDA_DATO , ',') WITHIN GROUP (ORDER BY OBDA.OBDA_OBTR_ID) OK
  ,LISTAGG(ATRI.ATRI_NOMBRE , ',') WITHIN GROUP (ORDER BY ATRI.ATRI_ID) OK1,
  DAOR_OBJETO.OBJE_NOMBRE,
  DAOR_OBJETO.OBJE_ID
  FROM DAOR_OBJETO_DANADO OBNA
  INNER JOIN (SELECT IMOB_OBNA_ID,COUNT(*) TOTAL FROM DAOR_IMAGENES_OBJETO GROUP BY IMOB_OBNA_ID) IMAGENES ON OBNA.OBNA_ID = IMAGENES.IMOB_OBNA_ID
  INNER JOIN DAOR_OBJETO_DATO OBDA ON OBDA.OBDA_OBNA_ID = OBNA.OBNA_ID
  INNER JOIN DAOR_OBJETO_ATRIBUTO OBTR ON (OBTR.OBTR_ID = OBDA.OBDA_OBTR_ID)
  INNER JOIN DAOR_ATRIBUTO_BUQUE ATBU ON (ATBU.ATBU_ID = OBTR.OBTR_ATBU_ID)
  INNER JOIN DAOR_ATRIBUTOS ATRI ON (ATRI.ATRI_ID = ATBU.ATBU_ATRI_ID)
  INNER JOIN DAOR_OBJETO ON OBNA.OBNA_OBJE_ID = DAOR_OBJETO.OBJE_ID
  GROUP BY IMAGENES.TOTAL,DAOR_OBJETO.OBJE_NOMBRE,  DAOR_OBJETO.OBJE_ID;

错误:

 SQL: ORA-12054: no se puede definir el atributo de refrescamiento ON COMMIT para la vista materializada
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.

1 个答案:

答案 0 :(得分:1)

快速刷新可能非常难以启用。有many restrictions on fast refresh并且并非所有这些都记录得很好。

如果需要完全重写简单查询以启用快速刷新,请不要感到惊讶。对于此示例,您至少需要将ANSI连接转换为旧式语法,并删除COUNT(*)内联视图。

之后它可能仍然无效,您需要使用DBMS_MVIEW.EXPLAIN_MVIEW查看有关未启用快速刷新的原因的更多信息。