A technical troubleshooting blog about Oracle with other Databases & Cloud Technologies.

ORA-12012 ORA-12008 ORA-942 Materialized view Job Fails 

1 min read
Refreshing a Materialized View via the Oracle job scheduler reports the following errors, however manual refresh succeeds.
*** SERVICE NAME:(SYS$USERS) 2006-12-04 14:12:37.936
*** SESSION ID:(23.10780) 2006-12-04 14:12:37.936
*** 2006-12-04 14:12:37.936
ORA-12012: error on auto execute of job 346
ORA-12008: error in materialized view refresh path
ORA-00942: table or view does not exist
ORA-06512: at "SYS.DBMS_SNAPSHOT", line 2255
ORA-06512: at "SYS.DBMS_SNAPSHOT", line 2461
ORA-06512: at "SYS.DBMS_IREFRESH", line 683
ORA-06512: at "SYS.DBMS_REFRESH", line 195
ORA-06512: at line 1
Troubleshooting steps:

Object Privileges -  If the owner has not granted explicit rights to these objects the scheduled job will fail.

To implement the solution, please execute the following steps:
grant select privileges on the primary table(s) or the "select any table" system privilege to the given snapshot owner, not through a role.
Example:

If the mview is REFRESH FAST type, then need to grant SELECT in MLOG table like:
GRANT SELECT ON MLOG$_<tableName> to mview_owner;
If mview is in Replication environment, then need to grant SELECT on RUPD$_ table like:
GRANT SELECT ON RUPD$_<tableName> to mview_owner;

Hope it worked !! 🙂