简体   繁体   English

检查Oracle中是否使用了给定的DB对象?

[英]Check if a given DB object used in Oracle?

Hi does any one know how to check if a given DB object (Table/View/SP/Function) is used inside Oracle. 嗨,任何人都知道如何检查Oracle内部是否使用给定的DB对象(表/视图/ SP /函数)。

For example to check if the table "A" is used in any SP/Function or View definitions. 例如,检查表“A”是否用于任何SP /函数或视图定义。 I am trying to cleanup unused objects in the database. 我正在尝试清理数据库中未使用的对象。

I tried the query select * from all_source WHERE TEXT like '%A%' (A is the table name). 我尝试查询select * from all_source WHERE TEXT,如'%A%'(A是表名)。 Do you thing it is safe to assume it is not being used if it does not return any results? 如果它没有返回任何结果,那么假设它没有被使用是否安全?

From this ASKTOM question : 从这个ASKTOM问题

You'll have to enable auditing and then come back in 3 months to see. 您必须启用审核,然后在3个月内回来查看。

We don't track this information by default -- also, even with auditing, it may be very possible to have an object that is INDIRECTLY accessed (eg: via a foreign key for example) that won't show up. 默认情况下,我们不会跟踪此信息 - 即使使用审核,也很可能会有一个间接访问的对象(例如:通过外键),这些对象不会显示。

You can try USER_DEPENDENCIES but that won't tell you about objects referenced by code in client apps or via dynamic sql 您可以尝试USER_DEPENDENCIES,但这不会告诉您客户端应用程序中的代码或动态SQL引用的对象

There's code in the thread for checking ALL_SOURCE , but it's highlighted that this isn't a silver bullet. 线程中有代码用于检查ALL_SOURCE ,但突出显示这不是一个银弹。

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

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