![]() ![]() Unless you're doing something special like connecting to an external database (or second database) then something as simple as creating a new DataContext can cause this. Search for 'promotion' in Introducing System.Transactions in the. In additional you may get an error about being 'unable to promote' a transaction. Using (var shipDB = new ShipperDBDataContext()) IsolationLevel = IsolationLevel.ReadCommitted ![]() Using (var t = new TransactionScope(TransactionScopeOption.Required, In contrast, SNAPSHOT does optimistic reads and optimistic writes. READ COMMITTED SNAPSHOT does optimistic reads and pessimistic writes. If you're using C# you probably want the ReadCommitted IsolationLevel and not Snapshot - unless you are doing writes in this transaction. So do yourself a favor and be sure it is turned on before you assume it is for 3 years like I did!!! Looks like Isolationlevel.ReadCommitted is allowed in code even if not enabled by the database. The option ALLOW_SNAPSHOT_ISOLATION above corresponds to IsolationLevel.Snapshot in. The option READ_COMMITTED_SNAPSHOT above corresponds to IsolationLevel.ReadCommitted in. You can see the before and after state and this should run almost immediately. This works even with connections active (presumably you're fine with them getting kicked out). SELECT is_read_committed_snapshot_on, snapshot_isolation_state_desc,snapshot_isolation_state FROM sys.databases WHERE name='shipperdb' SELECT is_read_committed_snapshot_on, snapshot_isolation_state_desc,snapshot_isolation_state FROM sys.databases WHERE name='shipperdb'ĪLTER DATABASE shipperdb SET allow_snapshot_isolation ONĪLTER DATABASE shipperdb SET SINGLE_USER WITH ROLLBACK IMMEDIATEĪLTER DATABASE shipperdb SET read_committed_snapshot ON Here's the ultimate code to run to enable snapshot mode and make sure it is enabled. OK (I am the original questioner) so it turns out this whole time I didn't even have the darn thing enabled. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |