We're here to help!

Correct Snapshot Isolation

Follow

Snapshot isolation must be enabled by setting the "ALLOW_SNAPSHOT_ISOLATION ON" database option before it is used in transactions. 

You must enable snapshot isolation in each database that uses it with the Transact-SQL ALTER DATABASE statement.

In this case, snapshot isolation differs from the traditional isolation levels of READ COMMITTED, REPEATABLE READ, SERIALIZED, and READ UNCOMMITTED, which require no configuration.


The following statements activate snapshot isolation and replace the default READ COMMITTED behavior with SNAPSHOT:

ALTER DATABASE MyDatabase
SET ALLOW_SNAPSHOT_ISOLATION ON
ALTER DATABASE MyDatabase
SET READ_COMMITTED_SNAPSHOT ON

 

To check what the current snapshot isolation level is, run the following SQL:

If the query returns 0 then it is turned off.

select name, snapshot_isolation_state_desc, is_read_committed_snapshot_on from sys.databases

For avoiding lock in parallel sessions, table have to be created with ALLOW_PAGE_LOCKS = OFF option.

Have more questions? Submit a request

Comments