SQL Server - Set Read-Only mode

Set database to read only mode do something and set read write mode. Alter database mode using simple T-SQL statements.

USE [master]
GO
ALTER DATABASE [] SET READ_ONLY WITH NO_WAIT
GO
-- do some magic here
GO
ALTER DATABASE [] SET READ_WRITE WITH NO_WAIT
GO

Leave a Reply

Your email address will not be published. Required fields are marked *