3906: Failed to update database because the database is read-only(无法更新数据库,因为数据库为只读)
SQL Server含义
您试图在标记为只读的数据库中修改数据(INSERT/UPDATE/DELETE/DDL)。SQL Server 拒绝了写入。
原因
数据库被设置为 READ_ONLY;连接到了可用性组中的辅助副本(用于读取);数据库在快照或还原之后仍为只读;或文件系统为只读。应用被误路由到辅助副本是典型原因。
解决方法
如果确实必须可写:ALTER DATABASE mydb SET READ_WRITE; 在可用性组中,将应用路由到主副本(检查 ReadWrite 连接路由 / ApplicationIntent)。只读快照无法写入;改为以源数据库为目标。同时检查文件权限和文件系统。
同一数据库的其他条目
- 102Incorrect syntax near 'token'('token' 附近有语法错误)
- 8114Error converting data type X to Y(将数据类型 X 转换为 Y 时出错)
- 1204The instance of the SQL Server Database Engine cannot obtain a LOCK resource(SQL Server 数据库引擎实例无法获取 LOCK 资源)
- 15023User already exists in the current database(用户在当前数据库中已存在)
- 18452Login failed. The login is from an untrusted domain and cannot be used with Windows authentication(登录失败。该登录名来自不受信任的域,不能用于 Windows 身份验证)
- 605Attempt to fetch logical page belongs to a different allocation unit(尝试获取的逻辑页属于另一个分配单元)
- 4922ALTER TABLE ALTER COLUMN failed because one or more objects access this column(ALTER TABLE ALTER COLUMN 失败,因为有一个或多个对象访问此列)