Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

I pull the plug on the client workstation, what happens to a long running database process? [duplicate]

Possible Duplicate:
SQL Server and connection loss in the middle of a transaction

I have a .NET 3.5 client app that kicks off a long-running (5-10 m) stored proc on the MS SQL Server 2005. The stored proc starts with BEGIN TRAN and ends with COMMIT TRAN.

If I pull the plug on the workstation, what happens to the stored procedure, does it finish running? Does it finish running under all the circumstances? Or will the loss of connectivity with the workstation cause the database to abort the stored proc?

EDIT: The workstation and the SQL Server are on different boxes.

like image 818
AngryHacker Avatar asked Jun 17 '11 22:06

AngryHacker


1 Answers

The loss of the workstation's power won't necessarily cause the SP to abort, but it could very well cause the transaction to roll back.

I say "could" because it does depend on exactly when the client loses its power. If a network connection is lost into a 'black hole' like this, the server won't be immediately notified that any disconnect happened at all; it has to rely on TCP eventually telling it that the connection is dead simply because the other side has not responded to anything in X time.

This is different from disconnecting the client application explicitly and 'normally'; in such a case, the client explicitly closes the connection, if applicable, and so SQL will know right away that the client is gone.

like image 165
Andrew Barber Avatar answered Oct 04 '22 21:10

Andrew Barber