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

  • 相关阅读:
    鱼站追踪记
    使用sqlmap对进行php+mysql注入实战
    Python黑客——快速编写信息收集器
    Visual Studio 2015 Update 1 安装到最后 KB3022398 错误解决方法
    ACdreamoj 1011(树状数组维护字符串hash前缀和)
    iOS开发--Mac下server搭建
    2.oracle分页,找到员工表中薪水大于本部门平均薪水的员工
    Android面试题3之描写叙述下Android的系统架构
    OpenCV入门笔记(三) 图片处理
    全民Scheme(1):数字游戏
  • 原文地址:https://www.cnblogs.com/zhjh256/p/9466121.html
Copyright © 2011-2022 走看看