我在Oracle中有一个现有的物化视图。
但我想为它添加更多列。我看到它无法执行
CREATE OR REPLACE
到物化视图,我该怎么办呢?
谢谢!
答案 0 :(得分:0)
将列添加到基表中,然后在MV中运行刷新。
declare
begin
DBMS_SNAPSHOT.REFRESH('your_mv', 'f');
end;
答案 1 :(得分:0)
select * from dba_objects where status='INVALID';
grant create materialized view to <schema>;
grant create table to <schema>;
drop MATERIALIZED VIEW <schema>.<mvname>;
CREATE MATERIALIZED VIEW <schema>.<mvname>
(...)
AS SELECT (...);
select * from <schema>.<mvname>;
revoke create materialized view from <schema>;
revoke create table from <schema>;
select * from dba_objects where status='INVALID';