说明:我的数据库中有200多个无效对象,原因可能只有几个对象(其他因为依赖性).有没有办法可以选择对象名称和“错误原因”,因为它无效.
解决方法
您可以查询[DBA / ALL / USER] _ERRORS.它描述了当前用户拥有的所有存储对象(视图,过程,函数,包和包体)的当前错误.
选择要查询的视图,具体取决于您拥有的权限:
- DBA_ : All objects in the database
- ALL_ : All objects owned by the user and on which the user has been granted privileges
- USER_ : All objects owned by the user
例如,
我创建了一个带有编译错误的过程,我想查询错误详细信息:
SQL> CREATE OR REPLACE PROCEDURE p
2 BEGIN
3 NULL
4 END;
5 /
Warning: Procedure created with compilation errors.
SQL>
SQL> SELECT NAME,TYPE,line,text FROM user_errors;
NAME TYPE LINE TEXT
----- ---------- ---------- --------------------------------------------------
P PROCEDURE 2 PLS-00103: Encountered the symbol "BEGIN" when exp
ecting one of the following:
( ; is with authid as cluster compress order us
ing compiled
wrapped external deterministic parallel_enable
pipelined
result_cache accessible
SQL>
在文档here中阅读更多相关信息