13

I am facing an unusual problem in Oracle SQL Developer. When I try to compile a store procedure it hangs up the Oracle SQL DEveloper Screen and I can't do any activity, except to kill the SQL developer instance and start again.

But the same issue. Anybody faced such problem? I am new to oracle.

Here some additions to the problem I waited for 5 to 10 mins and got this error

ORA-04021 timeout occurred while waiting to lock object

But I am the only person working on this instance of Oracle

2 Answers 2

14

One of your previous attempts to create the procedure, which you killed, is still stuck and active. You need to kill that Oracle session using http://www.oracle-base.com/articles/misc/KillingOracleSessions.php

The other source of this error is another process in your database is running the procedure while you are trying to compile it. Use this query to figure out which process is running it:

select sess.sid, sess.username, sql_text
from v$sqlarea sqlarea, v$session sess
where sess.sql_hash_value = sqlarea.hash_value
and   sess.sql_address    = sqlarea.address
and   sess.username is not null;
4
  • 1
    I tried doing it couple of times. But when i compile it again, same error.
    – user367134
    Jul 23, 2011 at 13:13
  • 1
    How to execute the above query in SQL Developer?
    – user367134
    Jul 23, 2011 at 15:29
  • 2
    session is a reserverd word. Change it to another "name" (e.g. "v$session sess"). May 13, 2016 at 13:31
  • Mahttias is correct, "session" is reserved keyword and cannot be used as alias. The answer is updated. Jul 26, 2016 at 1:42
1

Query v$locked_object to see if any objects that are currently locked are in use by your Stored Procedure. If so, track down the query/module which has it locked & end the query.

The link given by Thomas gives the details of how to kill a session, once the sessions are killed & v$locked_object shows no records, you should be able to compile fine.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.