无法对数据库执行操作,因为它涉及数据库镜像会话或可用性组(Azure) [英] Operation cannot be performed on database because it is involved in a database mirroring session or an availability group (Azure)

查看:607
本文介绍了无法对数据库执行操作,因为它涉及数据库镜像会话或可用性组(Azure)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我遇到了SQL Azure的间歇性问题.我正在将一个只读SQL Azure数据库(V12)从一个弹性池复制到另一个.复制数据库后,我将其设置为使用以下方式进行读/写:

I am experiencing an intermittent issue with SQL Azure. I am copying a readonly SQL Azure database (V12) from one elastic pool into another. Once the database is copied, I set it to read/write using:

$"ALTER DATABASE [{databaseName}] SET READ_WRITE"

这有时会因错误而失败:

This sometimes fails with the error:

无法对数据库***执行该操作,因为它是参与数据库镜像会话或可用性组

The operation cannot be performed on database *** because it is involved in a database mirroring session or an availability group

我尝试使用退避来实现重试逻辑,但这不起作用.我找不到与该错误或Azure中的数据库镜像有关的任何文档.

I have tried implementing retry logic with backoff but that doesn't work. I have failed to find any documentation relating to this error or to database mirroring in Azure.

任何建议将不胜感激!

推荐答案

我设法纠正了这个问题,它确实与地理复制有关.我要复制的数据库最初具有一个地理副本,但是在复制主数据库之前,我先删除了辅助数据库(使用DROP DATABASE).解决方法是先删除主数据库和辅助数据库之间的复制链接,然后再删除辅助数据库(使用ALTER DATABASE [dbName]在服务器[serverName]上删除辅助数据库).

I've managed to rectify this issue and it was indeed related to geo-replication. The database I was copying originally had a geo replica but I was dropping the secondary database (using DROP DATABASE) prior to copying the primary. The fix was to first drop the replication link between the primary and secondary before dropping the secondary database (using ALTER DATABASE [dbName] REMOVE SECONDARY ON SERVER [serverName]).

这篇关于无法对数据库执行操作,因为它涉及数据库镜像会话或可用性组(Azure)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆