重新编译失效对像可执行utlrp.sql文件:

SQL> @?/rdbms/admin/utlrp.sql

TIMESTAMP
--------------------------------------------------------------------------------
COMP_TIMESTAMP UTLRP_BGN 2016-08-24 13:04:49 DOC> The following PL/SQL block invokes UTL_RECOMP to recompile invalid
DOC> objects in the database. Recompilation time is proportional to the
DOC> number of invalid objects in the database, so this command may take
DOC> a long time to execute on a database with a large number of invalid
DOC> objects.
DOC>
DOC> Use the following queries to track recompilation progress:
DOC>
DOC> 1. Query returning the number of invalid objects remaining. This
DOC> number should decrease with time.
DOC> SELECT COUNT(*) FROM obj$ WHERE status IN (4, 5, 6);
DOC>
DOC> 2. Query returning the number of objects compiled so far. This number
DOC> should increase with time.
DOC> SELECT COUNT(*) FROM UTL_RECOMP_COMPILED;
DOC>
DOC> This script automatically chooses serial or parallel recompilation
DOC> based on the number of CPUs available (parameter cpu_count) multiplied
DOC> by the number of threads per CPU (parameter parallel_threads_per_cpu).
DOC> On RAC, this number is added across all RAC nodes.
DOC>
DOC> UTL_RECOMP uses DBMS_SCHEDULER to create jobs for parallel
DOC> recompilation. Jobs are created without instance affinity so that they
DOC> can migrate across RAC nodes. Use the following queries to verify
DOC> whether UTL_RECOMP jobs are being created and run correctly:
DOC>
DOC> 1. Query showing jobs created by UTL_RECOMP
DOC> SELECT job_name FROM dba_scheduler_jobs
DOC> WHERE job_name like 'UTL_RECOMP_SLAVE_%';
DOC>
DOC> 2. Query showing UTL_RECOMP jobs that are running
DOC> SELECT job_name FROM dba_scheduler_running_jobs
DOC> WHERE job_name like 'UTL_RECOMP_SLAVE_%';
DOC># PL/SQL 过程已成功完成。 TIMESTAMP
--------------------------------------------------------------------------------
COMP_TIMESTAMP UTLRP_END 2016-08-24 13:04:50 PL/SQL 过程已成功完成。 DOC> The following query reports the number of objects that have compiled
DOC> with errors (objects that compile with errors have status set to 3 in
DOC> obj$). If the number is higher than expected, please examine the error
DOC> messages reported with each object (using SHOW ERRORS) to see if they
DOC> point to system misconfiguration or resource constraints that must be
DOC> fixed before attempting to recompile these objects.
DOC># OBJECTS WITH ERRORS
-------------------
4 DOC> The following query reports the number of errors caught during
DOC> recompilation. If this number is non-zero, please query the error
DOC> messages in the table UTL_RECOMP_ERRORS to see if any of these errors
DOC> are due to misconfiguration or resource constraints that must be
DOC> fixed before objects can compile successfully.
DOC># ERRORS DURING RECOMPILATION
---------------------------
0 PL/SQL 过程已成功完成。

进一步研究文件sql文件,可以看到,在默认情况下Oracle会调用存储过程utl_recomp.recomp_parallel并行编译无效包:

begin
sys.UTL_RECOMP.recomp_parallel(0);
end;

当threads取值为0时,由Oracle根据参数cpu_count和parallel_threads_per_cpu自行决定并行度;

SQL> show parameter cpu

NAME                                 TYPE        VALUE
------------------------------------ ----------- --------------
cpu_count integer 4
parallel_threads_per_cpu integer 2

有时候,由于Oracle bug 14065287,在启用并行编译无效对象时,脚本utlrp.sql会出现HANG现象,这时需要启用串行编译无效对象,如下所示:

BEGIN
sys.utl_recomp.recomp_serial();
END;

注意:如果在执行中,中断了,下次如果再次执行时,有可能会出现名称已由现有对像使用,要在重编译前先删除下列索引

drop index SYS.UTL_RECOMP_COMP_IDX1;

使用并行执行时,会使用到SGA中的large pool,如果large pool大小不够大,会报如下错误:

ORA-12801: 并行查询服务器 P012 中发出错误信号
ORA-12853: PX 缓冲区的内存不足: 当前为 16336K, 最大需要 178560K
ORA-04031: 无法分配 65560 字节的共享内存 ("large pool","unknown object","large pool","PX msg pool")
ORA-06512: 在 "SYS.UTL_RECOMP", line 865
ORA-06512: 在 line 2

如果不是sys用户执行,可先授予相关的执行权限:

grant execute on UTL_RECOMP to XXX;

oracle重新编译失效对像的更多相关文章

  1. ORACLE编译失效对象小结

    在日常数据库维护过程中,我们会发现数据库中一些对象(包Package.存储过程Procedure.函数Function.视图View.同义词.....)会失效,呈现无效状态(INVALID).有时候需 ...

  2. oracle编译 失效对象方式

    如果procedure 所使用的表结构发生了改变等其它情况,在相应的xxx_objects表的status字段会变为invalid状态,但是如果在调用时procedure会自动编译,grant失效对象 ...

  3. sqlplus编译失效对象

    原文整理自:http://www.51testing.com/?uid-16403-action-viewspace-itemid-98161:http://www.eygle.com/archive ...

  4. 转://oracle 重新编译用户无效对象

    select owner,object_name, replace(object_type,' ','') object_type,to_char(created,'yyyy-mm-dd') as c ...

  5. Oracle 11g 编译使用BBED

    环境:RHEL 6.4 + Oracle 11.2.0.4 1. 拷贝缺失文件 2. 编译BBED 3. BBED使用测试 Reference 1. 拷贝缺失文件 11g中缺失几个相关文件,但我们实际 ...

  6. oracle 提示口令失效解决方法

    Oracle错误代码:ORA-28002. 受影响版本:Oracle11g以上版本. 导致密码消失的原因:Oracle 11g中默认的DEFAULT概要文件中口令有效期PASSWORD_LIFE_TI ...

  7. oracle本地编译问题

    oracle10.2: --将过程重新编译为本地编译方式,提示有编译错误,经查提示未设置plsql_native_library_dir 参数 SQL> alter procedure p_xx ...

  8. Oracle视图编译错误解决办法

    因为新搭的环境,数据库是从另一个现成的环境导过来的,直接后台用exp和imp命令操作.但是新环境的Oracle数据库有问题,一些视图创建不了,导致用到这些视图的视图和存储过程也编译不了.后来手工重新编 ...

  9. Oracle 重新编译存储过程/函数等

    第一种  如果你使用 PL/SQL Developer工具          左侧工具栏中选择“存储过程”->选择已经失效的procedure->右键->选择重新编译 即可完成 第二 ...

随机推荐

  1. python 智能合约日志操作

    from __future__ import unicode_literals import json from time import sleep, time # 中文编码 def encode_s ...

  2. nginx配置和网站的部署

    环境: CentOS Linux release 7.3.1611 (Core) nginx version: nginx/1.13.4 PHP 5.4.16 (cli) (built: Nov 6 ...

  3. Memory及其controller芯片整体测试方案(上篇)

    如果你最近想买手机,没准儿你一看价格会被吓到手机什么时候偷偷涨价啦! 其实对于手机涨价,手机制造商也是有苦难言,其中一个显著的原因是存储器芯片价格的上涨↗↗↗ >>> 存储器memo ...

  4. Java学习个人备忘录之面向对象概念

    对象,其实就是该类事物实实在在存在的个体. 类与对象之间的关系?类:一类事物的描述.对象:该类事物的实例.在java中通过new来创建的.举例来说,类就是汽车说明书,类只能在理论上造一辆汽车,并且这个 ...

  5. Alpha 冲刺(2/10)

    队名 火箭少男100 组长博客 林燊大哥 作业博客 Alpha 冲鸭鸭! 成员冲刺阶段情况 林燊(组长) 过去两天完成了哪些任务 协调各成员之间的工作 协助前端界面的开发 搭建测试用服务器的环境 完成 ...

  6. SpringMVC拦截器实现登录认证(转发)

    感谢原作者,转发自:http://blog.csdn.net/u014427391/article/details/51419521 以Demo的形式讲诉拦截器的使用 项目结构如图: 需要的jar:有 ...

  7. 团队作业7——第二次项目冲刺(Beta版本)-第一篇

    1.当天站立式会议照片: 2.工作分工: 团队成员 分工 郭达22120 项目整合,后台代码 刘德培44060 数据库模块后台连接 石浩洋22061 前台界面优化 曾繁钦22056 前台界面优化.测试 ...

  8. 第二章 持续集成jenkins工具使用之系统基本设置

    Jenkin系统初始化成功后,会进入用户设置页面,设置用户信息后即可进入系统,如果没有设置用户,jenkins系统默认的用户是admin,密码administrator 1.1         Con ...

  9. redis——持久化方式RDB与AOF分析

    https://blog.csdn.net/u014229282/article/details/81121214 redis两种持久化的方式 RDB持久化可以在指定的时间间隔内生成数据集的时间点快照 ...

  10. 使用oledb读取excel表

    string path = "C:\\Users\\aaa\\Desktop\\aa.xls"; string conn = "Provider = Microsoft. ...