Materialized Views

Check

Which views exist...

SET LINESIZE 200

SELECT owner, mview_name, query

FROM DBA_MVIEWS;

All materialized views tend to be owned by SYSTEM. The query text seems to be the only way to identify the owner of the underlying tables.

To identify materialized views which reference an object owned by a specific user, try...

SET SERVEROUTPUT ON

DECLARE

l_var VARCHAR2(32767); -- max length

BEGIN

FOR rec IN (SELECT mview_name, query FROM dba_mviews) LOOP

l_var := rec.query;

IF l_var LIKE '%&User%'

THEN

dbms_output.put_line(rec.mview_name || ' - ' || SUBSTR(rec.query,1,100));

END IF;

END LOOP;

END;

For the full text of materialized views which reference a specifc object try...

SET SERVEROUTPUT ON

DECLARE

l_var VARCHAR2(32767); -- max length

BEGIN

FOR rec IN (SELECT mview_name, query FROM dba_mviews) LOOP

l_var := rec.query;

IF l_var LIKE '%&Object%'

THEN

dbms_output.put_line(rec.mview_name || ' - ' || rec.query);

END IF;

END LOOP;

END;

Data Dictionary Views

ALL_ and USER_ versions of these views are also available...

  1. DBA_MVIEWS

  2. DBA_MVIEW_AGGREGATES

  3. DBA_MVIEW_ANALYSIS

  4. DBA_MVIEW_COMMENTS

  5. DBA_MVIEW_DETAIL_PARTITION

  6. DBA_MVIEW_DETAIL_RELATIONS

  7. DBA_MVIEW_DETAIL_SUBPARTITION

  8. DBA_MVIEW_JOINS

  9. DBA_MVIEW_KEYS

  10. DBA_MVIEW_LOGS

  11. DBA_MVIEW_LOG_FILTER_COLS

  12. DBA_MVIEW_REFRESH_TIMES

  13. DBA_REGISTERED_MVIEWS

  14. DBA_REGISTERED_MVIEW_GROUPS

  15. DBA_TUNE_MVIEW