• 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

  • 相关阅读:
    010.Python文件指针与文件修改
    009.Python之with管理与文件操作的其他方法
    008.Python之文件的基本操作
    007.Python基础数据类型之元组、字典与集合
    006.Python基础数据类型之字符串与列表
    005.python基础之循环结构与数字类型数据
    004.python基础知识3
    003.python基础知识2
    002.python基础知识1
    001.计算机基础知识
  • 原文地址:https://www.cnblogs.com/zhjh256/p/9466121.html
Copyright © 2020-2023  润新知