x

How do I find all invalid objects in my database?

Is there an easy query I can run to do this, or some way of finding this out in SQL Developer?

more ▼

asked Oct 30, 2009 at 05:40 AM in Default

avatar image

David Atkinson
357 17 21 26

(comments are locked)
10|1200 characters needed characters left

3 answers: sort voted first

SELECT owner,object_name,subobject_name,object_type FROM all_objects WHERE status='INVALID'
more ▼

answered Oct 30, 2009 at 07:33 AM

avatar image

Andrew Mobbs
1.6k 3 5

(comments are locked)
10|1200 characters needed characters left

SQL Developer already includes a custom report for this. Click the custom reports tab, drill down to Data Dictionary Reports -> All Objects -> Invalid Objects Report.

more ▼

answered Oct 30, 2009 at 12:10 PM

avatar image

dmann
437 2 3 8

(comments are locked)
10|1200 characters needed characters left

I know you mentioned SQL Developer - great tool - but if you are using Toad, the Schema Browser has a tab/category for 'Invalid Objects'. It pulls in everything listed in the above query plus a whole lot more...below is the query. Once the objects come back, you have a button to rebuild/recompile the list of objects as you see fit.

Select owner, object_name, object_type, LAST_DDL_TIME, object_id from sys.DBA_OBJECTS o where status <> 'VALID' and object_type <> 'SYNONYM' UNION ALL Select owner, object_name, object_type, LAST_DDL_TIME, object_id from sys.DBA_OBJECTS where object_type = 'INDEX' and (owner, object_name) in (SELECT owner, index_name FROM sys.DBA_INDEXES WHERE status = 'UNUSABLE' UNION ALL SELECT index_owner, index_name FROM sys.DBA_IND_PARTITIONS ip WHERE status = 'UNUSABLE' UNION ALL SELECT index_owner, index_name FROM sys.DBA_IND_SUBPARTITIONS isp WHERE status = 'UNUSABLE' )

more ▼

answered Nov 03, 2009 at 10:19 AM

avatar image

HillbillyToad
1k 2 4

(comments are locked)
10|1200 characters needed characters left
Your answer
toggle preview:

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

SQL Server Central

Need long-form SQL discussion? SQLserverCentral.com is the place.

Topics:

x424

asked: Oct 30, 2009 at 05:40 AM

Seen: 13307 times

Last Updated: Oct 30, 2009 at 05:40 AM

Copyright 2016 Redgate Software. Privacy Policy