Why is my DB read-only when attached to SQL Express, but not with SQL Web?

Posted by David Rubin on Server Fault See other posts from Server Fault or by David Rubin
Published on 2014-05-29T19:09:39Z Indexed on 2014/05/29 21:34 UTC
Read the original article Hit count: 271

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

© Server Fault or respective owner

Related posts about sql-server

Related posts about sql-server-2008-r2