Question

I have 2 base operational table test_table1 and test_table2 on which i have created the materialized view logs . I have created a view on top of this called test_view1 which is a join of test_table1 and test_table2. Now, I need to create a materialized view on this view test_view1.

I created the materialized view as REFRESH ON COMMIT and it got created but when i run the procedure for the incremental refresh as per

execute DBMS_MVIEW.REFRESH('test_mview2', 'F', '', TRUE, FALSE, 0,0,0,FALSE, FALSE);

the materialized view is not getting updated even if any DML was applied on the base tables. But, when i run the procedure for complete refresh:

execute DBMS_MVIEW.REFRESH('test_mview2', 'C', '', TRUE, FALSE, 0,0,0,FALSE, FALSE);

it is getting updated.

How can i REFRESH ON COMMIT for this particular materialized view ?

The output of dbms_mview.explain_mview: (CApability_name --possible--msgtxt)

  1. REFRESH_FAST_PCT --N-- PCT is not possible on any of the detail tables in the mater
  2. REWRITE_FULL_TEXT_MATCH --N-- Oracle error: see RELATED_NUM and RELATED_TEXT for details
  3. REWRITE_FULL_TEXT_MATCH --N-- query rewrite is disabled on the materialized view
  4. REWRITE_PARTIAL_TEXT_MATCH --N-- materialized view cannot support any type of query rewrite
  5. REWRITE_PARTIAL_TEXT_MATCH --N-- query rewrite is disabled on the materialized view
  6. REWRITE_GENERAL --N-- materialized view cannot support any type of query rewrite
  7. REWRITE_GENERAL --N-- the reason why the capability is disabled has escaped analys
  8. REWRITE_GENERAL --N-- query rewrite is disabled on the materialized view
  9. REWRITE_PCT --N-- general rewrite is not possible or PCT is not possible on an
  10. PCT_TABLE_REWRITE --N-- Oracle error: see RELATED_NUM and RELATED_TEXT for details
  11. PCT_TABLE_REWRITE --N-- relation is not a partitioned table
  12. PCT --N--
  13. REFRESH_COMPLETE --Y--
  14. REFRESH_FAST --N--
  15. REWRITE --N--
  16. PCT_TABLE --N-- Oracle error: see RELATED_NUM and RELATED_TEXT for details
  17. PCT_TABLE --N-- relation is not a partitioned table
  18. REFRESH_FAST_AFTER_INSERT --N-- mv references PL/SQL function that maintains state
  19. REFRESH_FAST_AFTER_ONETAB_DML --N-- see the reason why REFRESH_FAST_AFTER_INSERT is disabled

REFRESH_FAST_AFTER_ANY_DML N see the reason why REFRESH_FAST_AFTER_ONETAB_DML is disabled

Was it helpful?

Solution

From the MV Capabilities result:

REFRESH_FAST_AFTER_INSERT N mv references PL/SQL function that maintains state

You have a PL/SQL function defined as part of the materialized view, or the view that it references, that is preventing fast refresh from working. My bet would be that it has a SELECT statement in it, but in any case it is not deterministic.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top