Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to detect READ_COMMITTED_SNAPSHOT is enabled?

In Microsoft SQL Server, is there a way to detect whether a database has had its isolation level set via the T-SQL command ALTER DATABASE <database> SET READ_COMMITTED_SNAPSHOT ON;?

I cannot find a simple way to detect this in either T-SQL or via the Management Studio's GUI.

like image 258
Chris Driver Avatar asked Sep 09 '08 14:09

Chris Driver


People also ask

How do you check if Read_committed_snapshot is on or off?

SELECT IS_READ_COMMITTED_SNAPSHOT_ON FROM SYS. DATABASES WHERE NAME= 'YourDatabase' ; Return values: 1: READ_COMMITTED_SNAPSHOT option is ON.

How do you check if read committed SNAPSHOT is enabled?

To check the current state of Read-Committed Snapshot, open a query window and execute the following command: select is_read_committed_snapshot_on from sys. databases where name= 'CitrixSiteDB'; A value of 1 indicates that Read-Committed Snapshot is already enabled and no change is required.

What is set Read_committed_snapshot on?

Setting the READ_COMMITTED_SNAPSHOT ON option allows access to versioned rows under the default READ COMMITTED isolation level. If the READ_COMMITTED_SNAPSHOT option is set to OFF, you must explicitly set the Snapshot isolation level for each session in order to access versioned rows.


2 Answers

SELECT is_read_committed_snapshot_on FROM sys.databases 
WHERE name= 'YourDatabase'

Return value:

  • 1: READ_COMMITTED_SNAPSHOT option is ON. Read operations under the READ COMMITTED isolation level are based on snapshot scans and do not acquire locks.
  • 0 (default): READ_COMMITTED_SNAPSHOT option is OFF. Read operations under the READ COMMITTED isolation level use Shared (S) locks.
like image 198
Galwegian Avatar answered Sep 27 '22 23:09

Galwegian


  1. As per DBCC USEROPTIONS (Transact-SQL):

DBCC USEROPTIONS reports an isolation level of 'read committed snapshot' when the database option READ_COMMITTED_SNAPSHOT is set to ON and the transaction isolation level is set to 'read committed'. The actual isolation level is read committed.

  1. Also in SQL Server Management Studio, in database properties under Options->Miscellaneous there is "Is Read Committed Snapshot On" option status
like image 44
MikeL Avatar answered Sep 30 '22 23:09

MikeL