获取 Oracle 数据库中所有函数和过程的列表

发布于 2024-08-12 09:55:42 字数 158 浏览 5 评论 0原文

我正在比较三种 Oracle 模式。

我想获取每个数据库中使用的所有函数和过程的列表。这可以通过查询实现吗? (最好包括一个关于它们是否编译的标志)

理想情况下,最好有一个带有标志的查询,该标志表明函数/过程是否在每个模式中。但即使只是第一步也会比手动检查每个模式更好。

I'm comparing three Oracle schemas.

I want to get a list of all the functions and procedures used in each database. Is this possible via a query? (preferably including a flag as to whether they compile or not)

Ideally it would be great to have a single query with a flag that states whether the function/procedure is in each schema. But even just the first bit would be better than manually inspecting each schema.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

喜你已久 2024-08-19 09:55:42
SELECT * FROM ALL_OBJECTS WHERE OBJECT_TYPE IN ('FUNCTION','PROCEDURE','PACKAGE')

状态列告诉您该对象是有效还是无效。如果无效,则必须尝试重新编译,ORACLE 无法告诉您之前是否有效。

SELECT * FROM ALL_OBJECTS WHERE OBJECT_TYPE IN ('FUNCTION','PROCEDURE','PACKAGE')

The column STATUS tells you whether the object is VALID or INVALID. If it is invalid, you have to try a recompile, ORACLE can't tell you if it will work before.

じее 2024-08-19 09:55:42

对 dba_arguments、dba_errors、dba_procedures、dba_objects、dba_source、dba_object_size 进行描述。
每个都有部分图片,用于查看程序和功能。

此外,包的 dba_objects 中的 object_type 是定义的“PACKAGE”和“PACKAGE BODY”的
身体。

如果您要比较同一数据库上的模式,请尝试:

select * from dba_objects 
   where schema_name = 'ASCHEMA' 
     and object_type in ( 'PROCEDURE', 'PACKAGE', 'FUNCTION', 'PACKAGE BODY' )
minus
select * from dba_objects 
where schema_name = 'BSCHEMA' 
  and object_type in ( 'PROCEDURE', 'PACKAGE', 'FUNCTION', 'PACKAGE BODY' )

并切换 ASCHEMA 和 BSCHEMA 的顺序。

如果您还需要查看触发器并比较模式之间的其他内容,您应该查看 关于向 Tom 询问比较架构的文章

Do a describe on dba_arguments, dba_errors, dba_procedures, dba_objects, dba_source, dba_object_size.
Each of these has part of the pictures for looking at the procedures and functions.

Also the object_type in dba_objects for packages is 'PACKAGE' for the definition and 'PACKAGE BODY" for
the body.

If you are comparing schemas on the same database then try:

select * from dba_objects 
   where schema_name = 'ASCHEMA' 
     and object_type in ( 'PROCEDURE', 'PACKAGE', 'FUNCTION', 'PACKAGE BODY' )
minus
select * from dba_objects 
where schema_name = 'BSCHEMA' 
  and object_type in ( 'PROCEDURE', 'PACKAGE', 'FUNCTION', 'PACKAGE BODY' )

and switch around the orders of ASCHEMA and BSCHEMA.

If you also need to look at triggers and comparing other stuff between the schemas you should take a look at the Article on Ask Tom about comparing schemas

倾城°AllureLove 2024-08-19 09:55:42
 SELECT * FROM all_procedures WHERE OBJECT_TYPE IN ('FUNCTION','PROCEDURE','PACKAGE') 
 and owner = 'Schema_name' order by object_name

这里'Schema_name'是模式的名称,例如我有一个名为PMIS的模式,所以示例将是

SELECT * FROM all_procedures WHERE OBJECT_TYPE IN ('FUNCTION','PROCEDURE','PACKAGE') 
and owner = 'PMIS' order by object_name

< img src="https://i.sstatic.net/IXLHE.png" alt="在此处输入图像描述">

参考:https://www.plsql.co/list-all-procedures-from-a-schema-of-oracle -database.html

 SELECT * FROM all_procedures WHERE OBJECT_TYPE IN ('FUNCTION','PROCEDURE','PACKAGE') 
 and owner = 'Schema_name' order by object_name

here 'Schema_name' is a name of schema, example i have a schema named PMIS, so the example will be

SELECT * FROM all_procedures WHERE OBJECT_TYPE IN ('FUNCTION','PROCEDURE','PACKAGE') 
and owner = 'PMIS' order by object_name

enter image description here

Ref: https://www.plsql.co/list-all-procedures-from-a-schema-of-oracle-database.html

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文