Linux学习笔记
当前位置:Linux学习笔记 > Linux 数据库 > 正文

Oracle中如何编译失效的对象

bbs.yuanmawu.net.jpg

在日常数据库维护过程中,我们需要及时检查数据库中存在的失效对象信息,对于存在异常的对象需要重新编译,各种对象类型可参见如下编译方法:


检查生成无效对象的名称,并存放object.lst文件中


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 <schema name>.<package_name> compile;                              
alter package <schema name>.<package_name> compile body;                         
alter view <schema name>.<view_name> compile;                                    
alter trigger <schema).<trigger_name> compile;     


更多Oracle相关信息见Oracle 专题页面 http://www.searu.org?tid=12

未经允许不得转载:Linux学习笔记 » Oracle中如何编译失效的对象

赞 (0)
分享到:更多 ()