Question

I have one Materialized view on one server which is created by DB link. There is one job running on that Mview. (created with dbms_refresh.make earlier).

Now I have created 3 new fields in original table. My queries are.

1) Do I need to drop and create Mview again, if yes, do i need to create Mview log on main server again 2) What happens to job running on Mview , do i need to create it agin?

Also there are views created on Mview ,so --If i run create or replace view query , will it create any problem?

Please guide.

Thanks!

Was it helpful?

Solution

If you need to include the new columns in your materialized view then yes you need to re-create the materialized view. You must explicitly drop the view as there is no "create or replace materialized view" statement.

DROP MATERIALIZED VIEW blah;
CREATE MATERIALIZED VIEW blah...

Dropping/recreating the materialized view should re-create the refresh job. Not 100% certain, but you should probably recreate the log as well.

And, if you don't need to include the new columns in your view, you really don't need to do anything...

OTHER TIPS

After dropping/creating the materialized view, you should recompile the other views afterwards, because they may have become invalid.

You can check if that happened with

select * 
from user_objects
where status = 'INVALID';

Recompile a view can be done with

alter view the_view compile;

or

exec dbms_utility.compile_schema(user);

This simply recompiles everything in your schema. Be sure to have no running jobs while doing this!

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top