zoukankan      html  css  js  c++  java
  • ORA-12052: cannot fast refresh materialized view

    SQL> execute dbms_mview.refresh ('TX_FAIL_LOG_DAY_MV', 'f');

    BEGIN DBMS_MVIEW.REFRESH ('TX_FAIL_LOG_DAY_MV', 'f'); END;

     *

    ERROR at line 1:

    ORA-12052: cannot fast refresh materialized view BIDATA.TX_FAIL_LOG_DAY_MV

    ORA-06512: at "SYS.DBMS_SNAPSHOT", line 2563

    ORA-06512: at "SYS.DBMS_SNAPSHOT", line 2776

    ORA-06512: at "SYS.DBMS_SNAPSHOT", line 2745

    ORA-06512: at line 1

     

    Solution:

    The Oracle provided DBMS_MVIEW.explain_mview procedure was used to analyze each of the existing materialized views FAST REFRESH capabilities and write the results to the MV_CAPABILITIES_TABLE. Now using DBMS_MVIEW.explain_mview procedure I will analysis the possible reason why the materialized view cannot fast refresh.

     

    SQL> EXEC dbms_mview.explain_mview('TX_FAIL_LOG_DAY_MV');

     PL/SQL procedure successfully completed.

     SQL> SELECT capability_name,

                possible,

                substr(msgtxt,1,60) AS msgtxt

               FROM mv_capabilities_table

              WHERE capability_name like '%FAST%'; 

     

    CAPABILITY_NAME

    POSSIBLE

    MSGTXT

    REFRESH_FAST

    Y

    REFRESH_FAST_AFTER_INSERT

    N

    mv log does not have all necessary columns

    REFRESH_FAST_AFTER_ONETAB_DML

    N

    see the reason why REFRESH_FAST_AFTER_INSERT is disabled

    REFRESH_FAST_AFTER_ANY_DML

    N

    mv log does not have sequence #

    REFRESH_FAST_AFTER_ANY_DML

    N

    see the reason why REFRESH_FAST_AFTER_ONETAB_DML is disabled

    REFRESH_FAST_PCT

    Y

     So you can see from the analysis that the log table does not have all the necessary columns. I have added the missing column.

     SQL> ALTER MATERIALIZED VIEW LOG ON BIDATA.TX_FAIL_LOG_HOUR_MV ADD(CONTENTPROVIDERSERVICEID);

     

    SQL> execute dbms_mview.refresh ('TX_FAIL_LOG_DAY_MV', 'f');

    BEGIN DBMS_MVIEW.REFRESH ('TX_FAIL_LOG_DAY_MV', 'f'); END;

    *

    ERROR at line 1:

    ORA-12052: cannot fast refresh materialized view BIDATA.TX_FAIL_LOG_DAY_MV

    ORA-06512: at "SYS.DBMS_SNAPSHOT", line 2563

    ORA-06512: at "SYS.DBMS_SNAPSHOT", line 2776

    ORA-06512: at "SYS.DBMS_SNAPSHOT", line 2745

    ORA-06512: at line 1

     

    Still we are getting the error because first we require a complete refresh. After the complete refresh fast refresh will work.

     SQL> execute dbms_mview.refresh ('TX_FAIL_LOG_DAY_MV', 'c');

     PL/SQL procedure successfully completed.

    Elapsed: 02:27:28.10

     

    SQL> execute dbms_mview.refresh ('TX_FAIL_LOG_DAY_MV', 'f');

    PL/SQL procedure successfully completed.

    Elapsed: 00:01:38.61

  • 相关阅读:
    sort,uniq,wc,tr
    cut
    more,less,head,tail
    cat
    mv
    WordPress调用全文阅读和截取文章摘要
    板邓:css ol 列表序列号样式
    小板邓:wordpress如何扩展TinyMCE编辑器,添加自定义按钮及功能
    wordpress前台显示顶部管理工具导航条
    SQL的主键和外键的作用
  • 原文地址:https://www.cnblogs.com/zhjh256/p/9466121.html
Copyright © 2011-2022 走看看