4

嗨,有人知道如何检查给定的数据库对象(表/视图/SP/函数)是否在 Oracle 中使用。

例如,检查表“A”是否用于任何 SP/Function 或 View 定义。我正在尝试清理数据库中未使用的对象。

我尝试了查询 select * from all_source WHERE TEXT like '%A%' (A 是表名)。如果它没有返回任何结果,你认为它没有被使用是安全的吗?

4

1 回答 1

3

From this ASKTOM question:

You'll have to enable auditing and then come back in 3 months to see.

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

There's code in the thread for checking ALL_SOURCE, but it's highlighted that this isn't a silver bullet.

于 2010-01-28T23:26:23.773 回答