How to identify what locked PL/SQL package (Oracle 10.0.4.2)?

53,195

Solution 1

I think you mean 10.2.0.4, as there isn't a 10.0.x.x version series.

select * from v$locked_object lo join dba_objects o on lo.object_id = o.object_id
where o.object_name = 'xxPACKAGE NAMExx' and o.object_type = 'PACKAGE';

Solution 2

select l.session_id, l.owner, l.name, l.type, inst_id, sql_id
     , a.sql_fulltext
     , 'alter system disconnect session '''||s.sid||','||s.serial#||',@'||inst_id||''' immediate' ddl
  from dba_ddl_locks l 
  join gv$session s on s.sid = l.session_id
  join gv$sqlarea a using(inst_id, sql_id)
 where l.name = 'OBJECT_NAME'  
;
Share:
53,195
Roman Kagan
Author by

Roman Kagan

Roman started working as a programmer as a teenager when he was hired to hack Prolog at a Minsk artificial intelligence lab. Roman was one of the first developers using Java to create web applications. Since 1991, Roman has been consulting for companies including Hewlett-Packard, EDS, GM, Ford, Chrysler, Fanuc Robotics, Comerica and Polk.

Updated on July 09, 2022

Comments

  • Roman Kagan
    Roman Kagan almost 2 years

    I was trying to recompile PL/SQL package and no avail. because something obtained the lock and that wasn't released for long time. As soon as I kill all sessions I was able to recompile but encounter the same behavior (i.e. locked package) and I wonder what tools are avail to identify what could of obtain it and never release it? This happen on (Oracle 10.2.0.4). Greatly appreciate for your help.