Database 'xxx' cannot be upgraded because it is read-only or has read-only file Make the database or files writeable, and rerun recovery.

简介:

 在分离数据库DatabaseName(暂且用DatabaseName代替该数据库名)后,我将其数据文件以及日志文件移动到新增的磁盘上。然后附加该数据库,结果报如下错误:

Database 'DatabaseName' cannot be upgraded because it is read-only or has read-only files. Make the database or files writeable, and rerun recovery.

Could not open new database 'DatabaseName'. CREATE DATABASE is aborted. (Microsoft SQL Server,错误: 3415)

    通过VNC连接到该数据库服务器,我检查了该数据库文件以及日志文件是否为只读,但是事实是这些文件都具有读写权限。经过一番细致检查后,才发现了问题的根本原因:

    我首先在我机器上用SSMS工具通过域账号A连接到数据库服务器分离了该数据库,这个域账号拥有这个数据库的sysadmin角色,但是并不是该服务器上 的系统管理员,然后我通过VNC使用另外一个域账号B移动了数据库的文件,然后又在我机器使用SSMS去附加该数据库,因为使用的是域账号A,并没有操作 服务器上文件的权限。结果报如上错误。

    于是我在该服务器上使用B账号登陆数据库,附加该数据库,成功解决。后面我测试了一下,在该服务器上添加域账号A,赋予其操作数据库文件的权限,结果就不会出现上述错误。

相关文章
|
12月前
|
存储 前端开发 Java
【Java】If you want an embedded database (H2, HSQL or Derby), please put it on the classpath.
【Java】If you want an embedded database (H2, HSQL or Derby), please put it on the classpath.
156 0
|
消息中间件 Linux
Linux - error: cannot open Packages database in /var/lib/rpm
Linux - error: cannot open Packages database in /var/lib/rpm
294 0
|
SQL BI 数据库
SQL Server 2012 The report server cannot open a connection to the report server database
案例环境:        操作系统版本:    Windows Server 2012 R2 Standard        数据库版本  :    SQL SERVER 2012 SP2 案例介绍:         今天进入一台新安装的SQL Server服务器的Reporting S...
1363 0
|
SQL 测试技术 数据库
Cannot execute as the database principal because the principal "guest" does not exist, this type of principal cannot be impersonated, or you do not ha
今天遇到这样一个问题:一个系统的作业需要给系统Support人员开放SQL Agent下作业的查看、执行权限。数据库版本为SQL Server 2014 SP2,给这个系统Support人员的NT账号授予msdb数据库下面权限后:     该系统Support人员反馈在双击查看该作业时报下面错误。
1190 0
|
SQL 数据库 Windows
Cannot execute as the database principal because the principal "guest" does not exist, this type of principal cannot be impersonated, or you do not ha
原文:Cannot execute as the database principal because the principal "guest" does not exist, this type of principal cannot be impersonated, or you do not have permission. 今天遇到这样一个问题:一个系统的作业需要给系统Support人员开放SQL Agent下作业的查看、执行权限。
958 0
|
Web App开发 Java Apache
Cannot determine embedded database driver class for database type NONE
这个问题要从“  java.io.IOException: Server returned HTTP response code: 403 for URL: http://start.spring.
3207 0
|
Java Spring Maven
深入Spring Boot:怎样排查 Cannot determine embedded database driver class for database type NONE
写在前面 这个demo来说明怎么一步步排查一个常见的spring boot AutoConfiguration的错误。 https://github.
3656 0