Forum Stats

  • 3,750,457 Users
  • 2,250,181 Discussions
  • 7,866,986 Comments

Discussions

ORA-04021: timeout occurred while waiting to lock object

784227
784227 Member Posts: 344
edited Dec 8, 2011 10:42AM in General Database Discussions
Hi,

DB 10.2.0.4

while trying to compile a package getting below error on every time,Ther are no locking.

ORA-04021: timeout occurred while waiting to lock object

Thanks

Best Answer

  • Mark D Powell
    Mark D Powell Member Posts: 5,914 Blue Diamond
    Accepted Answer
    The package was in use. There are a couple of ways to find who is using a package at any given moment.

    You can join v$session to dba_ddl_locks or you can use v$acess but you can see who is executing the package. The code cannot be recompiled while the code is in use.

    HTH -- Mark D Powell --

Answers

  • Mark D Powell
    Mark D Powell Member Posts: 5,914 Blue Diamond
    Accepted Answer
    The package was in use. There are a couple of ways to find who is using a package at any given moment.

    You can join v$session to dba_ddl_locks or you can use v$acess but you can see who is executing the package. The code cannot be recompiled while the code is in use.

    HTH -- Mark D Powell --
  • Helios-GunesEROL
    Helios-GunesEROL Member Posts: 18,272
    Hi;

    For can root cause please see:
    How to analyze ORA-04021 or ORA-4020 errors? [ID 169139.1]

    Hope it helps

    Regard
    Helios
  • 784227
    784227 Member Posts: 344
    Hi,

    Thanks for reply.

    There are two session id which are access same package in dba_ddl_locks, do i need to kill that session id?

    Thanks
  • oradba
    oradba Member Posts: 10,214
    do i need to kill that session id?
    I would first try to find out, WHO is behind this id.
  • Mark D Powell
    Mark D Powell Member Posts: 5,914 Blue Diamond
    It would have been nice if you had posted your query and results so we could make suggestions on how to improve the query or what you should check next.

    Generally speaking if you submit a create or replace on a package and it takes longer than expected you can open a second session and query for usage. Depending on what you find determines your action.

    If may be you just need to re-submit immediately or wait till a batch job completes. There could be a daemon (continuously running batch) job that you have stopped and re-started right after you make the change. It depends on your environment.

    HTH -- Mark D Powell --
This discussion has been closed.