Oracle9iR2 Data Warehousing

As new data is loaded into the warehouse, any materialized view based on this data must be updated. This operation is known as refresh. The frequency of refresh determines how recent the summary data is with respect to the detail data. The refresh operation can be very time consuming depending on the amount of data involved. You must carefully determine your refresh policy based on available resources and your application's need for current data. If your application needs the materialized view to be synchronized with the detail data at all times, choose the ON COMMIT option. With this option, Oracle will automatically refresh the materialized view when the changes to detail data get committed. If your warehouse gets new data only once a day during a specified maintenance window, deferring the refresh until then would be the right choice. Deferred or ON DEMAND refresh can be done using the DBMS_MVIEW package.
The refresh policy must be chosen when creating the materialized view. You can alter it at a later time by issuing an ALTER MATERIALIZED VIEW statement.
Oracle provides several procedures for ON DEMAND refresh in the DBMS_MVIEW supplied PL/SQL package, as follows:
DBMS_MVIEW.REFRESH
DBMS_MVIEW.REFRESH_DEPENDENT
DBMS_MVIEW.REFRESH_ALL_MVIEWS
If you want to refresh all your materialized views, which is often done after bulk loading new detail data, you can use the DBMS_MVIEW.REFRESH_ALL_MVIEWS procedure, as shown in the following example. In this example, the :failures bind variable returns the number of failed refreshes.
EXECUTE DBMS_MVIEW.REFRESH_ALL_MVIEWS(:failures);