Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2008 Forums
 Transact-SQL (2008)
 Deadlock

Author  Topic 

psfaro
Starting Member

49 Posts

Posted - 2011-03-07 : 07:45:11
Hi,


My apps generates a Deadlock , and MSSQL makes a Victim and executes ROLLBACK automatically , for all the trasaction that the "Victim" issued.

Is it Possible to configure MSSQL to solve the Deadlock , without ROLLBACK the victim transaction ?.

I want that "ROLLBACK " is made by the program, not for MSSQL.


REgards

Pedro Faro

Lumbago
Norsk Yak Master

3271 Posts

Posted - 2011-03-07 : 08:22:47
A deadlock is a conflict between two or more transactions in the database, and this can not be handled by an application. How is the database going to handle a deadlock without choosing a victim? Deadlocks can be avoided by indexing the tables involved properly.

- Lumbago
My blog-> http://thefirstsql.com/2011/02/07/regular-expressions-advanced-string-matching-and-new-split-function-sql-server-2008-r2/
Go to Top of Page

Sachin.Nand

2937 Posts

Posted - 2011-03-07 : 08:49:54
Set the following trace flag to understand what exactly is causing the deadlock.

DBCC TRACEON (1204,-1)

PBUH

Go to Top of Page

psfaro
Starting Member

49 Posts

Posted - 2011-03-07 : 12:16:49
Hi,

In apps that Updates too much data in a process(about 50 000 records), if someone update data in the same table , ocassionaly can be happen one deadlock.

The apps is prepared to deal with this situation , since it begin and commit/rrolbak the tansaction if anything failed.

Unfortunaly , MSSQL in a deadlock , ROLLBACK the victim transaction , and whe the apps detects that exists an error an try to rollback, there is not a Begin Trasaction issued.

Of course , i understand the "killing of the victim" , but what i need is that MSSQL doesn't rollback the transaction , but only kill the victim , to the app rollback the transaction .

I don't know if this is possible ?













Go to Top of Page

denis_the_thief
Aged Yak Warrior

596 Posts

Posted - 2011-03-07 : 14:07:36
The victim must be rolled back or this would leave the Database at an inconsistent state. SQL Server can't transfer the responsibility to issue a Rollback to some other Application. Otherwise it would have to wait in a Deadlock state until the other Application issued a Rollback, without knowing how long that would be nor a guarantee that it would be completed.
Go to Top of Page

psfaro
Starting Member

49 Posts

Posted - 2011-03-07 : 15:10:00
Hi ,

Ok. i Understand.

I'll deal the problem with some changes on code.

I know that sometime a deadlock can ocurr , but it's not due to a index not optimized .
In cenarios like updating to much data envolved on a transaction , it can happen,

Tanxs
Go to Top of Page
   

- Advertisement -