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 > Deadlock with online transaction

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 04-19-09, 16:46
tapas.inbox tapas.inbox is offline
Registered User
 
Join Date: Apr 2009
Posts: 3
Deadlock with online transaction

Hi,

I am having a question based on the conflict between a batch job and online transaction.

Detail:
I have an application from where online transactions came to access the DB2 database. During one point of time a batch job runs and creates a deadlock situation for the online transaction to be processed. This increases the response time for the online transactions. The batch job makes insert and update to one DB2 table which is also used by the online transaction. Is there any way to place a logic in the program (my point is have a kind of commit logic after every 100 row updates or something like that) to avoid this kind of scenario ?
Reply With Quote
  #2 (permalink)  
Old 04-20-09, 01:02
nick.ncs nick.ncs is offline
Registered User
 
Join Date: May 2007
Location: somewhere in dbforums
Posts: 221
check the LOCKTIMEOUT parameter in db cfg and make sure it is not anything less than 30 secs....


secondly you may need to reduce the commit count.....

Also you will have to check the plan for insert and update statements.... for large tables with large amount of data this will take time so you may need to fine tune your query.... you can also use db2 advisor for that matter and accordingly you'll have to change your LOCKTIMEOUT parameter and commit count... and / or maybe add new indexes....


Another alternative is to run the batch during non-peak hours.... any acceptable time before or after the maintenance window....
__________________
IBM Certified Database Associate, DB2 9 for LUW
Reply With Quote
  #3 (permalink)  
Old 04-20-09, 11:35
przytula_guy przytula_guy is offline
Registered User
 
Join Date: Apr 2006
Location: Belgium
Posts: 1,159
are you using insert or import ?
commitcount is for import only
try to use a commit as soon as possible or allowed
or if always on the same table - try lock table in share mode
no other updates can occur and others will be in lock wait$always try to be as specific as possible while describing the scenario and how this is accomplished
__________________
Best Regards, Guy Przytula
Database Software Consultant
DB2 UDB LUW Certified V7-V8-V9-V9.7 DB Admin - Dprop..
Information Server Datastage Certified
http://www.infocura.be
Reply With Quote
  #4 (permalink)  
Old 05-05-09, 21:54
tapas.inbox tapas.inbox is offline
Registered User
 
Join Date: Apr 2009
Posts: 3
hi sorry for the delay response...
the program associated with the batch job performs insert, delete and update operations. Currently the program has commit logic in place but not for after any count. I checked with our DBA about the LOCKTIMEOUT parameter and as per their info it has been set correctly.

The batch job time cannot be changed due to some critical processing.

Please let me know if you have any other suggestions.

thanks,
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