IMZRH的日志

努力成为一个有用的人

导航

解决sp_attach_db命令不成功的问题

Posted on 2012-02-23 15:24  张荣华  阅读(1489)  评论(0编辑  收藏  举报

今天在利用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,特此记录。