Results 1 to 3 of 3

Thread: table lock

  1. #1
    Join Date
    Oct 2007

    Unanswered: table lock


    When there is req to lock a table in X Exculsive mode, on what bases the agent is allowed to lock and some time its rejected saying timeout

    for ex:
    i imported a table which lock the tables X mode sometime its gets timeout
    is there any preference like table or row etc which should be locked first

  2. #2
    Join Date
    Jan 2007
    Jena, Germany
    If you try to lock a table in exclusive mode, there must be no lock on any row at all. If there are such locks, DB2 waits for the time specified in the lock timeout, hoping that the locks are released. If that doesn't happen, you get the error message you saw.

    So what you have to figure out is which other connections are holding locks on the table and then resolve the issue. You can either make sure that those other connections release the locks earlier, e.g. commit/rollback more often, or you may have to increase the lock timeout, or you have to work with row-based locks instead of the table lock.
    Knut Stolze
    IBM DB2 Analytics Accelerator
    IBM Germany Research & Development

  3. #3
    Join Date
    Oct 2007
    thanx stolze
    i got the answer in first 2 lines , another question related to indexes lock i have already asked but i didn,t get a reply on that
    its abt type 1 indexes as it has been discontinued have few doubts on

    Consider the following example of an index that contains 6 rows with the following values: 1 5 6 7 8 12.

    Transaction 1 deletes the row with key value 8. The row with value 8 is locked in X mode. When the corresponding key from the index is deleted, the row with value 12 is locked in X mode.

    Why it need to lock the next row of the index, is it coz it wants to maintain the order of index not able to understand
    kindly suggest

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts