在日常数据库维护过程中,我们需要及时检查数据库中存在的失效对象信息,对于存在异常的对象需要重新编译,各种对象类型可参见如下编译方法:
pool objects.lst
set pagesize500
set linesize 100
select substr(comp_name,1,40) comp_name, status, substr(version,1,10) version
from dba_registry
order by comp_name;
select substr(object_name,1,40) object_name,substr(owner,1,15) owner,object_type
from dba_objects
where status='INVALID' order by owner,object_type;
select owner,object_type,count(*)
from dba_objects
where status='INVALID'
group by owner,object_type order by owner,object_type ;
spool off
生成后关闭sqlplus的spool记录
各个对象的编译方法分别如下:
alter package . compile;
alter package . compile body;
alter view . compile;
alter trigger