如何获取Oracle,查看正在运行的程序?

时间:2013-08-02 19:15:18

标签: oracle procedures

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

1 个答案:

答案 0 :(得分:22)

根据您的需要,这可能就足够了(但依赖于访问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

根据文档:

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

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