MVIEW REFRESH GROUP EXPLAINED

MVIEW REFRESH GROUP EXPLAINED

Refresh group is nothing but a package or tool to refresh a group of similar MVIEWS to keep them consistent with refresh.

To create a refresh group on a materialized view or group of mviews, then use the following procedure.

BEGIN
 DBMS_REFRESH.MAKE(name => 'XSCALIBAL',
 list => 'MT,RPMV',
 next_date => sysdate,
 interval => 'sysdate+ 1/1440') ;
END;
/

Check the MVIEWS which are placed under refresh group XSCALIBAL

SQL> col OWNER for a20
SQL> col NAME for a20
SQL> col RNAME for a20
SQL> col INTERVAL for a20
SQL> set lines 200 pages 1000
SQL> SELECT owner,name,rname,interval FROM all_refresh_children;

OWNER                NAME                 RNAME                INTERVAL
-------------------- -------------------- -------------------- --------------------
SYS                  MT                   XSCALIBAL            sysdate+ 1
/1440
SYS                  RPMV                 XSCALIBAL            sysdate+ 1/1440

To manually start the refresh, use refresh function.

BEGIN
 DBMS_REFRESH.REFRESH(name => 'XSCALIBAL') ;
END;
/

There may be situations where the mview refresh happen recursively even though the refresh is not needed To disable the mview refresh group temporarily or permanently, use the following procedure.

BEGIN
 DBMS_REFRESH.CHANGE( name => 'XSCALIBAL',
 next_date => NULL,
 interval => 'NULL') ;
END;
/ 

Leave a Reply

%d bloggers like this: