Invalid objects in an Oracle database are schema objects that failed to compile or lost a dependency they need to function—a view whose base table was dropped, a procedure referencing a column that no longer exists, a synonym pointing at nothing. The standard way to find them is to query the data dictionary: USER_OBJECTS for your own schema, ALL_OBJECTS for everything you can access, and DBA_OBJECTS for the whole database. Filter on STATUS = 'INVALID', optionally narrow by object type and owner, and you have your list. What matters is which view you use, what the status actually means, and what you do with the rows afterward, because a raw invalid count can be misleading in both directions.

This walkthrough covers the queries, the privileges and filters that change the answer, how to interpret invalid dependencies versus invalid objects, how to recompile in the right order, and the specific traps—dependent recompilation, EDITIONABLE objects, hidden invalid counts after upgrades—that turn a simple lookup into an accurate one.

Before You Query: Prerequisites and Which Dictionary View to Use

You need a SQL client connected to the database and the right dictionary access. Every Oracle user can query USER_OBJECTS, which shows only objects owned by that user. ALL_OBJECTS shows objects the current user can access, including owned ones. DBA_OBJECTS shows every object in the database, but it requires the DBA role or SELECT ANY DICTIONARY (or SELECT_CATALOG_ROLE in many setups), so a developer account often cannot run it.

The same three-tier pattern applies to the dependency views you will need later: USER_DEPENDENCIES, ALL_DEPENDENCIES, and DBA_DEPENDENCIES.

One naming detail trips people up. ALL_OBJECTS and DBA_OBJECTS have an OWNER column; USER_OBJECTS does not, because the owner is implicitly you. Write queries accordingly, or you will get an "invalid identifier" error on a column that exists in one view but not the other—an irony worth avoiding when you are hunting invalid objects.

Object names in the dictionary are stored in uppercase unless they were created with quoted, case-sensitive identifiers. If your application creates "myProc" in mixed case, WHERE OBJECT_NAME = 'MYPROC' will return nothing. Query with the exact case or use UPPER/LOWER carefully and consistently.

The Core Query: Listing Invalid Objects

The simplest correct query against your own schema:

For everything you can see, add the owner:

For a database-wide list, assuming you have the privilege:

STATUS is either VALID or INVALID. LAST_DDL_TIME tells you when the object was last modified by DDL, which helps you correlate an invalidation with a deployment or a schema change. It does not record the moment of invalidation, so treat it as a clue, not proof.

Filter by type when you only care about PL/SQL or only about views:

Remember that a package appears as two rows, PACKAGE (the specification) and PACKAGE BODY. They can have different statuses. A body can be invalid while the spec stays valid, and that distinction matters when you recompile.

Reading the Results Correctly: Invalid Objects Versus Invalid Dependencies

STATUS = 'INVALID' on an object means the last compilation attempt failed or the object was marked invalid by a dependent change and has not been successfully recompiled since. It does not always mean the object is broken at runtime. Oracle's PL/SQL engine can recompile a stored procedure automatically on first execution if the underlying issue has since been resolved; if the problem persists, the call fails with the original error.

Two failure modes produce false confidence:

Zero rows does not mean everything works. An object can be VALID in the dictionary while a dependency it needs at runtime is missing in a way the compiler did not catch—dynamic SQL is the classic case. PL/SQL that builds a statement in a string is not checked until it executes.

Many rows do not mean many problems. A single dropped table can invalidate dozens of views, procedures, and synonyms that reference it. The count is a blast radius, not a defect count. Fix the root object and recompile, and most of the list collapses.

The dependency views tell you which objects depend on which, so you can find the root:

That returns everything that references the ORDERS table. If ORDERS was rebuilt or renamed, this is your repair list. Note that dependencies are recorded at compile time; an object that was never successfully compiled against the current schema may show stale or missing dependency rows.

Identifying Root Causes Before You Recompile

Recompiling blindly works often enough that people stop diagnosing, but the error text is free information. Per-object errors live in USER_ERRORS, ALL_ERRORS, and DBA_ERRORS, with columns LINE, POSITION, TEXT, and ATTRIBUTE (for example, ERROR or WARNING):

Line and position values are relative to the stored source, so if the procedure was created from a file, the offsets in the database may not match your editor. Modern clients show the stored source with line numbers; use USER_SOURCE if your tool does not.

Common causes, roughly ordered by how often they show up in practice:

A dropped or renamed table, column, or view the object references. Look for ORA-00942 (table or view does not exist) or ORA-00904 (invalid identifier). A privilege problem, where the object compiles only if the definer has the necessary rights. ORA-01031 (insufficient privileges) is the signal. A datatype mismatch after a column change, such as a NUMBER becoming a VARCHAR2 where the code assigns it to a numeric variable. A dependency on an invalid object, which cascades. Recompile the base object first. A genuine syntax or semantic error introduced by a recent edit. These are the ones a recompile will not fix. An object invalidated by an upgrade or a patch, where behavior changed subtly and the compiler now rejects previously accepted code.

Separate compiler errors from runtime errors. USER_ERRORS captures the compile-time messages. A procedure that compiles cleanly but fails on execution (a missing synonym resolved at runtime, a dynamic SQL statement with a bad table name) will not appear as invalid at all.

Recompiling in Dependency Order

The recompile utility is UTL_RECOMP, run by a privileged user, which recompiles invalid objects in dependency order across the database:

RECOMP_PARALLEL is the parallel variant; the degree of parallelism is controlled by the UTL_RECOMP settings and the number of CPUs. These routines exist to handle exactly the ordering problem, and they are preferable to looping over object names in a script, which will recompile dependents before their dependencies and produce a second round of failures.

For a single object or a small set, use ALTER ... COMPILE explicitly:

For a whole schema you own:

The compile_all parameter matters. With FALSE, only invalid objects are compiled, which is faster and avoids touching valid code. With TRUE, everything is recompiled, which is sometimes useful after an upgrade but can surface latent errors in code that was quietly working.

Compile in dependency order, which in practice means views and base tables first, then procedures and functions, then packages, then triggers. A package body that calls another package's function cannot compile until that function is valid. If you are doing this manually for a small set, sort your object list by dependency depth or just start with objects that have no unresolved dependencies in ALL_DEPENDENCIES.

After each round, immediately re-run the invalid query. Two or three passes are normal. If a fixed point is not reached after a few passes, stop recompiling and start reading errors—the loop is a sign of a real problem, not an ordering problem.

A Practical Worked Scenario

Suppose a deployment renames HR.ORDERS to HR.SALES_ORDERS and rebuilds it. The next day, an on-call engineer finds 140 invalid objects. The count looks alarming, but the sequence is mechanical.

First, run the schema-wide query and note the object types. Suppose 40 are views, 60 are procedures and functions, 30 are package specs and bodies, and 10 are synonyms. Then query the errors for one view:

The text reads ORA-00942: table or view does not exist on the line that selects from ORDERS. The rename is the root cause. Everything depending on the old name is invalid; synonyms pointing at the old name are also invalid.

The fix is to create a view or synonym named ORDERS that maps to SALES_ORDERS if the application cannot be changed immediately, or to update the dependent objects. Then compile the schema with compile_all => FALSE, run the invalid query again, and recompile once more to catch objects that were waiting on the first batch. In the same session, run the invalid query a third time. If it returns zero rows besides a known exception, you are done; if not, read the remaining errors.

That same pattern applies to any root cause: identify the dropped or changed object, restore or adapt it, recompile in order, verify.

Things That Make the List Inaccurate or Incomplete

Object status is per-edition. If the database uses Edition-Based Redefinition (EBR), the same object can be valid in one edition and invalid in another. USER_OBJECTS and the other views reflect the edition of the current session. An application connecting through a different edition may see a different list. Check SESSION_EDITION if the counts disagree between sessions. The EDITION_NAME column on the objects views lets you filter or group by edition.

Synonyms are not always meaningful rows. A synonym can be VALID while the object it points to is invalid, or invalid because the target was dropped. Include synonyms in your query if they are in scope, but do not be surprised when fixing the target makes them valid without any action.

Invalid status can outlive the fix. An object marked invalid is not automatically revalidated when its dependency is repaired; it needs a compile attempt. Conversely, it may be revalidated lazily on first use, so a listing taken right after a fix can show stale invalid rows that resolve on execution. Re-running the compile step gives a cleaner picture than watching the view change on its own.

Materialized views and their logs. A materialized view or its refresh group can go invalid, and the refresh may fail rather than the object. Check the errors and the refresh history in the same pass; the DBA_MVIEWS view has status information that the generic object views do not fully capture.

Invalid objects in other schemas. A frequent miss is that a dependent object in another schema becomes invalid because an object it references was changed. ALL_OBJECTS with the owner filter catches the ones you can see; DBA_OBJECTS is the only complete answer. If you lack DBA, ask a DBA to run the query or to grant SELECT_CATALOG_ROLE.

Public synonyms and grants. Public synonyms show up in DBA_SYNONYMS with a null owner in some views and are not part of the per-schema objects views in the way you might expect. Include them explicitly if they are in scope, and remember that a missing grant can invalidate code without any object being dropped.

Checking Success and Knowing When to Stop

A clean result is a query returning no INVALID rows for the objects in scope, plus a successful test execution of a representative sample—at minimum, each invalid package, procedure, and view that your application calls at startup. Dictionary status and runtime behavior are different facts; verify both.

Failures worth escalating rather than re-repeating:

The same object fails to compile on repeated attempts with the same error, especially ORA-00942 for a table you can see in the dictionary. That pattern points to a privilege or edition mismatch. Errors reference system objects or internal names you do not recognize. The invalid count stays high after two full UTL_RECOMP passes with no source changes. Recompiles succeed but application calls still throw errors, suggesting dynamic SQL or a runtime dependency the compiler never sees.

Those are the points to involve a DBA or Oracle Support. Recompiling more times will not help and can obscure the history.

Edge Cases and Version Notes

Oracle version behavior has shifted in ways that affect this list. From 11g onward, many ALTER ... COMPILE operations are done with reduced locking, but the fundamental dependency-ordering rule holds. Edition-based redefinition, introduced in 11gR2, is the major reason a single invalid count can mislead. From 12c, the multitenant architecture means DBA_OBJECTS connected to a pluggable database shows that PDB's objects, while the same query in the root container does not see them; you must connect to the correct container. ALL_OBJECTS in a PDB behaves as expected for the objects visible there.

The set of object types that can appear INVALID also varies. It includes PL/SQL units, views, synonyms, and types, but not tables, indexes, and most non-code objects, whose structural problems surface as other errors. If you are searching for a table that "disappeared," the invalid-object query is the wrong tool; look at DBA_TABLES or the recycle bin.

Finally, remember that the object list is a snapshot. Between the query and your fix, an automatic recompile or an application connection can change a status. Take the list, verify the errors, act in dependency order, and re-check rather than trusting the first result set.

Quick Answers to Common Follow-Ups

Can I find invalid objects without DBA privileges? Yes, for your own schema via USER_OBJECTS, and for objects you can access via ALL_OBJECTS. Database-wide requires the privileged view.

Why does USER_OBJECTS show no OWNER column? Because the view is implicitly filtered to the current user. Use ALL_OBJECTS or DBA_OBJECTS when you need the owner column.

Does a recompile fix everything marked invalid? It fixes what a recompile can fix—dependency invalidation and code that compiles cleanly. Genuine syntax errors, missing privileges, and runtime-only problems survive it.

Why is the same procedure invalid again after I fixed it? Something recompiled against a dependency that changed, or the dependency itself is still invalid. Recompile in order and read the errors again.

How do I trace which change caused the invalidation? Use LAST_DDL_TIME on the object and on its dependencies, correlate with deployment logs, and check whether the referenced object was dropped or altered. The dictionary does not record the cause, so this is correlation, not proof.

What about package specifications and bodies? They are separate rows and can differ in status. Recompile the specification first if it changed, then the body. UTL_RECOMP and DBMS_UTILITY.COMPILE_SCHEMA handle this ordering for you.

Is the count after UTL_RECOMP trustworthy? As a dictionary fact, yes; as a claim that the application works, no. Run it twice, then test the application paths that call the affected objects.

Can invalid objects affect performance even if nobody calls them? They can slow things down indirectly: some tools and monitoring jobs scan the dictionary, and lazy recompilation on first use adds a one-time delay. Troubleshooting an unexplained slowdown occasionally turns up a large invalid backlog, but that is a symptom of the underlying dependency problem rather than a cause in itself.