Recompile the invalid object for oracle.
1. How does the invalid object come?
The Oracle database will invalidate objects if a dependent object is changed. If I rebuild a table, the indexes on that table will become invalid because they use the table'srowids and rebuilding the table changes a row's rowid. It is the same with objects like packages, procedures and functions.
2.Build-in scripts to recompile the invalid objects.
We now have a supported script utlrp.sql located in the $ORACLE_HOME/rdbms/admin/utlrp.sql to do recompile for us.
Below code will list out all the current invalid object and run utlrp.sql to compile all of them.
COLUMN owner format a30
COLUMN object_name format a30 wrap
COLUMN object_type format a30 wrap SET pages 56 lines 130 feedback off echo off
TTITLE "Report of Invalid Objects In Database" skip 2
SELECT owner, object_name, object_type
FROM dba_objects
WHERE status = 'INVALID';
PROMPT "Will now run utlrp.sql to try to recompile objects"
@?/rdbms/admin/utlrp.sql
The following PL/SQL block invokes UTL_RECOMP to recompile invalid objects in the database.
Recompilation time is proportional to the number of invalid objects in the database,
so this command may take a long time to execute on a database with a large number of invalid objects.
Use the following queries to track recompilation progress:
1. Query returning the number of invalid objects remaining. This number should decrease with time.
SELECT COUNT(*) FROM obj$ WHERE status IN (4, 5, 6);
2. Query returning the number of objects compiled so far. This number should increase with time.
SELECT COUNT(*) FROM UTL_RECOMP_COMPILED;
This script automatically chooses serial or parallel recompilation based on the number of CPUs
available (parameter cpu_count) multiplied by the number of threads per CPU (parameter parallel_threads_per_cpu).
On RAC, this number is added across all RAC nodes.
UTL_RECOMP uses DBMS_SCHEDULER to create jobs for parallel recompilation. Jobs are created without instance
affinity so that they can migrate across RAC nodes. Use the following queries to verify
whether UTL_RECOMP jobs are being created and run correctly:
1. Query showing jobs created by UTL_RECOMP
SELECT job_name FROM dba_scheduler_jobs WHERE job_name like 'UTL_RECOMP_SLAVE_%';
2. Query showing UTL_RECOMP jobs that are running
SELECT job_name FROM dba_scheduler_running_jobs WHERE job_name like 'UTL_RECOMP_SLAVE_%';
Below is a sql with a good format to list all the invalid database object.
break on c1 skip 2
set pages 999
col c1 heading 'owner' format a15
col c2 heading 'name' format a40
col c3 heading 'type' format a10
ttitle 'Invalid|Objects'
select
owner c1,
object_type c3,
object_name c2
from
dba_objects
where
status != 'VALID'
order by
owner,
object_type;
3. Recompile with UTL_RECOMP package
EXEC UTL_RECOMP.recomp_serial('schema name');
4. compile command for individual object.
For function:
alter function gpcomp1.fn_load_notes_from_jde compile;
For procedure:
alter procedure gpcomp1.updatetemplate compile;
For view
alter view gpcomp1.gamatchedcashapplied compile;
For public synonym, which can only be recompiled by sys
alter public synonym gpcrfcode compile
Here is a script to recompile invalid PL/SQL packages and package bodies.
You may need to run it more than once for dependencies, if you get errors from the script.
Set heading off;
set feedback off;
set echo off;
Set lines 999;
Spool run_invalid.sql
select
'ALTER ' || OBJECT_TYPE || ' ' ||
OWNER || '.' || OBJECT_NAME || ' COMPILE;'
from
dba_objects
where
status = 'INVALID'
and
object_type in ('PACKAGE','FUNCTION','PROCEDURE')
;
spool off;
set heading on;
set feedback on;
set echo on;
@run_invalid.sql
check the status of oracle component.
select comp_id, comp_name, version, status, namespace, schema from dba_registry;
Recompile the invalid object for oracle.的更多相关文章
- Invalid object name ‘sys.configurations’. (Microsoft SQL Server, Error: 208)
http://blogs.msdn.com/b/ramaprasanna/archive/2009/09/16/invalid-object-name-sys-configurations-micro ...
- MacTex XeLaTex xdvipdfmx:fatal: pdf_ref_obj(): passed invalid object. 报错的解决方法
在使用MacTex配合TexStudio编译beamer的时候,爆出如下错误, xdvipdfmx:fatal: pdf_ref_obj(): passed invalid object. 结果尝试其 ...
- Oracle EBS 重新编译无效对象 invalid object
1. 查看数据库中的无效对象 check oracle object SQL> select count(*) from dba_objects where status= ...
- oracle impdp ORA-02304 invalid object identifier literal
reference: https://webgeest.blogspot.com/2015/07/ora-39083-ora-02304-on-impdp-datapump.html 解决方法 ...
- Know How To Use ID_NULL Function To Search An Object In Oracle Forms
ID_NULL built in function is used to determine that an object type variable is null or not null in O ...
- sql - Invalid object name 'dbo.in$'
这是我从excel导入的表,用查询的时候,不加前面部分的'dbo',能查出来,好像是owner的原因吧.
- sp_executesql invalid object name
https://stackoverflow.com/questions/10417126/dynamically-named-temp-table-returns-invalid-object-nam ...
- Manipulating Data from Oracle Object Storage to ADW with Oracle Data Integrator (ODI)
0. Introduction and Prerequisites This article presents an overview on how to use Oracle Data Integr ...
- Oracle 收缩表大小 Oracle Shrink Table --转载
从10g开始,oracle开始提供Shrink的命令,假如我们的表空间中支持自动段空间管理 (ASSM),就可以使用这个特性缩小段,即降低HWM.这里需要强调一点,10g的这个新特性,仅对ASSM表空 ...
随机推荐
- 关于javascript在作用域中的变量定义你所不知道的一些东西
//先看一段代码 var a = 100; function test(){ alert(a); var a = 200; } test(); /* 结果:undifined 原因:js引擎在执行sc ...
- echo "不允许上传该类型的文件
<?php教程 // 上传设置 $maxsize=10002400; //最大允许上传的文件大小 $alltype=array(".php"," ...
- 如何处理NBU Frozen Media
https://support.symantec.com/en_US/article.TECH21473.html
- 使用 matlab 产生GK101任意波数据文件的方法
一.引言 MATLAB是由美国mathworks公司发布的主要面对科学计算.可视化以及交互式程序设计的高科技计算环境.它不但包含高效的数值计算.数据处理能力,而且简单易用,是工程师日常研发过程中不可缺 ...
- c#是否参入中间变量交换变量的几种方法
大家很熟悉知道,交换变量经常的使用的一种方法是使用第三个变量,也符合正常人的思维逻辑,但是还有其他的一些方法来实现,但是有点“偏门”,记住就好了.下面就列举这几种方法. 第一种方法,会用到参数的方法再 ...
- 在HTML中如何把块的边框做成圆角
adius,就是半径的意思.用这个属性可以很容易做出圆角效果,当然,也可以做出圆形效果.原理很简单,“正方形的内切圆的半径等于正方形边长的一半”.下面就做一个红色的圆. 工具/原料 Adobe Dre ...
- 如何解包,编辑,重新打包boot images
HOWTO: Unpack, Edit, and Repack Boot Images http://forum.xda-developers.com/showthread.php?t=443994 ...
- Apache Spark源码走读之17 -- 如何进行代码跟读
欢迎转载,转载请注明出处,徽沪一郎 概要 今天不谈Spark中什么复杂的技术实现,只稍为聊聊如何进行代码跟读.众所周知,Spark使用scala进行开发,由于scala有众多的语法糖,很多时候代码跟着 ...
- 【SIGGRAPH 2015】【巫师3 狂猎 The Witcher 3: Wild Hunt 】顶级的开放世界游戏的实现技术。
[SIGGRAPH 2015][巫师3 狂猎 The Witcher 3: Wild Hunt ]顶级的开放世界游戏的实现技术 作者:西川善司 日文链接 http://www.4gamer.net/ ...
- try...except 错误记录添加logging