Skip to content

Instantly share code, notes, and snippets.

@mujahidk
Created May 20, 2014 17:37
Show Gist options
  • Save mujahidk/be1008d2178ebb9f3030 to your computer and use it in GitHub Desktop.
Save mujahidk/be1008d2178ebb9f3030 to your computer and use it in GitHub Desktop.
Oracle: Script to find invalid objects, errors and way to compile
-- Query to find the invalid user objects in Oracle DB
SELECT OBJECT_NAME,
OBJECT_TYPE,
STATUS
FROM USER_OBJECTS
WHERE object_type IN ('PROCEDURE', 'TRIGGER', 'TABLE', 'VIEW', 'FUNCTION', 'INDEX')
AND STATUS ='INVALID';
--Query to find database view errors in the Oracle DB.
SELECT * FROM ALL_ERRORS WHERE TYPE = 'VIEW' ORDER BY SEQUENCE ASC;
-- Recompile a view
ALTER VIEW <VIEW_NAME> COMPILE;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment