I need to access the user_mviews or all_mviews table to get meta information about materialized view in my app. Which grants are necessary to read the user_mviews table?
by default all users can read the
all_mviews views since the SELECT right is granted to
SQL> SELECT grantee, privilege, table_name 2 FROM dba_tab_privs 3 WHERE table_name IN ('USER_MVIEWS', 'ALL_MVIEWS'); GRANTEE PRIVILEGE TABLE_NAME -------- ---------- ------------ PUBLIC SELECT USER_MVIEWS PUBLIC SELECT ALL_MVIEWS
If for some reason this grant has been removed, you would need to regrant the rights to either
public or a specific user (with a DBA account):
GRANT SELECT ON user_mviews TO <user>;
Edit: By definition,
USER_MVIEWS describes materialized views owned by the current user while
ALL_MVIEWS describes the materialized views accessible to the current user (the user needs to be granted SELECT on the mview either directly or through a role).