xcopy sql express

xcopy sql express

Old forum URL: forums.lhotka.net/forums/t/2783.aspx


jhw posted on Thursday, April 26, 2007

Whenever I detach, xcopy an sql express db:

On the same computer I can re-attach no problem.

On another machine it always comes up as readonly. How do I get around this. Resetting the file and folder read-only attribs doesn't help.

Thanks

Heath

 

William replied on Saturday, April 28, 2007

You can check the NTFS permissions on the folder where the MDF file is stored. The Windows user who is currently accessing the database through SQL Server user instance needs to have read and write permissions.

Regards,
William

albruan replied on Saturday, April 28, 2007

I posed your question at Microsoft's managed newsgroup for SQL Server and these are the two responses I received:

BOL says that the xcopied database gets it's readonly state by the file
attributes of the primary file. Check you don't have any group policies in
place or AV/privacy software that changes the permissions.

and

This should work.  Chances are good the SQL Server principle doesn't have
write permissions on either the files or directory.  A common issue is that
when the original attach was done the user didn't have write permissions and
write permission were added later to try to fix the problem.  Once the
database has been attached as read_only, an ALTER DATABASE is required to
make it read write.

Copyright (c) Marimer LLC