简体   繁体   English

如何在Oracle 9i的特定模式中获取所有用户创建的存储过程和函数的列表?

[英]How to get a list of all user-created stored procedures and functions in a specific schema of Oracle 9i?

I have some user-created stored procedures and functions in this legacy database. 我在此旧数据库中有一些用户创建的存储过程和函数。 How do I list all procedures and functions of one specific schema, let's say, SCHEMA1, for instance. 如何列出一个特定模式的所有过程和功能,例如SCHEMA1。

Schema and user are somewhat synonymous in Oracle. 模式和用户在Oracle中有些同义。

If you want to list down all the procedures and functions in a specific schema, then query: 如果要列出特定模式中的所有过程和功能,请查询:

  1. user_objects : If you are logged in as the user you want to query the object list. user_objects :如果您以用户身份登录, 则要查询对象列表。
  2. all_objects : You need to filter with OWNER . all_objects :您需要使用OWNER进行过滤。

For example, 例如,

SELECT *
  FROM user_objects
 WHERE object_type 
   IN('FUNCTION', 'PROCEDURE');

Or, 要么,

SELECT * 
  FROM ALL_OBJECTS 
 WHERE OBJECT_TYPE 
   IN ('FUNCTION','PROCEDURE')
AND OWNER = 'your_schema_name';

Make sure you pass the required values in upper case. 确保以大写形式传递所需的值。

UPDATE UPDATE

From documentation here http://docs.oracle.com/cd/B19306_01/server.102/b14237/statviews_2025.htm , 从此处的文档http://docs.oracle.com/cd/B19306_01/server.102/b14237/statviews_2025.htm

ALL_PROCEDURES ALL_PROCEDURES

ALL_PROCEDURES lists all functions and procedures, along with associated properties. ALL_PROCEDURES列出了所有函数和过程以及相关的属性。 For example, ALL_PROCEDURES indicates whether or not a function is pipelined, parallel enabled or an aggregate function. 例如,ALL_PROCEDURES指示函数是流水线的,并行启用的还是聚合函数。 If a function is pipelined or an aggregate function, the associated implementation type (if any) is also identified. 如果函数是流水线函数或集合函数,则还将标识关联的实现类型(如果有)。

So, you could also use user_procedures view as per documentation. 因此,您还可以根据文档使用user_procedures视图。

NOTE 注意

Please note few things regarding *_procedures . 请注意关于*_procedures一些注意事项。 You need to take care whether the procedure is standalone or whether is wrapped within a package. 您需要注意该过程是独立过程还是包装在包装中。 I have written an article based on the same here Unable to find procedure in DBA_PROCEDURES view 我在这里基于相同的内容写了一篇文章在DBA_PROCEDURES视图中找不到过程

If you want to look up the list of all procedures then - 如果要查找所有过程的列表,则-

SELECT * FROM ALL_PROCEDURES WHERE OWNER = 'SCHEMA1';

This of course assumes that you have permissions to see the procedures/functions/packages of SCHEMA1. 当然,这假定您有权查看SCHEMA1的过程/功能/程序包。

If however you have the DBA privilege, then you can also do - 但是,如果您拥有DBA特权,那么您也可以-

SELECT * from DBA_PROCEDURES WHERE OWNER = 'SCHEMA1';

If you want the code inside the procedures then look up ALL_SOURCE or DBA_SOURCE. 如果要在过程中使用代码,则查找ALL_SOURCE或DBA_SOURCE。

The best way to receive this information: 接收此信息的最佳方法:

  1. Log in as SYSDBA SYSDBA身份登录
  2. Query dba_source 查询dba_source

SQL: SQL:

select distinct NAME from dba_source
where  TYPE in ('FUNCTION','PROCEDURE')
and    OWNER = 'SCHEMA_NAME';

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

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