473,769 Members | 5,823 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Unlocking DB2 table/row locks

We are looking for a command/SQL statement that cancels all table/row
locks in DB2.
The reason for this is:
1) computer A was a sole client of DB2, and crashed
2) computer B automatically (in our scenario) becomes the new and only
DB2 client, and executes the same application as A.
3) at this time, DB2 still holds locks from transactions started on A,
untill certain timeout expires, AFAIK. We would like to cancel this
timeout time.

How this timeout can be configured?
How can we cancel existing DB2 locks in (or before) stage 2, i.e.
without relying on timeout.

Your help is greatly appreciated.

Boris

Nov 12 '05 #1
10 15586
<bo**********@g mail.com> wrote in message
news:11******** **************@ g47g2000cwa.goo glegroups.com.. .
We are looking for a command/SQL statement that cancels all table/row
locks in DB2.
The reason for this is:
1) computer A was a sole client of DB2, and crashed
2) computer B automatically (in our scenario) becomes the new and only
DB2 client, and executes the same application as A.
3) at this time, DB2 still holds locks from transactions started on A,
untill certain timeout expires, AFAIK. We would like to cancel this
timeout time.

How this timeout can be configured?
How can we cancel existing DB2 locks in (or before) stage 2, i.e.
without relying on timeout.

Your help is greatly appreciated.

Boris

Have the application holding the locks issue an SQL commit statement.
Nov 12 '05 #2
Won't the following
list applications show detail, check which handle it is.
force application <handle_of_app_ A>

force out the locks?

or db2 get snapshots for locks on db >snp.txt, run the output-snp.txt
through snapview(free software), see the dependency for locks in the
tool. Force the handle holding locks on table.

I am sorry if I am totally off the topic here.

Nov 12 '05 #3
The application instance that held the locks ran on computer A, which
is down now - we cannot commit from it.
Another instance of the same application is now running on B, but I am
not sure it can commit the logs, as it did not start the transactions.
Am I wrong?

Nov 12 '05 #4
<bo**********@g mail.com> wrote in message
news:11******** **************@ g49g2000cwa.goo glegroups.com.. .
The application instance that held the locks ran on computer A, which
is down now - we cannot commit from it.
Another instance of the same application is now running on B, but I am
not sure it can commit the logs, as it did not start the transactions.
Am I wrong?

You are correct. I did not realize that application A crashed (didn't read
carefully).

But if the application crashed, it should have issued a rollback, which
would release locks. If it is hung, I don't know how to set a timeout
parameter for the connection that will release the locks (maybe someone else
does).

As mentioned by others, you can force the application manually, but I don't
know if that is what you are looking for an on-going solution. Best solution
may be to find out why the application is hanging and fix the problem.
Nov 12 '05 #5
We are dealing with high availability, thus computer A could have been
struct by lightning, fwiw. Meaning, we do not rely on the application
at all.

Mark A, hik..., I would like to thank you both for the fruitful
conversation, hope it will work :)
I shall try what hik... wrote and shall report the results after the
weekend.

Nov 12 '05 #6
It worked!
The only question now left in mind - the force application command in
asynchronous.
According to your experience (as you already understand, I am not a
programmer/designer, not a db admin):

How many seconds/milliseconds elapse between the return of 'force
application' command, and the actual applications shutdown? Any
estimate will do.

If the command fails, what can we do other than db2stop?

Nov 12 '05 #7
Moreover, is it possible to set some timeout values for the locks? Do
they never expire?

Nov 12 '05 #8
LOCKTIMEOUT :) (update db cfg for ...)

Nov 12 '05 #9
<bo**********@g mail.com> wrote in message
news:11******** *************@g 44g2000cwa.goog legroups.com...
LOCKTIMEOUT :) (update db cfg for ...)

That determines how long an application waiting for lock to be released
(held by another application) before it timeouts with a -911. If the value
is -1 it will wait forever.
Nov 12 '05 #10

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

Similar topics

1
3845
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 has suggested that an update statement contained within a stored procedure that uses a where condition that only touches on a column that has a clustered primary index on it will still cause a table lock.
1
1777
by: CoolFire | last post by:
Hello I have searched high and low for the answer to my question. I expect that it is right under my nose but it has come time for me to ask anyway. Is there a way to force access to a file on a computer that has been locked by a VB.NET program that is running on another computer I have a multiuser environment where common data files are stored on a shared server and each program is run separately from each machine. The actual situation...
3
2169
by: LineVoltageHalogen | last post by:
Greetings All, I was wondering what would happen if I were to do a "select * from table" on a table that has about 5 million rows. Would my read block other writers to the same table? Would it block other readers? I know SQL uses optimistic lockign by default but I am not sure what this means to other users trying to access the same table? Any advise would be greatly appreciated. TFD
17
12831
by: Dr NoName | last post by:
Help! I have a table that multiple processes must be able to write to concurrently. However, it for some reason gets locked in exclusive mode. I narrowed it down to one SQL statement + some weirdness with foreign keys. To debug this, I opened two psql sessions and typed in the sql statements manually. Here is the situation: CREATE TABLE take2
11
14075
by: EoRaptor | last post by:
I`m exporting data from many Lotus Notes databases to a DB2 database using LotusScript. The LotusScript agents commit after EACH update/insert. Nevertheless, I keep getting transaction rollbacks on deadlock or timeout. When I get a snapshot for locks, I see that one of the export agents is getting a table lock rather than a row lock. I`m guessing this is what causes the time out. Questions: how do I determine whether it`s a deadlock or a...
2
3752
by: Mark | last post by:
Hello, Say I write a picture file to: 'c:\test.jpg' Then I assign this picture to a picturebox PbFoto.Image = Image.Fromfile("c:\test.jpg") Next I want the overrwrite the file test.jpg with another picture. When running, he says the file is in use when I want to overwrite it.
2
15802
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: Lock(KEY, SQLCODE) - to create a lock. Returns 0 on success, 1 if a lock already exists and -1 on failure with SQLCODE. There is no necessity to use IsLock() for checking if a lock exists or not, just insert the record and check for
22
18812
by: RayPower | last post by:
I'm having problem with using DAO recordset to append record into a table and subsequent code to update other tables in a transaction. The MDB is Access 2000 with the latest service pack of JET 4. The system is client/server, multiusers based. The MDBs are using record locking. Here is part of the code: Dim wkSpace As Workspace, db As Database Dim rstTrans As DAO.Recordset Set wkSpace = DBEngine.Workspaces(0)
3
5590
by: NaeiKinDus | last post by:
Hello, i'm trying to program a thread that would be locked (by a mutex) and that would only be unlocked once that a function (generating data) is done. The purpose is to generate data, and unlock the mutex in order to activate the thread once the data is generated. I have to do it this way, i can only call the thread if the data are generated. ******************************************************** step 1: initialize the mutex
0
9586
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9423
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
1
9990
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9861
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8869
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
6672
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5298
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5446
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
3561
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.