Settings for SQL Server committed read Snapshot isolation level

Source: Internet
Author: User
Tags microsoft sql server 2005

If you want to set the SQL Server database transaction isolation level to committed read-only snapshot isolation

If you run the following statement directly:

ALTER Database [Mydbname] SET read_committed_snapshot on

may be blocked for a long time. My side has not been executed for 4 hours in the formal environment test.

You can choose to run the following statement:

if(charindex('Microsoft SQL Server 2005',@ @version)> 0)  begin      Declare @sql varchar(8000)      Select @sql = 'ALTER DATABASE' + db_name()+ 'SET single_user with ROLLBACK IMMEDIATE; ALTER DATABASE' + db_name()+ 'SET read_committed_snapshot on; ALTER DATABASE' + db_name()+ 'SET Multi_user;'        Exec(@sql)  End  

The test script completes within 1 minutes.

is_read_committed_snapshot_on Field of sys.databases query

Select  from where = db_name ()  

is_read_committed_snapshot_on if 1 represents the currently committed read Snapshot isolation level.

Citation URL: http://www.it118.org/Specials/c9fba99e-4401-49cf-8256-ac3c1a34c0d9/a25f60b1-697d-4651-b4e4-e7e1598feced.htm

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.