I have a materialized view in an Oracle 10.2.0.50 database that looks like this:
CREATE MATERIALIZED VIEW mv_cis NOCACHE NOLOGGING NOCOMPRESS NOPARALLEL BUILD IMMEDIATE REFRESH FORCE ON DEMAND WITH PRIMARY KEY AS SELECT component_id, ctn, visible_tag, facility, SYSTEM, elev, parent, room_number, remarks, safety_class, seismic, quality_level FROM v_cis;
Pretty straight forward. After creating this materialized view, it is valid and filled with data that I would expect. Then I add a constraint to my table, for example:
ALTER TABLE mv_cis MODIFY ctn CONSTRAINT chk_cis_ctn_null NOT NULL ENABLE VALIDATE;
This works as expected, the table gets a new constraint, and all is well in the world.
However, I then look back at the materialized view and (using Toad for Oracle 12), it shows an invalid. The user_mviews table shows that COMPILE_STATE of which NEED_COMPILE and STALENESS is UNDEFINED . So, I run:
ALTER MATERIALIZED VIEW mv_cis COMPILE;
Without changes. Oddly enough, updating the review still works, but it drives me crazy that it shows invalid and makes my test plan unsuccessful, although everything looks fine. So what am I missing?