Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

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

like image 288
Daniel Sousa Avatar asked Aug 02 '13 19:08

Daniel Sousa


1 Answers

Depending on your needs, this might suffice (but relies on access to v$session and 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_OBJECT_ID - Object ID of the currently executing PL/SQL subprogram; NULL if executing SQL

like image 98
Patrick Marchand Avatar answered Nov 12 '22 14:11

Patrick Marchand