Why is my DB read-only when attached to SQL Express, but not with SQL Web?
- by David Rubin
I have an .mdf/.ldf pair, originally created in 2008 R2 Standard, and well under 10GB, with ACLs:
d:\db snapshot\DB_NAME.mdf
SERVERNAME\SQLServerMSSQLUser$ACCOUNT$MSSQLSERVER:F
OWNER RIGHTS:F
BUILTIN\Administrators:F
d:\db snapshot\DB_NAME_log.ldf
SERVERNAME\SQLServerMSSQLUser$ACCOUNT$MSSQLSERVER:F
OWNER RIGHTS:F
BUILTIN\Administrators:F
When I attach the database to an instance of SQL Express 2008 R2, it comes up as read-only. When exactly the same acls and user-accounts and SQLCMD statements are set up with SQL Web 2008 R2, it comes up writable. I looked at MSDN's comparison page but nothing jumped out at me. Why on earth is this happening? Thanks!
UPDATE
I just noticed that the name of the attached databases are different. On SQL Express (read-only) it matches the filename (e.g. DB_NAME); on SQL Web (writable) it matches the CUSTOM_NAME that I gave it in the attach command:
CREATE DATABASE [CUSTOM_NAME] ON (FILENAME = 'PATH_TO_MDF'), (FILENAME = 'PATH_TO_LDF') FOR ATTACH