在 Oracle 中创建物化视图时出错 - ORA-12052
error creating materialized view in oracle - ORA-12052
晚安,我正在尝试在 Oracle 中创建物化视图,但出现以下错误消息。我知道有几个限制,但我无法确定错误是什么。感谢您的帮助。
观察:
-更新方法必须是增量的。
none 个 table 有主键,但我无法创建它们,因为我无权访问。
在订单上创建物化视图日志
有 ROWID
包括新值;
创建实体化视图登录 tabla_hija
有 ROWID
包括新值;
创建物化视图vm_prueba2
按需快速刷新
带 rowid
为
select ordenid,o.empleadoid,o.clienteid,fechaorden,descuento,nvl(c.desccripcion,'')as ddesc,e.desccripcion
来自 ordenes o,tabla_hija c,tabla_hija e
哪里
( o.clienteid=c.valor(+) and c.id_tabla=1 or c.valor is null ) and
( o.empleadoid=e.valor(+) and e.id_tabla=2 or e.valor is null )order by ordenid asc;
错误信息 -
ORA-12052:
12052. 00000 - “无法快速刷新实体化视图 %s.%s”
*原因:定义中缺少某些 table 的 ROWID 或者
外部联接的内部 table 没有 UNIQUE 约束
加入列。
*Action:指定 FORCE 或 COMPLETE 选项。如果出现这个错误
在创建过程中,物化视图定义可能是
变了。请参阅有关物化视图的文档。
"ROWIDs of certain tables were missing in the definition"
您需要在实例化视图中包含每个源 table 的 rowid:
create materialized view vm_prueba2
refresh fast on demand
with rowid
as
select
o.rowid o_rowid,
c.rowid c_rowid,
e.rowid e_rowid,
ordenid,
o.empleadoid,
o.clienteid,
fechaorden,
descuento,
nvl(c.desccripcion,'') as ddesc,
e.desccripcion
from ordenes o, tabla_hija c, tabla_hija e
where
( o.clienteid=c.valor(+) and c.id_tabla=1 or c.valor is null ) and
( o.empleadoid=e.valor(+) and e.id_tabla=2 or e.valor is null );
我还建议不要对您的 MV 内容进行排序,因为这会给生成增加不必要的开销。存储在磁盘上的行的顺序无关紧要,它会在临时table空间中执行排序时产生大量额外的磁盘I/O。
Oracle 很可能会在刷新时删除该排序,因为 Oracle 会自动创建自己的 SQL 并且仅将您的排序用于初始 MV 创建。为 client/user 个查询保存您的排序。
晚安,我正在尝试在 Oracle 中创建物化视图,但出现以下错误消息。我知道有几个限制,但我无法确定错误是什么。感谢您的帮助。
观察: -更新方法必须是增量的。
none 个 table 有主键,但我无法创建它们,因为我无权访问。
在订单上创建物化视图日志
有 ROWID
包括新值;
创建实体化视图登录 tabla_hija
有 ROWID
包括新值;
创建物化视图vm_prueba2
按需快速刷新
带 rowid
为
select ordenid,o.empleadoid,o.clienteid,fechaorden,descuento,nvl(c.desccripcion,'')as ddesc,e.desccripcion
来自 ordenes o,tabla_hija c,tabla_hija e
哪里
( o.clienteid=c.valor(+) and c.id_tabla=1 or c.valor is null ) and
( o.empleadoid=e.valor(+) and e.id_tabla=2 or e.valor is null )order by ordenid asc;
错误信息 - ORA-12052: 12052. 00000 - “无法快速刷新实体化视图 %s.%s” *原因:定义中缺少某些 table 的 ROWID 或者 外部联接的内部 table 没有 UNIQUE 约束 加入列。 *Action:指定 FORCE 或 COMPLETE 选项。如果出现这个错误 在创建过程中,物化视图定义可能是 变了。请参阅有关物化视图的文档。
"ROWIDs of certain tables were missing in the definition"
您需要在实例化视图中包含每个源 table 的 rowid:
create materialized view vm_prueba2
refresh fast on demand
with rowid
as
select
o.rowid o_rowid,
c.rowid c_rowid,
e.rowid e_rowid,
ordenid,
o.empleadoid,
o.clienteid,
fechaorden,
descuento,
nvl(c.desccripcion,'') as ddesc,
e.desccripcion
from ordenes o, tabla_hija c, tabla_hija e
where
( o.clienteid=c.valor(+) and c.id_tabla=1 or c.valor is null ) and
( o.empleadoid=e.valor(+) and e.id_tabla=2 or e.valor is null );
我还建议不要对您的 MV 内容进行排序,因为这会给生成增加不必要的开销。存储在磁盘上的行的顺序无关紧要,它会在临时table空间中执行排序时产生大量额外的磁盘I/O。
Oracle 很可能会在刷新时删除该排序,因为 Oracle 会自动创建自己的 SQL 并且仅将您的排序用于初始 MV 创建。为 client/user 个查询保存您的排序。