If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Database Server Software > DB2 > table lock

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 01-31-10, 22:59
Mathew_paul Mathew_paul is offline
Registered User
 
Join Date: Oct 2007
Posts: 200
table lock

hi

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
regds
Paul
Reply With Quote
  #2 (permalink)  
Old 02-01-10, 05:45
stolze stolze is offline
Registered User
 
Join Date: Jan 2007
Location: Jena, Germany
Posts: 2,662
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
Reply With Quote
  #3 (permalink)  
Old 02-01-10, 07:07
Mathew_paul Mathew_paul is offline
Registered User
 
Join Date: Oct 2007
Posts: 200
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

example:
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
regds
Paul
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On