oracle 我如何获得Oracle,查看正在运行的程序?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/18024552/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-10 05:11:47  来源:igfitidea点击:

How do I get Oracle, see what procedures are running?

oracleprocedures

提问by Daniel Sousa

Good afternoon. How do I get Oracle, see what procedures are running?

下午好。我如何获得Oracle,查看正在运行的程序?

回答by Patrick Marchand

Depending on your needs, this might suffice (but relies on access to v$session and dba_objects):

根据您的需要,这可能就足够了(但依赖于对 v$session 和 dba_objects 的访问):

select 'CALLED PLSQL', vs.username, d_o.object_name -- whatever info you need
  from dba_objects d_o
       inner join
       v$session vs
          on d_o.object_id = vs.plsql_entry_object_id
union all
select 'CURRENT PLSQL', vs.username, d_o.object_name
  from dba_objects d_o
       inner join
       v$session vs
          on d_o.object_id = vs.plsql_object_id

As per the docs:

根据文档:

PLSQL_ENTRY_OBJECT_ID - ID of the top-most PL/SQL subprogram on the stack; NULL if there is no PL/SQL subprogram on the stack

PLSQL_ENTRY_OBJECT_ID - 堆栈中最顶层 PL/SQL 子程序的 ID;如果堆栈上没有 PL/SQL 子程序,则为 NULL

PLSQL_OBJECT_ID - Object ID of the currently executing PL/SQL subprogram; NULL if executing SQL

PLSQL_OBJECT_ID - 当前正在执行的 PL/SQL 子程序的对象 ID;如果执行 SQL 则为 NULL