oracle 为什么 SQL Developer 认为我的物化视图中有错误?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/25726364/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-19 02:30:08  来源:igfitidea点击:

Why does SQL Developer think there's an error in my materialized views?

oracleviewsoracle-sqldevelopermaterialized-views

提问by user1578653

I created some materialized views and Oracle SQL Developer puts a little red 'x' next to each of them. At the moment they are returning the correct information when I query them and running the following query in SQL Plus suggests that there are no errors:

我创建了一些物化视图,Oracle SQL Developer 在每个视图旁边放了一个红色的小“x”。目前,当我查询它们并在 SQL Plus 中运行以下查询时,它们返回正确的信息表明没有错误:

SELECT * FROM USER_SNAPSHOTS

The ERRORcolumn in this returns 0 for the materialized views in question.

ERROR对于有问题的物化视图,此列中的列返回 0。

Does anyone know why SQL Developer thinks there is an error? Is there anywhere else I can check?

有谁知道为什么 SQL Developer 认为有错误?我还有其他地方可以检查吗?

UPDATE

更新

Taking Patrick's advice I ran the following query:

根据帕特里克的建议,我运行了以下查询:

SELECT * FROM ALL_MVIEWS

The COMPILE_STATE is 'NEEDS_COMPILE' for each view in question. What does this mean? Why would it need to be recompiled? None of the underlying tables have been changed.

对于每个有问题的视图,COMPILE_STATE 是“NEEDS_COMPILE”。这是什么意思?为什么需要重新编译?未更改任何基础表。

采纳答案by user1578653

For some reason, simply refreshing the materialized views made the 'error' go away. So not a true error, more of a reminder that the data isn't up to date. I guess you can ignore it if the table structure hasn't actually changed then...

出于某种原因,只需刷新物化视图即可使“错误”消失。所以不是真正的错误,更多的是提醒数据不是最新的。如果表结构实际上没有改变,我想你可以忽略它......

回答by gabriel capparelli

To fix 'red' cross icon on views (actually it is a white cross over red background) due to NEEDS_COMPILE run the ALTER VIEW COMMAND.

要修复由于 NEEDS_COMPILE 导致的视图上的“红色”十字图标(实际上它是红色背景上的白色十字),请运行 ALTER VIEW COMMAND。

ALTER VIEW MY_VIEW COMPILE;

Check ORACLE SQL Reference about ALTER VIEW.

检查关于ALTER VIEW 的ORACLE SQL 参考。

http://docs.oracle.com/cd/B19306_01/server.102/b14200/statements_4004.htm

http://docs.oracle.com/cd/B19306_01/server.102/b14200/statements_4004.htm

回答by Edd

This can be caused by modifications to an underlying table that the materialized view is based on. For example: increasing the max size of a column in the table which is included in the materialized view.

这可能是由于对物化视图所基于的基础表的修改造成的。例如:增加包含在实体化视图中的表中列的最大大小。

To refresh the materialized view you can do the following:

要刷新实体化视图,您可以执行以下操作:

BEGIN
DBMS_SNAPSHOT.REFRESH('Name of materialized view');
END;