How to check if a trigger is invalid?
Question
I'm working on databases that have moving tables auto-generated by some obscure tools. By the way, we have to track information changes in the table via some triggers. And, of course, it occurs that some changes in the table structure broke some triggers, by removing a column or changing its type, for example.
So, the question is: Is there a way to query the Oracle metadata to check is some triggers are broken, in order to send a report to the support team?
The user_triggers give all the triggers and tells if they are enable or not, but does not indicate if they are still valid.
Solution
SELECT *
FROM ALL_OBJECTS
WHERE OBJECT_NAME = trigger_name
AND OBJECT_TYPE = 'TRIGGER'
AND STATUS <> 'VALID'
OTHER TIPS
Have a look at SYS.OBJ$, specifically the STATUS column.
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow