oracle 如何在sqlplus中显示错误
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/25247461/
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
How to show errors in sqlplus
提问by mlwacosmos
I would like to know how to show errors in sqlplus.
我想知道如何在 sqlplus 中显示错误。
try to compile a view
alter view SYS.DBA_XML_SCHEMAS compile;
I have the message :
ERROR at line 1: ORA-04063 : view altered with compilation errors.
I try :
show errors;
it says :
No errors
I try :
show errors view SYS.DBA_XML_SCHEMAS
it says :
LINE/COL ERROR 0/0 ORA-00942 : table or view does not exist
尝试编译一个视图
alter view SYS.DBA_XML_SCHEMAS compile;
我有消息:
ERROR at line 1: ORA-04063 : view altered with compilation errors.
我尝试:
show errors;
它说 :
No errors
我尝试:
show errors view SYS.DBA_XML_SCHEMAS
它说 :
LINE/COL ERROR 0/0 ORA-00942 : table or view does not exist
If I could compile with errors, the view must exist or it would tell me that the view does not exist. I dont know how to display the compilation errors of the view
如果我可以编译时出错,则视图必须存在,否则它会告诉我该视图不存在。我不知道如何显示视图的编译错误
thank you
谢谢你
回答by Alex Poole
You can query the dba_errors
view, or the all_errors
view, directly; the SQL*Plus show errors
command seems to be a wrapper around that anyway.
您可以直接查询dba_errors
视图或all_errors
视图;show errors
无论如何,SQL*Plus命令似乎是一个包装器。
select line, position, attribute, text
from dba_errors
where owner = 'SYS'
and type = 'VIEW'
and name = 'DBA_XML_SCHEMAS'
order by sequence;
But based on what show errors
is telling you, that will just show the same thing, error "ORA-00942 : table or view does not exist" from line 0 position 0.
但是根据show errors
告诉您的内容,这只会显示相同的内容,即第 0 行位置 0 的错误“ORA-00942:表或视图不存在”。
That doesn't make much sense, but internal views are sometimes strange things, and attempting to recompile one is probably not a good idea.
这没有多大意义,但内部视图有时是奇怪的东西,尝试重新编译一个可能不是一个好主意。
You might need to get your DBA to run utlrp.sql
to recompile all invalid objectsin the database. As with anything you think of doing under the SYS schema, that should be done with care; and only if selecting from the view still says it's invalid and failed recompilation.
您可能需要让 DBA 运行utlrp.sql
以重新编译数据库中的所有无效对象。与您想在 SYS 模式下做的任何事情一样,应该小心地做;并且仅当从视图中选择仍然说它无效且重新编译失败时。