web analytics

Invalid objects in Oracle DB (health check)

Some standard queries to check the state of the Oracle DB

SELECT ‘alter ‘ || DECODE(LOWER(object_type), ‘package body’,’package’,LOWER(object_type)) || ‘ ‘ || owner || ‘.’ || object_name || DECODE(object_type,’PACKAGE BODY’, ‘ compile body;’,’ compile;’) INVALID_OBJECTS FROM DBA_OBJECTS WHERE STATUS = ‘INVALID’; SELECT ‘ALTER INDEX ‘|| owner || ‘.’ || index_name || ‘ rebuild online ;’ […]