问题描述
我正在尝试将数据库设置为当前在可用性组或镜像会话中的单用户模式。但是我收到以下错误:
The operation cannot be performed on database "DATABASE_NAME" because it is involved in a database mirroring session or an availability group. Some operations are not allowed on a database that is participating in a database mirroring session or in an availability group.ALTER DATABASE statement failed.
解决方法
您需要从可用性组中删除数据库,可以使用以下命令。
ALTER DATABASE DBName SET HADR OFF;
GO
一旦从AlwaysOn AG中删除了数据库,就可以将数据库置于单用户模式。