How may I change the default TRANSACTION ISOLATION LEVEL in SQL Server 2005?

对着背影说爱祢 提交于 2019-12-10 13:47:25

问题


I know the default TRANSACTION ISOLATION LEVEL in SQL Server is "read committed". If I want to change it to "READ UNCOMMITTED", how may i make this configuration change?

note: I cannot use SET TRANSACTION ISOLATION LEVEL, which only apply in the current session. I cannot add NOLOCK in the queries because there are thousands of queries involved.

Thanks


Thanks for your answer. We are ok with reading dirty rows. Update is not a problem in our case as well. but, I really want to change this default config of isolation level. Please kindly help.

I cannot "SET TRANSACTION ISOLATION LEVEL READ UNCOMMITTED". I must make the global change.


We have carefully reviewed both snapshot isolation level. They cannot be used in our situation.


回答1:


I really do not think you should set that at a global level. You should be setting this pretty carefully because you can end up with a lot of different problems:

  • Lost Updates
  • Non repeatable reads
  • Dirty reads
  • Phantom reads

There is no way to set this at a database or a server level - it can only be set at a connection level.

The best you can do at a database level is to set the ALLOW_SNAPSHOT_ISOLATION or READ_COMMITTED_SNAPSHOT properties. Read more here:

http://msdn.microsoft.com/en-us/library/tcbchxcb%28VS.80%29.aspx




回答2:


What about:

SET TRANSACTION ISOLATION LEVEL READ UNCOMMITTED

It will only apply to the current transaction.



来源:https://stackoverflow.com/questions/1670673/how-may-i-change-the-default-transaction-isolation-level-in-sql-server-2005

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!