Snapshot isolation must be enabled by setting the "ALLOW_SNAPSHOT_ISOLATION ON" database option before it is used in transactions. You
You must enable snapshot isolation in each database that uses it with the Transact-SQL ALTER DATABASE statement.
In this respectcase, snapshot isolation differs from the traditional isolation levels of READ COMMITTED, REPEATABLE READ, SERIALIZABLESERIALIZED, and READ UNCOMMITTED, which require no configuration.
The following statements activate snapshot isolation and replace the default READ COMMITTED behavior with SNAPSHOT:
No Format | |
---|---|
|
...
| |
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.
No Format |
---|
...
| ||
select name, snapshot_isolation_state_desc, is_read_committed_snapshot_on from sys.databases |
...
Info |
---|
For avoiding lock in parallel sessions, table have to be created with ALLOW_PAGE_LOCKS = OFF option. |