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表空 ...
随机推荐
- Struts2 从一个Action跳至另一个Action
Struts2 从一个Action跳至另一个Action 一.注解的 @Result(name=SUCCESS,type="chain", params={"actio ...
- MyEclipse10整合Axis2插件
1.下载axis2的eclipse插件 2.把下载好的两个插件包解压后放置myeclipse10安装目录下的dropins文件夹中 3.重启MyEclipse10后 File->New-> ...
- Matlab Delete Row or Col 删除矩阵的行或列
Matlab中,我们有时候要删除矩阵中的某行某列,可以采用下列方法进行删除: a = [ ]; a(,:) = []; % Delete row a(:,) = []; % Delete col
- PreparedStatement与Statement的区别
PreparedStatement与statement的区别 1.PreparedStatement是预编译的,对于批量处理可以大大提高效率. 也叫JDBC存储过程 2.使用 Statement 对象 ...
- POJ 1988 Cube Stacking(带权并查集)
Cube Stacking Time Limit: 2000MS Memory Limit: 30000K Total Submissions: 23678 Accepted: 8299 Ca ...
- 移动端单页视图库,适用于制作移动Web touchbox
ouchBox 原文:https://github.com/maxzhang/touchbox 移动端单页视图库,适用于制作移动专题 DEMO http://jsbin.com/vatuma/late ...
- StringUtils cannot be resolved
I am using Java server pages and for using String Manipulations and i am Using StringUtils which i a ...
- visio studio2008 删除最近的项目
visio studio2008 删除最近的项目 创建move.bat: @echo off @REG Delete HKCU\Software\Microsoft\VisualStudio\9.0 ...
- linux load average
性能分析_linux服务器CPU_Load Average 理解Linux系统中的load average(图文版) 理解Load Average做好压力测试 top命令的Load average 含 ...
- hlg 2130 状压dp
基本的状压dp 需要注意的是两点之间直线最短 所以不需要进行floyd 由于把dp的memset放在了初始化0的后面de了好久的bug.. #include<stdio.h> #inclu ...