如何判断是否正在使用 PL/SQL 包、过程或函数?
如何判断是否正在使用 PL/SQL 包、过程或函数?是否有 Oracle 表或视图包含有关 PL/SQL 包、过程或函数使用情况的统计信息?
How can you tell if a PL/SQL Package, Procedure, or Function is being used? Is there an Oracle table or view that contains statistics on PL/SQL Package, Procedure, or Function usage?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(6)
您还可以尝试查询 USER/ALL_source:
或
您必须忽略自引用,但这应该很容易发现。
您还需要检查 user/all_views 中的“查看”源。不过,请参阅有关查询查看源的其他问题。
您还可以检查包或顶级函数/过程是否与
NB 一起使用:根据需要将 user_ 与 all_/dba_ 一起使用,
如果您专门寻找未调用的函数,那么另一种选择是在打开警告的情况下编译代码,然后查找PLW-06002 和 LPW-06006
You can also try querying USER/ALL_source:
or
You'll have to ignore self references, but that should be easy to spot.
You'll also need to check "view" source from user/all_views. See the other question about querying view source though.
you can also check if a package or top level function/procedure is used with
NB: switch user_ with all_/dba_ as needed
if you are specifically looking for uncalled functions then another option is to compiler your code with WARNINGS turned on and then look for PLW-06002 and LPW-06006
默认情况下不是。但您可以使用 Oracle 数据库的审核功能。 询问 Tom 是一个关于过程调用审核的长线程!
Not by default. But you can use the audit functionality of your Oracle database. At Ask Tom is a long thread about the auditing of procedure calls!
如果您使用的是 Oracle 11(R2?),我会给
PL/Scope
一个机会。该文档指出:PL/Scope 是一个编译器驱动的工具,它在程序单元编译时收集有关 PL/SQL 源代码中标识符的数据,并使其在静态数据字典视图中可用。收集的数据包括有关标识符类型、用法(声明、定义、引用、调用、赋值)以及每个用法在源代码中的位置的信息。
PL/Scope 支持开发强大且有效的 PL /Scope 增加 PL/SQL 的源代码浏览器
通过最大限度地减少浏览和理解源代码的时间来提高开发人员的生产力。
您可以在 http://download.oracle.com/docs/cd/E11882_01/appdev.112/e17125/adfns_plscope.htm#g1010526
If you're on Oracle 11 (R2?), I'd give
PL/Scope
a chance.The docu states: PL/Scope is a compiler-driven tool that collects data about identifiers in PL/SQL source code at program-unit compilation time and makes it available in static data dictionary views. The collected data includes information about identifier types, usages (declaration, definition, reference, call, assignment) and the location of each usage in the source code.
PL/Scope enables the development of powerful and effective PL/Scope source code browsers that increase PL/SQL
developer productivity by minimizing time spent browsing and understanding source code.
You can find more about it at http://download.oracle.com/docs/cd/E11882_01/appdev.112/e17125/adfns_plscope.htm#g1010526
您可以通过查询 DBA_DEPENDENCIES 表来查看对象是否具有任何依赖关系。
此查询将返回存储在 Oracle 实例本身内的代码中的任何依赖项。
它不会透露是否有任何对象在实例外部被调用。
You can see if an object has any dependencies by querying the DBA_DEPENDENCIES table.
This query will return any dependencies in code stored inside the Oracle instance itself.
It will not reveal whether or not any object is called outside of the instance.
您可以使用像 Toad 这样的编辑器。他们将直接列出您的过程所依赖的对象和引用您的过程的对象。
You can use Editors like Toad. They will directly list both the objects on which your procedure is dependent and objects which reference your procedure.
您可能还会发现 pl/sql 工具包 ILO 对您有用正在尝试做。
You might also find the pl/sql instrumentation package ILO useful for what you're trying to do.