ITPub博客

首页 > 数据库 > SQL Server > [AlwaysOn] 创建SQL Server高可用性组T-SQL语法:REPLICA ON子句

[AlwaysOn] 创建SQL Server高可用性组T-SQL语法:REPLICA ON子句

原创 SQL Server 作者:cow977 时间:2019-08-17 08:33:18 0 删除 编辑

REPLICA ON

指定从1到5个SQL Server实例来承载新可用性组中的可用性副本。Specifies from one to five SQL server instances to host availability replicas in the new availability group. 每个副本都由其服务器实例地址指定,后跟一个WITH(…)子句。Each replica is specified by its server instance address followed by a WITH (...) clause. 至少,必须指定本地服务器实例,该实例将成为初始主副本。Minimally, you must specify your local server instance, which becomes the initial primary replica. 或者,您还可以指定最多四个辅助副本。Optionally, you can also specify up to four secondary replicas.

您需要将每个辅助副本加入到可用性组中。You need to join every secondary replica to the availability group. 有关详细信息,请参阅alter availability group(Transact-SQL)。For more information, see ALTER AVAILABILITY GROUP (Transact-SQL).

注释 Note

如果在创建可用性组时指定的辅助副本少于四个,则可以随时使用alter availability group T-SQL语句指定其他辅助副本。If you specify less than four secondary replicas when you create an availability group, you can an additional secondary replica at any time by using the ALTER AVAILABILITY GROUP Transact-SQL statement. 您还可以使用此语句从现有可用性组中删除任何辅助副本。You can also use this statement this remove any secondary replica from an existing availability group.

<server_instance> 指定作为副本主机的SQL Server实例的地址。 <server_instance> Specifies the address of the instance of SQL Server that is the host for an replica.地址格式取决于实例是默认实例还是命名实例,以及它是独立实例还是故障转移群集实例(FCI),如下所示:The address format depends on whether the instance is the default instance or a named instance and whether it is a standalone instance or a failover cluster instance (FCI), as follows:

{ 'system_name[\instance_name]' | 'FCI_network_name[\instance_name]' }

此地址的组成部分如下:The components of this address are as follows:

system_name

是目标SQL Server实例所在的计算机系统的NetBIOS名称。Is the NetBIOS name of the computer system on which the target instance of SQL Server resides. 此计算机必须是WSFC节点。This computer must be a WSFC node.

FCI_network_name

用于访问SQL Server故障转移群集的网络名称。Is the network name that is used to access a SQL Server failover cluster. 如果服务器实例作为SQL Server故障转移伙伴参与,请使用此选项。Use this if the server instance participates as a SQL Server failover partner. 在FCI服务器实例上执行select @@servername将返回其整个“fci_network_name[\instance_name]”字符串(即完整副本名)。Executing SELECT @@SERVERNAME on an FCI server instance returns its entire ' FCI_network_name[\ instance_name]' string (which is the full replica name).

instance_name

是由系统名称或FCI网络名称托管且已启用HADR服务的SQL Server实例的名称。Is the name of an instance of a SQL Server that is hosted by system_name or FCI_network_name and that has HADR service is enabled. 对于默认服务器实例,实例名称是可选的。For a default server instance, instance_name is optional. 实例名不区分大小写。The instance name is case insensitive. 在独立服务器实例上,该值名称与执行select @@servername返回的值相同。On a stand-alone server instance, this value name is the same as the value returned by executing SELECT @@SERVERNAME.

\

是仅在指定实例名称时使用的分隔符,以便将其与系统名称或FCI网络名称分隔开。Is a separator used only when specifying instance_name, in order to separate it from system_name or FCI_network_name.

有关WSFC节点和服务器实例的先决条件的信息,请参阅有关“始终在线”可用性组(SQL Server)的先决条件、限制和建议。For information about the prerequisites for WSFC nodes and server instances, see Prerequisites, Restrictions, and Recommendations for Always On Availability Groups (SQL Server).


来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/81227/viewspace-2653974/,如需转载,请注明出处,否则将追究法律责任。

请登录后发表评论 登录
全部评论

注册时间:2011-03-02

  • 博文量
    688
  • 访问量
    735881