简体   繁体   English

在 Oracle 19c 数据库中,当我们删除表时,使用该表的过程、触发器、索引会发生什么情况?

[英]In Oracle 19c database, when we drop a table what happens to the procedures, triggers, index that uses this table?

In Oracle 19c database, when we drop a table what happens to the procedures, triggers, index that uses this table?在 Oracle 19c 数据库中,当我们删除表时,使用该表的过程、触发器、索引会发生什么情况?

  • Will the triggers, procedures, index gets dropped automatically or will it become INVALID status?触发器、过程、索引会自动删除还是变为无效状态?

  • I want to know what is the correct process that needs to be followed while dropping the table when you know you already have the triggers, procedures, index associated with that particular table?当您知道您已经拥有与该特定表关联的触发器、过程、索引时,我想知道在删除表时需要遵循的正确过程是什么?

Please help me out.请帮帮我。

Indexes and triggers on the table will be dropped (as will grants)表上的索引和触发器将被删除(授权也将被删除)

Synonyms and views will become invalid同义词和视图将失效

Hard-coded references to the table in procedures, packages, functions and triggers will make them invalid.过程、包、函数和触发器中对表的硬编码引用将使它们无效。 References via dynamic SQL won't result in invalidation, but would fail when executed.通过动态 SQL 引用不会导致失效,但执行时会失败。

Query the DBA_DEPENDENCIES view to see which objects have dependencies and will get invalidated.查询 DBA_DEPENDENCIES 视图以查看哪些对象具有依赖关系并将失效。 There can be knock on impacts (dropping a table invalidates a procedure and a package that calls that procedure will be invalidated even if it doesn't reference the table directly).可能会产生连锁反应(删除表会使过程无效,并且调用该过程的 package 将无效,即使它没有直接引用该表)。

If all usages are within the same user/schema, you can query USER_DEPENDENCIES instead.如果所有用法都在同一个用户/模式中,则可以改为查询 USER_DEPENDENCIES。 Don't bother with ALL_DEPENDENCIES view as, if another user has created objects referencing the victim table, you might not have privileges to see that object anyway.不要打扰 ALL_DEPENDENCIES 视图,因为如果另一个用户创建了引用受害者表的对象,那么您可能无论如何都没有权限查看 object。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM