Last active
May 26, 2022 03:18
-
-
Save RickyLin/3a77a69e2664db0b2c1777dfbd7fa43d to your computer and use it in GitHub Desktop.
Set READ_COMMITTED_SNAPSHOT on for a database.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ALTER DATABASE DatabaseName SET OFFLINE WITH ROLLBACK IMMEDIATE | |
ALTER DATABASE DatabaseName SET READ_COMMITTED_SNAPSHOT ON | |
ALTER DATABASE DatabaseName SET ONLINE | |
/* Generate sql scripts for multiple databases. | |
SELECT 'ALTER DATABASE ' + [name] + ' SET OFFLINE WITH ROLLBACK IMMEDIATE; | |
ALTER DATABASE ' + [name] + ' SET READ_COMMITTED_SNAPSHOT ON; | |
ALTER DATABASE ' + [name] + ' SET ONLINE; | |
' | |
FROM sys.databases | |
WHERE [name] LIKE '%whatever%' | |
*/ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment