oracle 如何检查触发器是否无效?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/120900/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
How to check if a trigger is invalid?
提问by gizmo
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?
所以,问题是:有没有办法查询 Oracle 元数据以检查某些触发器是否损坏,以便向支持团队发送报告?
The user_triggers give all the triggers and tells if they are enable or not, but does not indicate if they are still valid.
user_triggers 给出所有触发器并告诉它们是否启用,但不指示它们是否仍然有效。
回答by cagcowboy
SELECT *
FROM ALL_OBJECTS
WHERE OBJECT_NAME = trigger_name
AND OBJECT_TYPE = 'TRIGGER'
AND STATUS <> 'VALID'
回答by Mike McAllister
Have a look at SYS.OBJ$, specifically the STATUS column.
查看 SYS.OBJ$,特别是 STATUS 列。