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,赋予其操作数据库文件的权限,结果就不会出现上述错误。

相关文章
|
缓存 Java 数据库连接
MybatisPlusException: Your property named “xxx“ cannot find the corresponding database column name!
MybatisPlusException: Your property named “xxx“ cannot find the corresponding database column name!
108 0
|
存储 前端开发 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.
473 0
|
SQL Java 关系型数据库
spring boot集成mybatis只剩两个sql 并提示 Cannot obtain primary key information from the database, generated objects may be incomplete
spring boot集成mybatis只剩两个sql 并提示 Cannot obtain primary key information from the database, generated objects may be incomplete
153 0
spring boot集成mybatis只剩两个sql 并提示 Cannot obtain primary key information from the database, generated objects may be incomplete
|
消息中间件 Linux
Linux - error: cannot open Packages database in /var/lib/rpm
Linux - error: cannot open Packages database in /var/lib/rpm
371 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下作业的查看、执行权限。
1009 0
|
Java Spring Maven
深入Spring Boot:怎样排查 Cannot determine embedded database driver class for database type NONE
写在前面 这个demo来说明怎么一步步排查一个常见的spring boot AutoConfiguration的错误。 https://github.
3746 0