Make database readonly

Pretty straightforward to set a database to readonly mode. If the database is currently in use, it may get complicated, but as long as it's currently unused, this should work:

-- Set to readonly:
use master;
go
alter database mydatabase set read_only with no_wait;
go

-- Re-enable writing:
use master;
go
alter database mydatabase set read_write with no_wait;
go