ORA-04021: timeout occured while waiting to lock object

Posted on 2001-07-05
Last Modified: 2007-11-27
I get the following error when trying to reload or drop a specific Java class <classname> from an Oracle 8.1.7 DB using the loadjava or dropjava utility...

ORA-04021: timeout occured while waiting to lock object <classname>

As far as I know, the class is not in use by anything else.  I still continue to get this message after about a day of waiting.  Why might this be happening and more importantly, how can I stop this error from occuring?

Question by:basilisk14
  • 4
  • 2

Expert Comment

ID: 6255812
I think a session is still having a lock on your object.
Try viewing v$lock if this is true.
Kill the session that is locking your object.

If the session doesn't disappear and is marked for being killed and the PMON hasn't enough resources to clear the session, you have to bring down the dbase. (or try using the ORAKILL utility, see metalink).

Author Comment

ID: 6255993
Could you please clarify about how I would go about doing these things?  I am not the DBA, but I could let him know the solution if it is more specific.  Thanks.

Author Comment

ID: 6256004
Could you please clarify about how I would go about doing these things?  I am not the DBA, but I could let him know the solution if it is more specific.  Thanks.
PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.


Accepted Solution

vanmeerendonk earned 50 total points
ID: 6258508
sorry, it was midnight when You asked me.
Well, with
select s.sid
,substr (s.osuser, 1, 10) username, substr (o.object_name, 1, 20) object
,      l.lmode, s.process, substr(s.program, 1, 25) program
from   v$lock l, all_objects o, v$session s
where  o.object_id = l.id1
and    s.sid       = l.sid
and l.type = 'TM'
you can look at the locks. With
you kill the session.

But with all of the above you have to have the appropriate grants! I think it's better for you to identify the lock and inform the DBA (he really should know what to do)

As a developer there's nothing more to do that identify and wait.


Author Comment

ID: 6260057
When I run the query I get "table or view does not exist".  Do you know why that might be?

Author Comment

ID: 6275300
Sorry for the delay...thanks.

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Why doesn't the Oracle optimizer use my index? Querying too much data Most Oracle developers know that an index is useful when you can use it to restrict your result set to a small number of the total rows in a table. So, the obvious side…
Cursors in Oracle: A cursor is used to process individual rows returned by database system for a query. In oracle every SQL statement executed by the oracle server has a private area. This area contains information about the SQL statement and the…
This video shows setup options and the basic steps and syntax for duplicating (cloning) a database from one instance to another. Examples are given for duplicating to the same machine and to different machines
This videos aims to give the viewer a basic demonstration of how a user can query current session information by using the SYS_CONTEXT function

863 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

22 Experts available now in Live!

Get 1:1 Help Now