今天在利用sp_attach_db 'dbname', 'dataFileFullName', 'logFileFullName' 命令附加一个数据库文件到SqlServer2008时遇到了以下的错误:
Msg 3415, Level 16, State 3, Line 1
Database [dbname] cannot be upgraded because it is read-only or has read-only files. Make the database or files writeable, and rerun recovery.
Msg 1813, Level 16, State 2, Line 1
Could not open new database [dbname]. CREATE DATABASE is aborted.
Google之后得到解决方案是将mdf和ldf所在的目录的只读属性去掉并设置everyone用户的权限为FullControl,特此记录。