Call now: 252-767-6166  
Oracle Training Oracle Support Development Oracle Apps

 E-mail Us
 Oracle Articles
New Oracle Articles

 Oracle Training
 Oracle Tips

 Oracle Forum
 Class Catalog

 Remote DBA
 Oracle Tuning
 Emergency 911
 RAC Support
 Apps Support
 Oracle Support

 SQL Tuning

 Oracle UNIX
 Oracle Linux
 Remote s
 Remote plans
 Application Server

 Oracle Forms
 Oracle Portal
 App Upgrades
 SQL Server
 Oracle Concepts
 Software Support

 Remote S


 Consulting Staff
 Consulting Prices
 Help Wanted!


 Oracle Posters
 Oracle Books

 Oracle Scripts

Don Burleson Blog 







dbms_mview tips

Oracle Database Tips by Donald BurlesonMarch 1,  2016

Question: What does the dbm_mview package do for matrialized view refreshing?  Can you show an example of dbms_mview?

Answer:  Oracle DBMS_MVIEW is a synonym for DBMS_SNAPSHOT. Oracle DBMS_MVIEW will allow you to better understand the capabilities of Oracle materialized views. With Oracle DBMS_MVIEW you can also refresh Oracle materialized views that are not part of the same purge logs or refresh group.

Oracle 9i came with two packages, dbms_mview.explain_mview and dbms_mview.explain_rewrite that could be used to diagnose why a materialized view wasn't being used for query rewrite.

However, although these packages told you why rewrite hadn't happened, they left it down to you to work out how to alter your CREATE MATERIALIZED VIEW statement to ensure that rewrite happened correctly. Oracle Database 10g comes with a new advisor package, DBMS_ADVISOR.TUNE_MVIEW, that takes as its input a CREATE MATERIALIZED VIEW DML statement, and outputs a corrected version that supports query rewrite and features such as fast refresh.

Oracle 10g introduced the atomic refresh mechanism, whereby a materialized view is refreshed as a whole, as a single transaction. 

Now you might expect that an atomic refresh is faster than a manual rebuild or a refresh full, but this is not always the case.

When "atomic refresh" is set to TRUE (in dbms_mview.refresh_all_mviews), than the whole refresh is done in a single transaction. 

SQL> exec dbms_mview.refresh('MY_MV',atomic_refresh=>TRUE);

If you do not specify an atomic refresh (by setting "atomic refresh = FALSE" in dbms_mview.refresh_all_mviews) then you can optimize the materialized view refresh with these mechanisms:

- Parallel DML
- Truncate DDL

In other words, setting atomic_refresh=false tells Oracle to truncate data instead of delete the rows, resulting in better performance than setting "atomic_refresh=true".

Note that when a materialized view is refreshed in atomic mode, it is eligible for query rewrite if the rewrite integrity mode is set to stale_tolerated. Atomic refresh cannot be guaranteed when refresh is performed on nested views.

You can use the DBMS_MVIEW package to manually invoke either a fast refresh or a complete refresh, where F equals Fast Refresh and C equals Complete Refresh:


Refreshing materialized views

In Oracle, if you specify REFRESH FAST for a single-table aggregate Oracle materialized view, you must have created a materialized view log for the underlying table, or the refresh command will fail. When creating an Oracle materialized view, you have the option of specifying whether the refresh occurs manually (ON DEMAND) or automatically (ON COMMIT, DBMS_JOB). To use the fast warehouse refresh facility, you must specify the ON DEMAND mode. To refresh the Oracle materialized view, call one of the procedures in DBMS_MVIEW.

The DBMS_MVIEW package provides three types of refresh operations: 

  • DBMS_MVIEW.REFRESH:  Refreshes one or more Oracle materialized views
  • DBMS_MVIEW.REFRESH_ALL_MVIEWS:  Refreshes all Oracle materialized views
  • DBMS_MVIEW.REFRESH_DEPENDENT:  Refreshes all table-based Oracle materialized views


Oracle Training from Don Burleson 

The best on site "Oracle training classes" are just a phone call away! You can get personalized Oracle training by Donald Burleson, right at your shop!

Oracle training



Burleson is the American Team

Note: This Oracle documentation was created as a support and Oracle training reference for use by our DBA performance tuning consulting professionals.  Feel free to ask questions on our Oracle forum.

Verify experience! Anyone considering using the services of an Oracle support expert should independently investigate their credentials and experience, and not rely on advertisements and self-proclaimed expertise. All legitimate Oracle experts publish their Oracle qualifications.

Errata?  Oracle technology is changing and we strive to update our BC Oracle support information.  If you find an error or have a suggestion for improving our content, we would appreciate your feedback.  Just  e-mail:  

and include the URL for the page.


Burleson Consulting

The Oracle of Database Support

Oracle Performance Tuning

Remote DBA Services


Copyright © 1996 -  2020

All rights reserved by Burleson

Oracle ® is the registered trademark of Oracle Corporation.



Oracle Training at Sea
oracle dba poster

Follow us on Twitter 
Oracle performance tuning software 
Oracle Linux poster