SQL Server, C#: Timeout exception on Transaction Rollback

前端 未结 2 417
自闭症患者
自闭症患者 2021-01-04 01:52

I\'ve got a strange problem. I have a .NET program and my process logic needs a long-running transaction (~20min) on a SQL Server 2005 database. That\'s ok, since nobody acc

2条回答
  •  独厮守ぢ
    2021-01-04 02:46

    Transactions can take a while to roll-back; if that takes too long, sure you'll get a timeout. There doesn't seem to be an obvious way to influence this - you could try managing the transaction via TSQL - then you can (ab)use the CommandTimeout - but it could simply be that it takes a little while if you are making lots of changes inside the transaction; SQL Server assumes that most things will run to completion, so "commit" is virtually free, while "rollback" is more expensive.

提交回复
热议问题