473,404 Members | 2,195 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,404 software developers and data experts.

Placing a Lock at record level in a table.

Here when many users are trying to update the same table the dead lock
situation is arising. I like to know how i can put a lock at record
level in my table, so that the dead lock situation will not arise.
pls send me a CC to ks********@yahoo.com also

Nov 12 '05 #1
5 3827

<ch*******@gmail.com> wrote in message
news:11*********************@o13g2000cwo.googlegro ups.com...
Here when many users are trying to update the same table the dead lock
situation is arising. I like to know how i can put a lock at record
level in my table, so that the dead lock situation will not arise.
pls send me a CC to ks********@yahoo.com also


What version of DB2 are you using and what operating system are you on?
Also, are you worried only about applications conflicting or are dynamic
tools like SPUFI and QMF also a factor? It's hard to advise you without
knowing the answers to those questions.

Rhino
Nov 12 '05 #2
Try the SQL Reference V2. Lookup "ALTER TABLE" to get the exact syntax.

I'd be surprised if row level locking fixes your problem. Deadlocks are
frequently the result of other issues that arise when multiple programs
are attempting to update the same table. You'll need to do some lock
analysis to determine exactly what is happening.

Phil Sherman

ch*******@gmail.com wrote:
Here when many users are trying to update the same table the dead lock
situation is arising. I like to know how i can put a lock at record
level in my table, so that the dead lock situation will not arise.
pls send me a CC to ks********@yahoo.com also


Nov 12 '05 #3
Hi,
The simple newbie solution is

ALTER TABLE <table-name> LOCKSIZE ROW

Make sure u have enough lock buffer to avoid lock escalation, which
again leads to the same problem.

Correct me if i am wrong.

Cheers,
Thiru.
WantedToBeDBA.

Nov 12 '05 #4

"Thiru" <Wa***********@gmail.com> wrote in message
news:11*********************@l41g2000cwc.googlegro ups.com...
Hi,
The simple newbie solution is

ALTER TABLE <table-name> LOCKSIZE ROW

Make sure u have enough lock buffer to avoid lock escalation, which
again leads to the same problem.

Correct me if i am wrong.


While this is correct, "LOCKSIZE ROW" is the default locking mode in DB2, so
no extra steps are neccessary.

The problem that the OP is encountering are deadlocks, and there are only
two ways around this:
1) Use table locking (ALTER TABLE <table-name> LOCKSIZE TABLE), so that only
one query can use the table at a time. This is not recommended!
2) Rewrite the application to avoid deadlock situations.

--
Matt
Nov 12 '05 #5
"Matt Emmerton" <me******@nospam.yahoo.com> wrote in message
news:sY********************@rogers.com...


While this is correct, "LOCKSIZE ROW" is the default locking mode in DB2,
so
no extra steps are neccessary.

The problem that the OP is encountering are deadlocks, and there are only
two ways around this:
1) Use table locking (ALTER TABLE <table-name> LOCKSIZE TABLE), so that
only
one query can use the table at a time. This is not recommended!
2) Rewrite the application to avoid deadlock situations.
Matt

Locksize row is the default on DB2 for LUW, but not necessarily for other
platforms like z/OS, which only had page or tablespace locking for many
years, (except for the SQL lock table statement).

DB2 does not allow explicit locking of objects in SQL except for the lock
table statement. DB2 employs what is called pessimistic locking, whereby the
database locks for you based on the SQL statement issued, and releases locks
based on the isolation level and/or commit time.

As Matt noted, deadlocks can be cured by looking at the application SQL
code, and with a knowledge of how DB2 works with respect to locking, you can
almost always resolve the problem. It is a bit difficult for the totally
un-initiated to figure it out, but with a knowledgeable person it could be
figured out and you could get some skills transfer in the process.

The other option is to post in this forum all the exact DDL and all the
exact SQL of the offending applications involved in the deadlocks. The
deadlock event monitor will help identify some of the information you would
need to post.
Nov 12 '05 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: M Wells | last post by:
Hi All, I have a database that is serving a web site with reasonably high traffiic. We're getting errors at certain points where processes are being locked. In particular, one of our people...
9
by: Jane | last post by:
Our db2diag.log is full of messages like this: 2004-05-31-17.15.10.383766 Instance:tminst1 Node:000 PID:394948(db2agent (TMDB1) 0) TID:1 Appid:GA140956.EF26.03A4B1202647 data management ...
0
by: Bruce Pullen | last post by:
DB2 v7.2 (FP7 - DB2 v7.1.0.68) on AIX 5.2.0.0. We're seeing unexpected single row (then commit) insert locking behaviour. We're seeing Applications that already hold row-level W locks in...
2
by: Trent | last post by:
Hello, all. I have the following production DB2 environment. DB2 8.1.4 (fp4) WG edition with 2 production databases on Windows 2003 standard edition. My first question is regard with...
8
by: Bri | last post by:
Greetings, After making various edits and deletes on aproximately 40,000 records in one table (on the Design Master) syncronization fails with Error 3052 - File Sharing Lock Count Exceeded....
4
by: Ed L. | last post by:
I think I'm seeing table-level lock contention in the following function when I have many different concurrent callers, each with mutually distinct values for $1. Is there a way to reimplement...
2
by: adri4n | last post by:
as wat ive mentioned in the title.. im would like to know whether the a particular record/table is being locked in my program. some of the methods which i would like to develop are as below: ...
2
by: shenanwei | last post by:
DB2 V8.2 on AIX, type II index is created. I see this from deadlock event monitor. 5) Deadlocked Connection ... Participant no.: 2 Lock wait start time: 09/18/2006 23:04:09.911774 .........
9
by: kavallin | last post by:
I receives the following in the db2diag.log file many times / day : 2007-03-05-14.55.24.836553+060 E12415C457 LEVEL: Warning PID : 2785 TID : 1 PROC :...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.