根据oracle文档,我们不能使用快速刷新方法来刷新聚合物化视图。 我在Oracle文档中找到了这个例子: http://docs.oracle.com/cd/B19306_01/server.102/b14200/statements_6002.htm
CREATE MATERIALIZED VIEW LOG ON times
WITH ROWID, SEQUENCE (time_id, calendar_year)
INCLUDING NEW VALUES;
CREATE MATERIALIZED VIEW LOG ON products
WITH ROWID, SEQUENCE (prod_id)
INCLUDING NEW VALUES;
CREATE MATERIALIZED VIEW sales_mv
BUILD IMMEDIATE
REFRESH FAST ON COMMIT
AS
SELECT t.calendar_year, p.prod_id,
SUM(s.amount_sold) AS sum_sales
FROM times t, products p, sales s
WHERE t.time_id = s.time_id AND p.prod_id = s.prod_id
GROUP BY t.calendar_year, p.prod_id;
每次我尝试使用聚合并快速刷新彼此时我都会收到错误。
在使用快速刷新和聚合功能的情况下是否有任何特殊提示?
亲切的问候
答案 0 :(得分:1)
根据我的调查,用于创建具有聚合功能和快速刷新方法的MV,你的MV 和MV日志应该有特殊的结构,以便在脚本下面看到正确的MV和MV日志结构:
begin
dbms_advisor.tune_mview(task_name=>:t,
mv_create_stmt=>'create materialized view mv1 refresh fast
as select job,sum(sal) from emp group by job');
end;
然后执行以下查询以查看MV和MV日志的所需结构:
select dbms_lob.substr( statement, 4000, 1 ), statement from user_tune_mview
where task_name='TASK_2042' order by action_id;