dbTalk Databases Forums  

Deadlock transaction

comp.databases.ms-sqlserver comp.databases.ms-sqlserver


Discuss Deadlock transaction in the comp.databases.ms-sqlserver forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Altman
 
Posts: n/a

Default Deadlock transaction - 06-22-2007 , 09:17 AM






I have a customer using our program with SQL server and is
occasionally getting a "Transaction (process ID xxxxx) was deadlocked
on lock resources with another process and has been chosen as the
deadlock victim." From what they are telling me, there shouldn't be
any deadlock happening as they say this happens when they invoicing in
a different program that is accessing a different database. Also the
error is happening on an SQL Select from a view and this select is
then showing data in an HTML table for the user. I don't think this
view should need to lock anything, I just want to read the data. Is
there anything I can do to fix this?


Reply With Quote
  #2  
Old   
Alex Kuznetsov
 
Posts: n/a

Default Re: Deadlock transaction - 06-22-2007 , 09:43 AM






On Jun 22, 8:17 am, Altman <balt... (AT) easy-automation (DOT) com> wrote:
Quote:
I have a customer using our program with SQL server and is
occasionally getting a "Transaction (process ID xxxxx) was deadlocked
on lock resources with another process and has been chosen as the
deadlock victim." From what they are telling me, there shouldn't be
any deadlock happening as they say this happens when they invoicing in
a different program that is accessing a different database. Also the
error is happening on an SQL Select from a view and this select is
then showing data in an HTML table for the user. I don't think this
view should need to lock anything, I just want to read the data. Is
there anything I can do to fix this?
Read "Analyzing Deadlocks with SQL Server Profiler" in BOL.

http://sqlserver-tips.blogspot.com/



Reply With Quote
  #3  
Old   
Oscar Santiesteban
 
Posts: n/a

Default Re: Deadlock transaction - 06-22-2007 , 11:15 PM



Try using
select * from table (NOLOCK)
where xxxx = xxxx
This will not lock the database as it reads.


"Altman" <baltman (AT) easy-automation (DOT) com> wrote

Quote:
I have a customer using our program with SQL server and is
occasionally getting a "Transaction (process ID xxxxx) was deadlocked
on lock resources with another process and has been chosen as the
deadlock victim." From what they are telling me, there shouldn't be
any deadlock happening as they say this happens when they invoicing in
a different program that is accessing a different database. Also the
error is happening on an SQL Select from a view and this select is
then showing data in an HTML table for the user. I don't think this
view should need to lock anything, I just want to read the data. Is
there anything I can do to fix this?




Reply With Quote
  #4  
Old   
Erland Sommarskog
 
Posts: n/a

Default Re: Deadlock transaction - 06-23-2007 , 05:10 AM



Oscar Santiesteban (o_santiesteban (AT) bellsouth (DOT) net) writes:
Quote:
Try using
select * from table (NOLOCK)
where xxxx = xxxx
This will not lock the database as it reads.
This may on the other hand lead to that the query returns incorrect
results, which may even more seroius. There are situations where NOLOCK
is called for, but you need to understand the implications. If you
don't - don't try it.


--
Erland Sommarskog, SQL Server MVP, esquel (AT) sommarskog (DOT) se

Books Online for SQL Server 2005 at
http://www.microsoft.com/technet/pro...ads/books.mspx
Books Online for SQL Server 2000 at
http://www.microsoft.com/sql/prodinf...ons/books.mspx


Reply With Quote
  #5  
Old   
Altman
 
Posts: n/a

Default Re: Deadlock transaction - 06-26-2007 , 11:30 AM



On Jun 23, 4:10 am, Erland Sommarskog <esq... (AT) sommarskog (DOT) se> wrote:
Quote:
Oscar Santiesteban (o_santieste... (AT) bellsouth (DOT) net) writes:
Try using
select * from table (NOLOCK)
where xxxx = xxxx
This will not lock the database as it reads.

This may on the other hand lead to that the query returns incorrect
results, which may even more seroius. There are situations where NOLOCK
is called for, but you need to understand the implications. If you
don't - don't try it.

--
Erland Sommarskog, SQL Server MVP, esq... (AT) sommarskog (DOT) se

Books Online for SQL Server 2005 athttp://www.microsoft.com/technet/prodtechnol/sql/2005/downloads/books...
Books Online for SQL Server 2000 athttp://www.microsoft.com/sql/prodinfo/previousversions/books.mspx
I Think that the nolock will work for me. I understand the
implications and I think that my program will be able to handle it.
What I would've liked better was something like read committed but
didn't lock records.



Reply With Quote
  #6  
Old   
Alex Kuznetsov
 
Posts: n/a

Default Re: Deadlock transaction - 06-26-2007 , 01:36 PM



On Jun 26, 10:30 am, Altman <balt... (AT) easy-automation (DOT) com> wrote:
Quote:
On Jun 23, 4:10 am, Erland Sommarskog <esq... (AT) sommarskog (DOT) se> wrote:



Oscar Santiesteban (o_santieste... (AT) bellsouth (DOT) net) writes:
Try using
select * from table (NOLOCK)
where xxxx = xxxx
This will not lock the database as it reads.

This may on the other hand lead to that the query returns incorrect
results, which may even more seroius. There are situations where NOLOCK
is called for, but you need to understand the implications. If you
don't - don't try it.

--
Erland Sommarskog, SQL Server MVP, esq... (AT) sommarskog (DOT) se

Books Online for SQL Server 2005 athttp://www.microsoft.com/technet/prodtechnol/sql/2005/downloads/books...
Books Online for SQL Server 2000 athttp://www.microsoft.com/sql/prodinfo/previousversions/books.mspx

I Think that the nolock will work for me. I understand the
implications and I think that my program will be able to handle it.
What I would've liked better was something like read committed but
didn't lock records.
If you are on 2005, consider snapshot isolation.

http://sqlserver-tips.blogspot.com



Reply With Quote
Reply




Thread Tools
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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.