select for update - how to kill old locks [message #518356] |
Wed, 03 August 2011 06:40  |
dyahav
Messages: 32 Registered: March 2009
|
Member |
|
|
Hi,
My code executes a Select For Update before updating a table.
In some cases the network is disconnected and it causes the lock to hang. Then, I must kill the session in order to realese this lock.
I want to do it automatically. I would like to create a job that kills session that has a lock due to Select For Update that is not alive.
Does anybody know how to do that?
Thanks
dyahav
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Re: select for update - how to kill old locks [message #518812 is a reply to message #518809] |
Sun, 07 August 2011 06:55   |
 |
Michel Cadot
Messages: 68758 Registered: March 2007 Location: Saint-Maur, France, https...
|
Senior Member Account Moderator |
|
|
Locks are part of database applications.
Locks can last long it depends on what the transaction is doing, only application knows when they have to be released.
You still didn't check that the dead connection detection does not work. For me it works.
What "such" refers to?
Regards
Michel
[Updated on: Sun, 07 August 2011 06:57] Report message to a moderator
|
|
|
|
Re: select for update - how to kill old locks [message #518830 is a reply to message #518824] |
Sun, 07 August 2011 23:59   |
 |
Michel Cadot
Messages: 68758 Registered: March 2007 Location: Saint-Maur, France, https...
|
Senior Member Account Moderator |
|
|
A lock does not hang please take care of the way you expose your problem.
How can you determine if it is a long transaction or a session that has been disconnected? Note that a SElECT FIR UPDATE can be very long to execute.
If Oracle does not detect there is a deconnexion, there is nothing you can do at this side.
By the way, if Oracle does not detect it this means:
1/ the session does not currently do anything (which does not mean it can't hold locks)
2/ or the session is doing something and Oracle can talk with the client
You didn't tell us what happen at CLIENT side, maybe this will give you a way to workaround the problem.
But I think you should first think to fix your network instead of trying to workaround at database end.
Regards
Michel
[Updated on: Mon, 08 August 2011 00:00] Report message to a moderator
|
|
|
|
|