0% found this document useful (0 votes)
48 views2 pages

Abount Invalid Objects

This document discusses how to identify and recompile invalid database objects in Oracle. It provides: 1) A SQL query to identify invalid objects and their details like owner, name, type and status. 2) Instructions to recompile individual or all invalid objects in a schema using ALTER statements or the DBMS_UTILITY package respectively. 3) Information on using the UTLRP.SQL script located in the Oracle home directory to recompile all invalid objects after major database changes like upgrades. 4) Confirmation that objects typically become invalid after changes to referenced objects like tables, via DDL statements or patches.

Uploaded by

getsatya347
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
48 views2 pages

Abount Invalid Objects

This document discusses how to identify and recompile invalid database objects in Oracle. It provides: 1) A SQL query to identify invalid objects and their details like owner, name, type and status. 2) Instructions to recompile individual or all invalid objects in a schema using ALTER statements or the DBMS_UTILITY package respectively. 3) Information on using the UTLRP.SQL script located in the Oracle home directory to recompile all invalid objects after major database changes like upgrades. 4) Confirmation that objects typically become invalid after changes to referenced objects like tables, via DDL statements or patches.

Uploaded by

getsatya347
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
You are on page 1/ 2

INVALID OBJECTS

70. How to identify invalid objects?


SELECT owner,object_name, object_type, status FROM dba_objects
WHERE status = 'INVALID';
71. What is the syntax to compile invalid objects manually for small no.of
objects?
Alter object objectname compile;

72. How to compile all the invalid objects in a specified schema?

EXEC DBMS_UTILITY.compile _schema (schema => ‘SCOTT’);

72. How to recompile invalid objects in the database?

Using utlrp.sql and utlprp.sql .these scripts are run after major database changes

such as upgrades or patches.these scripts are located in

$ORACLE_HOME/rdbms/admin directory.Both scripts must be run as

sys user or any user with sysdba priv.The utlrp.sql calls utlprp.sql script with a

command line parameter 0

0 - The level of parallelism is derived based on the CPU_COUNT parameter.

1 - The recompilation is run serially, one object at a time.

N - The recompilation is run in parallel with "N" number of threads.

73. When the objects will become invalid?

In a typical running application, you would not expect to see views or stored procedures become

invalid because applications typically do not change table structures or change view or stored procedure

definitions during normal execution. Changes to tables, views, or PL/SQL units typically occur when an

application is patched or upgraded using a patch script or ad-hoc DDL statements. Dependent objects might

be left invalid after a patch has been applied to change a set of referenced objects.

Eg : when we rebuild a table, the indexes on that table becomes invalid

74. What is UTLRP.SQL?


This script recompiles invalid PLSQL modules.
75. What this script does?
This script recompiles all existing invalid PL/SQL modules in a database.
This is a fairly general script that can be used at any time to recompile all existing
invalid PL/SQL modules in a database If run as one of the last steps during
migration/upgrade/downgrade this script will validate all
PL/SQL modules (i.e. procedures, functions, packages, triggers, types, views,
libraries) during the migration step itself

76. packages and package bodies gong invalid when I make schema changes. How
do I recompile invalid objects?
Here is a script to recompile invalid PL/SQL packages and package bodies
invalid.sql

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;
@run_invalid.sql

You might also like