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 > Long_Waiting_Application ?

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 11-16-09, 07:41
DBFinder DBFinder is offline
Registered User
 
Join Date: Sep 2008
Location: Toronto,Canada
Posts: 606
Long_Waiting_Application ?

Hi Guys,


For few weeks I am having an application which is in UOWWAIT state and holding locks for about 5 to 12 hours.

By luck no other application was held back ( also because the table lock is Intent share ). This application is currently holding total 8 locks including 1 table lock. This is reoprted as in UOWWait State. I cannot catch it via LONG_RUNNING_SQL because ELAPSED_TIME_MIN is reported to be 0.

I need help to learn how to resolve/investigate this situation.
This keeps me from REORG indexes of this table. Otherwise none of regular applications is affected.

Attached is the application snapshot and DB2Monitor screenshot.

DB2V9.5 fp 4 on Win2K3

Thanks in advance.

DBFinder
Attached Images
File Type: bmp APPL.bmp (418.0 KB, 13 views)
Attached Files
File Type: txt appl1727.txt (10.4 KB, 43 views)

Last edited by DBFinder; 11-16-09 at 07:45.
Reply With Quote
  #2 (permalink)  
Old 11-16-09, 08:29
n_i n_i is offline
:-)
 
Join Date: Jun 2003
Location: Toronto, Canada
Posts: 4,449
From the information you've provided, it looks like the application did not commit its last UOW and is waiting for user input or some other event. Knowing the query it ran and the IP address of the client you can analyse the application and make sure it issues commits when appropriate.
Reply With Quote
  #3 (permalink)  
Old 11-16-09, 08:45
DBFinder DBFinder is offline
Registered User
 
Join Date: Sep 2008
Location: Toronto,Canada
Posts: 606
Thank you very much !

Nick, I wanted to cofirm with you guys. Commit was not issued. This needs to be conveyed to another department in my workplace, before they provide me the code.

I am attaching second snapshot if someone may want to compare with (for any time relative parameters).

Thanks again.

DBFinder
Attached Files
File Type: txt appl1727-2.txt (10.4 KB, 73 views)
Reply With Quote
  #4 (permalink)  
Old 11-16-09, 14:31
DBFinder DBFinder is offline
Registered User
 
Join Date: Sep 2008
Location: Toronto,Canada
Posts: 606
Quote:
Originally Posted by n_i View Post
From the information you've provided, it looks like the application did not commit its last UOW and is waiting for user input or some other event. Knowing the query it ran and the IP address of the client you can analyse the application and make sure it issues commits when appropriate.
Nick,

Next question is that from SQL I see that it is not updating anything. Do we still need a commit ??

Regards
DBFinder
Reply With Quote
  #5 (permalink)  
Old 11-16-09, 14:35
Marcus_A Marcus_A is offline
Registered User
 
Join Date: May 2003
Location: USA
Posts: 5,196
If you want the locks to be released, you need to have it commit or rollback. if you force the application then it will rollback.
__________________
M. A. Feldman
IBM Certified DBA on DB2 for Linux, UNIX, and Windows
IBM Certified DBA on DB2 for z/OS and OS/390
Reply With Quote
  #6 (permalink)  
Old 11-16-09, 14:39
DBFinder DBFinder is offline
Registered User
 
Join Date: Sep 2008
Location: Toronto,Canada
Posts: 606
Well,

Is this true in SELECT only transactions also ??

Sorry for my limited experience !

Regards
Reply With Quote
  #7 (permalink)  
Old 11-16-09, 22:22
db2girl db2girl is offline
∞∞∞∞∞∞
 
Join Date: Aug 2008
Location: Toronto, Canada
Posts: 1,816
Select transactions acquire locks as well - snapshot shows 9 locks held by this appl. Some locks will be on the target tables, some on the system catalog table(s) and some can be internal locks. The application has to commit/rollback in order to release them.
Reply With Quote
  #8 (permalink)  
Old 11-17-09, 11:57
DBFinder DBFinder is offline
Registered User
 
Join Date: Sep 2008
Location: Toronto,Canada
Posts: 606
Thank you Bella,

I got it. I will proceed with the knowledge provided. This changed my thinking that Select also needs COMMIT.


Thanks Everyone.

DBFinder
Reply With Quote
  #9 (permalink)  
Old 11-18-09, 04:06
Mathew_paul Mathew_paul is offline
Registered User
 
Join Date: Oct 2007
Posts: 200
Kindly correct me on this

IF ur isolation level CR, whenever there is select it does a share lock on each row
when its huge amt of data is selected it gets escalates to table lock.
regds
Paul
Reply With Quote
  #10 (permalink)  
Old 11-19-09, 02:50
Mathew_paul Mathew_paul is offline
Registered User
 
Join Date: Oct 2007
Posts: 200
Quote:
Originally Posted by db2girl View Post
Select transactions acquire locks as well - snapshot shows 9 locks held by this appl. Some locks will be on the target tables, some on the system catalog table(s) and some can be internal locks. The application has to commit/rollback in order to release them.
Kindly correct me on this

IF ur isolation level CR, whenever there is select it does a share lock on each row
when its huge amt of data is selected it gets escalates to table lock.
regds
Paul
Reply With Quote
  #11 (permalink)  
Old 11-19-09, 18:39
db2girl db2girl is offline
∞∞∞∞∞∞
 
Join Date: Aug 2008
Location: Toronto, Canada
Posts: 1,816
The higher the isolation level, the more locks DB2 will acquire. With RR (I think you meant RR when you wrote CR), locks are acquired on the scan and kept until the end of the scan and therefore lock escalations are more likely. The optimizer can decide to just lock the table in case of RR (it will consider locklist/maxlock, estimate number of locks...).
Reply With Quote
  #12 (permalink)  
Old 11-19-09, 22:54
Mathew_paul Mathew_paul is offline
Registered User
 
Join Date: Oct 2007
Posts: 200
i m so sorry its not CR its CS , share lock happens in row when there is select on the row
when this increase and used memory of locklist table lock happens in select, as select also lock, kindly correct me on this
regds
Paul
Reply With Quote
  #13 (permalink)  
Old 11-20-09, 16:13
db2girl db2girl is offline
∞∞∞∞∞∞
 
Join Date: Aug 2008
Location: Toronto, Canada
Posts: 1,816
With CS, the lock is released when the scan moves off a row so lock escalations are less likely than with RR/RS. If lock escalations occur, locklist/maxlocks is low.
Reply With Quote
  #14 (permalink)  
Old 11-23-09, 00:51
Mathew_paul Mathew_paul is offline
Registered User
 
Join Date: Oct 2007
Posts: 200
want to know abt select lock which lock the entire table, as share lock happens in row in select when huge rows are select the share lock is converted to lock escalation.
kindly correct me on this
regds
Paul
Reply With Quote
  #15 (permalink)  
Old 11-23-09, 01:15
LeightonMeestera LeightonMeestera is offline
Registered User
 
Join Date: Nov 2009
Posts: 1
Where to watch Gossip Girl Online.

Do you like watching Leighton Meester and Gossip Girl every week?

Do you want to get caught up watching this TV series? Gossip Girl is a very popular TV show.

Find out what Serena van der Woodsen is up to this week!

Gossip Girl Episodes[url=http://www.Gossip-Girl-Now.info]
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