开发者

SQL Server and connection loss in the middle of a transaction [duplicate]

This question already has answers here: Closed 10 years ago.

Possible Du开发者_如何学Pythonplicate:

What happens to an uncommitted transaction when the connection is closed?

What would happen if lose the connection in the middle of a transaction?

I guess that if the transaction is never committed and could execute again, but... is there a way I can connect and roll it back to a saved point and continue with the things I already have?

Kind regards.


If you lose the connection in the middle of a transaction you can no longer reenter this transaction from a different connection. If the connection is dropped, SQL Server will rollback any uncommitted transactions automatically. So if this happens, simply reconnect and you will find your database at the same state it was before starting the transaction (assuming of course there aren't other users that might have changed it in between.


Generally, any break in the transaction will be rolled back. Whether the client disconnects, CommandTimeout or the server restarts itself.

This is Atomic in ACID

The ability to "pick up" a transaction where it left off does not make sense

  • other transactions that happen/the transaction LSN will be out of order
  • internal structures are changed as part of a write (indexes etc)/the database is inconsistent
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜