mview刷新:Oracle 11g上的原子_刷新
我有一个Oracle数据库11g,其中有几个具体化的视图,我希望每晚刷新。我确实创建了一个在Oracle中计划的过程 在该过程中,我使用以下语法刷新MV:mview刷新:Oracle 11g上的原子_刷新,oracle,oracle11g,Oracle,Oracle11g,我有一个Oracle数据库11g,其中有几个具体化的视图,我希望每晚刷新。我确实创建了一个在Oracle中计划的过程 在该过程中,我使用以下语法刷新MV: BEGIN DBMS_MVIEW.REFRESH(' MV_1','C', atomic_refresh=>false); END; MV_1如下所示: SELECT /*+ NO_PARALLEL(adres@db2) */ a.n a_nr , c.c_nr , a.i id , b.
BEGIN
DBMS_MVIEW.REFRESH(' MV_1','C', atomic_refresh=>false);
END;
MV_1如下所示:
SELECT
/*+ NO_PARALLEL(adres@db2) */
a.n a_nr ,
c.c_nr ,
a.i id ,
b.name ,
FROM TABLE(pck_1.fnc_1) a
JOIN b b
ON a.i = b.id
JOIN adres@db2 c
ON a.n = c.nr;
请注意从函数FNC_1接收的表ADRES和表类型的数据库链接
查询运行正常,大约需要5分钟。
从DUAL运行selecttable(pck_1.fnc_1)也需要大约5分钟,并返回一个包含两列(I和N)的表
但当我执行刷新MV的过程时,我得到一个ora-12840错误:
Error starting at line 1 in command:
BEGIN
DBMS_MVIEW.REFRESH(' MV_1','C', atomic_refresh=>false);
END;
Error report:
ORA-12008: Fout in pad voor vernieuwen van snapshot.
ORA-12840: Kan externe tabel niet benaderen na een parallelle transactie of een transactie voor direct invoegen.
ORA-06512: in "SYS.DBMS_SNAPSHOT", regel 2566
ORA-06512: in "SYS.DBMS_SNAPSHOT", regel 2779
ORA-06512: in "SYS.DBMS_SNAPSHOT", regel 2748
ORA-06512: in regel 2
12008. 00000 - "error in materialized view refresh path"
*Cause: Table SNAP$_<mview_name> reads rows from the view
MVIEW$_<mview_name>, which is a view on the master table
(the master may be at a remote site). Any
error in this path will cause this error at refresh time.
For fast refreshes, the table <master_owner>.MLOG$_<master>
is also referenced.
*Action: Examine the other messages on the stack to find the problem.
See if the objects SNAP$_<mview_name>, MVIEW$_<mview_name>,
<mowner>.<master>@<dblink>, <mowner>.MLOG$_<master>@<dblink>
still exist.
命令中从第1行开始的错误:
开始
DBMS_MVIEW.REFRESH('MV_1','C',原子_REFRESH=>false);
结束;
错误报告:
ORA-12008:voor vernieuwen面包车快照中的Fout。
ORA-12840:外部事务表不支持并行事务或直接发票。
ORA-06512:在“SYS.DBMS_快照”中,regel 2566
ORA-06512:在“SYS.DBMS_快照”中,regel 2779
ORA-06512:在“SYS.DBMS_快照”中,regel 2748
ORA-06512:在regel 2中
1200800000-“物化视图刷新路径中出错”
*原因:表SNAP$\从视图中读取行
MVIEW$\是主表上的一个视图
(主机可能位于远程站点)。任何
此路径中的错误将在刷新时导致此错误。
要快速刷新,请使用table.MLOG$_
也被引用。
*操作:检查堆栈上的其他消息以查找问题。
查看对象是否捕捉$\u、MVIEW$\u,
.@、.MLOG$_@
仍然存在。
当我将atomic_refresh过程的值更改为true时,该过程将成功完成
所以我的问题是:
我确实给了原子_refresh参数FALSE的值,以强制截断MV,因此MV的刷新更快。作为副作用,它会创建多个会话(并行),这会导致我的SQL错误。添加参数PARALLILISM=>0没有给出任何结果
是否可以尽可能快地完全刷新物化视图,而不必担心在一个会话中撤消数据
这是Oracle关于原子更新的说法: