Setting Read/Write permissions for SQL databases

Yesterday I had the problem that a database I tried to attach to the SQL Server was added with Read Only permissions, because the database was read only.

There was no permission set in the file system and the ACLs were set correct as well.

A little SQL script I ran finally corrected my permissions on the database:

USE master
GO
ALTER DATABASE movies
SET SINGLE_USER
WITH ROLLBACK IMMEDIATE
GO
ALTER DATABASE movies
SET READ_WRITE
GO
ALTER DATABASE movies
SET MULTI_USER
GO

Advertisements