Sunday, July 13, 2008

ORA-02049 waiting for lock

User (i.e. Developer) Was getting the following error from few days

ORA-02049 Timeout: Distributed Transaction Waiting for Lock

While executing insert query on his Application DB SERVERS.The name of the Database instance is PPID

As per user ---> I am executing below query.


INSERT INTO PPID_HEADER SELECT A.* FROM PPID_HEADER@PPIDP.WORLD A WHERE A.DOCUMENT_ID IN (SELECT B.DOCUMENT_ID FROM DOCS_2B_MOVED B);

COMMIT;

ORA-02049 Timeout: Distributed Transaction Waiting for Lock

Is there anything you can do?


Solution:-

About Error Messages: ORA-02049: timeout: distributed transaction waiting for lock


  1. May be you can get error ora-02049 because you using bitmap index that was built on the table and you are trying to insert data, so dropping the bitmap index and creating a normal b-tree index even though the column has only distinct values will solve your problem.
  2. There can be dead lock while accessing table.
  3. Possibly there may be bug while inserting through database link.
  4. ORA-02049: timeout: distributed transaction waiting for lock
  • Cause: exceeded INIT.ORA distributed_lock_timeout seconds waiting for lock.
  • Action: treat as a deadlock Possibly there may be bug while inserting through database link.

The possible solution as per oracle is to increase the value of the parameter 'DISTRIBUTED_LOCK_TIMEOUT' (default is 60 sec).

But NOTE: -This is an internal Oracle parameter. Do NOT use it unless instructed to do so by Oracle Support. Playing with this parameter may be harmful.