Tuesday, August 12, 2008

Find Invalid Objects in Oracle

Find Invalid Objects:
1.To Find the number of invalid objects :
select count(*) from dba_objects where status=’INVALID’;
select owner,object_type,count(*) from dba_objects where status='INVALID' group by owner,object_type;

2.To identify the object name and their types and owner:
select owner, object_name,object_type from dba_objects where status =’INVALID’;

Try Manual method of validation:
Alter procedure owner.procedure_name compile;
Alter function owner.function_name compile;
Alter view owner.view_name compile;
Alter package owner.package_name compile;
Alter package owner.package_name compile body;
Alter materialized view owner.Package_name Compile;

Find Dependencies & Debug error message:
If the error message is generic like ,table or view does not exist/nocolumns in table ,then to debug further we need to find all the objectson which the invalid object is dependent on.
We can get the information using the following query:
Select referenced_owner, referenced_name,referenced_type from
dba_dependencies where name=’Object_name’ and type =‘Object_type’ and owner =’owner_name’;
Check for the existence of the dependent objects and their status by querying dba_objects .

No comments:

search engine

Custom Search