473,398 Members | 2,368 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,398 software developers and data experts.

Lock debugging by the ordinary user?

Hello,

Some users are frustrated by DB2 locking their database operations (most
recently: a table drop took forever, probably because of a lock).

The natural and sane question I'm being asked:
Is there a way for a user to see if a query is stuck waiting for a lock,
or if it's simply taking a while to execute?

As far as I can see, an ordinary user cannot get this kind of
information. Have I overlooked something?

--
Regards,
Troels Arvin <tr****@arvin.dk>
http://troels.arvin.dk/
Apr 24 '07 #1
7 2217
Troels Arvin wrote:
Hello,

Some users are frustrated by DB2 locking their database operations (most
recently: a table drop took forever, probably because of a lock).
I'd say it is most probably because DROPPED TABLE recovery is turned on for
the tablespace in which the table resides. Then DB2 has to store the
table's data, which may take a while to copy it.
The natural and sane question I'm being asked:
Is there a way for a user to see if a query is stuck waiting for a lock,
or if it's simply taking a while to execute?
I believe that LIST APPLICATIONS (or the respective snapshot) will show a
status like "lock waiting". So you could make the snapshot functions
available to other users.

--
Knut Stolze
DB2 z/OS Utilities Development
IBM Germany
Apr 24 '07 #2
On Tue, 24 Apr 2007 16:24:32 +0200, Knut Stolze wrote:
I'd say it is most probably because DROPPED TABLE recovery is turned on
for the tablespace in which the table resides.
True.
Then DB2 has to store
the table's data, which may take a while to copy it.
Ah. I didn't think of that side-effect of DROPPED TABLE. But there is no
alternative to activating DROPPED TABLE if I want to make it relatively
painless to restore dropped tables, right?
I believe that LIST APPLICATIONS (or the respective snapshot) will show
a status like "lock waiting".
But LIST APPLICATIONS yields an SQL1092N if I run the command as a normal
user.
So you could make the snapshot functions
available to other users.
I wonder if anyone in this newsgroup has experiences with this: Which
procedure(s) need to be made available for the users?

--
Regards,
Troels Arvin <tr****@arvin.dk>
http://troels.arvin.dk/
Apr 24 '07 #3
Troels Arvin wrote:
I wonder if anyone in this newsgroup has experiences with this: Which
procedure(s) need to be made available for the users?
Did you try db2pd -db <alias-locks
Jan M . Nelken
Apr 24 '07 #4
On Tue, 24 Apr 2007 16:24:32 +0200, Knut Stolze wrote:
>Some users are frustrated by DB2 locking their database operations
(most recently: a table drop took forever, probably because of a lock).

I'd say it is most probably because DROPPED TABLE recovery is turned on
for the tablespace in which the table resides. Then DB2 has to store
the table's data, which may take a while to copy it.
Why does DB2 have to copy the dropped table? - I would think that the
transaction logs (in combination with the latest backup) should have all
the data needed for re-construction of a dropped table?

--
Regards,
Troels Arvin <tr****@arvin.dk>
http://troels.arvin.dk/
Apr 24 '07 #5
Troels Arvin wrote:
On Tue, 24 Apr 2007 16:24:32 +0200, Knut Stolze wrote:
>Then DB2 has to store
the table's data, which may take a while to copy it.

Ah. I didn't think of that side-effect of DROPPED TABLE. But there is no
alternative to activating DROPPED TABLE if I want to make it relatively
painless to restore dropped tables, right?
Correct.
>I believe that LIST APPLICATIONS (or the respective snapshot) will show
a status like "lock waiting".

But LIST APPLICATIONS yields an SQL1092N if I run the command as a normal
user.
Right. That's exactly the issue here with "making this available" to
ordinary users. You can set the DB2_SNAPSHOT_NOAUTH registry variable to
turn off authorization checking.

In V9, you have a bunch of administrative views to gather snapshot
information. Those have their own, more fine-grained access control.
>So you could make the snapshot functions
available to other users.

I wonder if anyone in this newsgroup has experiences with this: Which
procedure(s) need to be made available for the users?
There are quite a few (all listed in the docs), for example this one:

http://publib.boulder.ibm.com/infoce...c/r0021987.htm

http://publib.boulder.ibm.com/infoce...n/c0002372.htm

--
Knut Stolze
DB2 z/OS Utilities Development
IBM Germany
Apr 24 '07 #6
Troels Arvin wrote:
On Tue, 24 Apr 2007 16:24:32 +0200, Knut Stolze wrote:
>>Some users are frustrated by DB2 locking their database operations
(most recently: a table drop took forever, probably because of a lock).

I'd say it is most probably because DROPPED TABLE recovery is turned on
for the tablespace in which the table resides. Then DB2 has to store
the table's data, which may take a while to copy it.

Why does DB2 have to copy the dropped table? - I would think that the
transaction logs (in combination with the latest backup) should have all
the data needed for re-construction of a dropped table?
I would think so, too. But I found in the past that DROPPED TABLE recovery
has the mentioned performance impact on a DROP TABLE statement. The manual
says this:
-------------------snip-----------------
When a DROP TABLE statement is run against a table whose table space is
enabled for dropped table recovery, an additional entry (identifying the
dropped table) is made in the log files. An entry is also made in the
recovery history file, containing information that can be used to recreate
the table.
-------------------snip-----------------
But writing a log records and something to the history file has no
measurable impact. So there must be something else going on under the
hood. What exactly, I do not know (yet).

--
Knut Stolze
DB2 z/OS Utilities Development
IBM Germany
Apr 24 '07 #7
Ian
Troels Arvin wrote:
On Tue, 24 Apr 2007 16:24:32 +0200, Knut Stolze wrote:
>>Some users are frustrated by DB2 locking their database operations
(most recently: a table drop took forever, probably because of a lock).
I'd say it is most probably because DROPPED TABLE recovery is turned on
for the tablespace in which the table resides. Then DB2 has to store
the table's data, which may take a while to copy it.

Why does DB2 have to copy the dropped table? - I would think that the
transaction logs (in combination with the latest backup) should have all
the data needed for re-construction of a dropped table?
It doesn't. Dropped table recovery works by writing a special
log record. During rollforward, DB2 will dump out a specified
table's data when it finds one of these log records before actually
dropping the table.

I would look for lock issues. Determining what is going on (and then
possibly educating the users on how to avoid these issues) will be
important.

One way you can give users a little more information (besides teaching
them how to parse snapshot output) is to set the default LOCKTIMEOUT
to a reasonable value. The default is to wait forever for a lock.
Decreasing it to, say, 30 seconds would result in users getting
SQL0911N rc68 errors instead of just waiting "forever" for a lock.
That way they know they are getting held by locks.

Apr 24 '07 #8

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

Similar topics

2
by: Anita | last post by:
Hi All, I have a question about lock hint for you : If the first user currently run a select command with share lock and hold it. What kind of lock (lock hint) should be used by the second...
2
by: Alex Traud | last post by:
hello ng, is there a possibility to debug a template class? i have a template class Polyom<T> (which implements a polynomial) defined in the file polynom.h. thanks in advance alex
16
by: Java script Dude | last post by:
To all Mozilla JS Guru's (IE dudes welcome), I have spent the last three years developing complex DHTML applications that must work in IE 5.5sp2+ but I use Mozilla 1.3+** to do all my...
61
by: km | last post by:
Hi all, is true parallelism possible in python ? or atleast in the coming versions ? is global interpreter lock a bane in this context ? regards, KM
4
by: Claire | last post by:
My application runs for a while then just stops completely. No stack overflows or any other errors, visual studio doesn't report any problems. I can close the application down ok from the studio...
10
by: Shawn | last post by:
JIT Debugging failed with the following error: Access is denied. JIT Debugging was initiated by the following account 'PLISKEN\ASPNET' I get this messag in a dialog window when I try to open an...
11
by: jacob navia | last post by:
I was browsing the web pages of les haltton, a software engineering professor ( http://www.leshaltton.org ) and I found this data in htp://www.leshatton.org/Documents/dross_2006.pdf < begin...
94
by: Samuel R. Neff | last post by:
When is it appropriate to use "volatile" keyword? The docs simply state: " The volatile modifier is usually used for a field that is accessed by multiple threads without using the lock...
7
by: Spam Catcher | last post by:
Hi All, If I have a procedure that obtains a sync lock: Public Sub A SyncLock Myobject B() End SyncLock And another procedure which obtains the same synclock:
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: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
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
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

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.