How you make a SQL Server database Read-Only

There are times when a SQL Server database read-only so that no new records can be added to the database whiist you carry out some task or you want a version that cannot be changed, say for archiving. The easiest way is through SQL and using the following command :-

alter database [ExampleDB] set read_only with no_wait
go

Then when the operation has been complete and you need the database to be read/write again, you issue the following command :-

alter database [ExampleDB] set read_write with no_wait
go

Tags - SQL

Last Modified : June 2023


About... / Contact.. / Cookie...