How to find the session locking a library cache object? If you compile an object such as a package and it hangs, there're a couple of methods to find the session locking the library cache object of the object being compiled. * v$sql.users_executing (maybe the simplest way): select * from v$sql where lower(sql_text) like '%yourpackage%' and users_executing > 0; * v$db_object_cache.pins: I have a feeling that v$db_object_cache.locks != 0 doesn't mean you can do DDL on that object. My test is this: In one session create or replace procedure p as begin dbms_lock.sleep(10); end; / exec p In the other session, I look at v$db_object_cache. Locks = 1 and pins = 1. alter procedure p compile in this session hangs until the moment the first session finishes executing (10 seconds). So looking at the pins column may be better. * dba_kgllock helps. When P is being executed, there's one more row where the column kgllktype = 'Pin' and its kgllkmod = 2. (The other row is of type 'Lock' in null mode and will start to show up and remain there till the session exits) * x$kgllk also helps. When P is executing, kgllkflg changes from 2 to 6. v$access doesn't help. It always shows one row saying the first session is accessing before *and after* the first session finishes executing P. Yong Huang