关于sql server:具有活动副本的Azure SQL数据库副本

Azure SQL database copy with active replica

我在复制我们的Azure SQL数据库时遇到问题。我们正在复制的数据库具有一个在线副本,它是地理复制的一部分,可通过Azure门户进行配置。

我们使用Azure Portal复制按钮将主要数据的副本复制到其他服务器上,但是我们的数据库副本仍然认为它是副本集的一部分。

例如,我运行以下SQL:

ALTER DATABASE <DatabaseName> SET SINGLE_USER WITH ROLLBACK IMMEDIATE

我得到的答复是:

The operation cannot be performed on database"" 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.
Msg 5069, Level 16, State 1, Line 1
ALTER DATABASE statement failed.

我尝试运行:

1
ALTER DATABASE <DatabaseName> SET PARTNER OFF;

azure-sql不支持此功能,因此我得到以下响应:

Keyword or statement option 'PARTNER' is not supported in this version of SQL Server.

数据库副本的Azure门户显示"未配置Geo-Replication "

任何人都可以向我指出如何告诉数据库副本它不再是任何复制的一部分的正确方向吗?


1
alter database current set single_user with rollback immediate

在Azure SQL数据库中始终失败:

Msg 1468, Level 16, State 1, Line 3 The operation cannot be performed
on database"xxxx" because it is involved in a database mirroring
session or an availability group.

您将看到single_user不在Azure SQL数据库的ALTER DATABASE的受支持语法中。相反,您可以设置RESTRICTED_USER:

1
2
3
4
5
<db_update_option> ::=  
  { READ_ONLY | READ_WRITE }  

<db_user_access_option> ::=  
  { RESTRICTED_USER | MULTI_USER }

RESTRICTED_USER

RESTRICTED_USER allows for only members of the
db_owner fixed database role and dbcreator and sysadmin fixed server
roles to connect to the database, but does not limit their number. All
connections to the database are disconnected in the timeframe
specified by the termination clause of the ALTER DATABASE statement.
After the database has transitioned to the RESTRICTED_USER state,
connection attempts by unqualified users are refused. RESTRICTED_USER
cannot be modified with SQL Database Managed instance.

如果无法连接到Master并查看并可能杀死连接到用户数据库的会话,则将数据库设置为SINGLE_USER可能是不好的。


在Conor答案中,您还可以尝试将数据库导出为bacpac,然后将其导入为新数据库。在这里,您将找到如何将数据库导出到Azure存储帐户。


我会问工程团队。在复制过程中,从概念上讲,它可能是副本集的一部分,直到复制完成为止。

您的替代方法应该可以正常运行,而不会出现任何问题,例如您看到的解除阻塞的方法,就是从" now"还原备份,这将从最近的备份中为您创建数据库的新副本(它确实差异备份,这样您就可以在指定的时间点之前获得所有更改)。尝试一下,看看是否能满足您的需求。