[AlwaysOn] 建立SQL Server高可用性組T-SQL語法:REPLICA ON子句

cow977發表於2019-08-17

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 .

註釋 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 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 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 .

\

是僅在指定例項名稱時使用的分隔符,以便將其與系統名稱或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 .


來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/81227/viewspace-2653974/,如需轉載,請註明出處,否則將追究法律責任。

相關文章