[AlwaysOn] 建立SQL Server高可用性組T-SQL語法:SECONDARY_ROLE子句
SECONDARY_ROLE ( ... )
指定當此可用性副本當前擁有輔助角色(即,每當它是輔助副本時)時生效的特定於角色的設定。Specifies role-specific settings that take effect if this availability replica currently owns the secondary role (that is, whenever it is a secondary replica). 在括號內,指定一個或兩個輔助角色選項。Within the parentheses, specify either or both secondary-role options. 如果兩者都指定,請使用逗號分隔的列表。If you specify both, use a comma-separated list.
輔助角色選項如下:The secondary role options are as follows:
ALLOW_CONNECTIONS = { NO | READ_ONLY | ALL }
指定執行輔助角色(即充當輔助副本)的給定可用性副本的資料庫是否可以接受來自客戶端的連線,其中之一:Specifies whether the databases of a given availability replica that is performing the secondary role (that is, is acting as a secondary replica) can accept connections from clients, one of:
NO
不允許使用者連線到此副本的輔助資料庫。No user connections are allowed to secondary databases of this replica. 它們不可用於讀取訪問。They are not available for read access. 這是預設行為。This is the default behavior.
READ_ONLY
僅允許連線到輔助副本中的資料庫,其中application intent屬性設定為readonly。Only connections are allowed to the databases in the secondary replica where the Application Intent property is set to ReadOnly. 有關此屬性的詳細資訊,請參閱將連線字串關鍵字用於SQL Server本機客戶端。For more information about this property, see .
ALL
允許所有到輔助副本中資料庫的連線進行只讀訪問。All connections are allowed to the databases in the secondary replica for read-only access.
有關詳細資訊,請參閱活動的輔助副本:可讀的輔助副本(始終在可用性組上)。For more information, see .
READ_ONLY_ROUTING_URL ='TCP://system-address:port'
指定用於將只讀連線請求路由到此可用性副本的URL。Specifies the URL to be used for routing read-intent connection requests to this availability replica. 這是SQL Server資料庫引擎偵聽的URL。This is the URL on which the SQL Server Database Engine listens. 通常,SQL Server資料庫引擎的預設例項偵聽TCP 1433埠。Typically, the default instance of the SQL Server Database Engine listens on TCP port 1433.
對於命名例項,可以透過查詢sys.dm_tcp_listener_states動態管理檢視的port和type_desc列來獲取埠號。For a named instance, you can obtain the port number by querying the port and type_desc columns of the dynamic management view. 伺服器例項使用Transact-SQL偵聽器(type_desc='tsql')。The server instance uses the Transact-SQL listener ( type_desc='TSQL').
有關計算副本的只讀路由URL的詳細資訊,請參閱計算AlwaysOn的只讀路由URL。For more information about calculating the read-only routing URL for a replica, see Calculating read_only_routing_url for Always On.
註釋 Note
對於SQL Server的命名例項,應將Transact-SQL偵聽器配置為使用特定埠。For a named instance of SQL Server, the Transact-SQL listener should be configured to use a specific port. 有關詳細資訊,請參閱配置伺服器以偵聽特定的TCP埠(SQL Server配置管理器)。For more information, see .
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/81227/viewspace-2654210/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- [AlwaysOn] 建立SQL Server高可用性組T-SQL語法:LISTENER子句SQLServer
- [AlwaysOn] 建立SQL Server高可用性組T-SQL語法:DATABASE子句SQLServerDatabase
- [AlwaysOn] 建立SQL Server高可用性組T-SQL語法:REPLICA ON子句SQLServer
- [AlwaysOn] 建立SQL Server高可用性組T-SQL語法:AVAILABILITY GROUP ON子句SQLServerAI
- [AlwaysOn] 建立SQL Server高可用性組T-SQL語法:ENDPOINT_URL子句SQLServer
- [AlwaysOn] 建立SQL Server高可用性組T-SQL語法:PRIMARY_ROLE子句SQLServer
- [AlwaysOn] 建立SQL Server AlwaysOn高可用性組T-SQL語法SQLServer
- [AlwaysOn] 建立SQL Server高可用性組T-SQL語法:例項SQLServer
- [AlwaysOn] 建立SQL Server高可用性組T-SQL語法:BASIC引數SQLServer
- [AlwaysOn] 建立SQL Server高可用性組T-SQL語法:安全性SQLServer
- [AlwaysOn] 建立SQL Server高可用性組T-SQL語法:DISTRIBUTED引數SQLServer
- [AlwaysOn] 建立SQL Server高可用性組T-SQL語法:BACKUP_PRIORITY引數SQLServer
- [AlwaysOn] 建立SQL Server高可用性組T-SQL語法:CLUSTER_TYPE引數SQLServer
- [AlwaysOn] 建立SQL Server高可用性組T-SQL語法:DTC_SUPPORT引數SQLServer
- [AlwaysOn] 建立SQL Server高可用性組T-SQL語法:group_name引數SQLServer
- [AlwaysOn] 建立SQL Server高可用性組T-SQL語法:先決條件和限制SQLServer
- [AlwaysOn] 建立SQL Server高可用性組T-SQL語法:SESSION_TIMEOUT引數SQLServerSession
- [AlwaysOn] 建立SQL Server高可用性組T-SQL語法:SEEDING_MODE引數SQLServer
- [AlwaysOn] 建立SQL Server高可用性組T-SQL語法:FAILOVER_MODE引數SQLServerAI
- [AlwaysOn] 建立SQL Server高可用性組T-SQL語法:AVAILABILITY_MODE引數SQLServerAI
- [AlwaysOn] 建立SQL Server高可用性組T-SQL語法:DB_FAILOVER引數SQLServerAI
- [AlwaysOn] 建立SQL Server高可用性組T-SQL語法:AUTOMATED_BACKUP_PREFERENCE引數SQLServer
- [AlwaysOn] 建立SQL Server高可用性組T-SQL語法:HEALTH_CHECK_TIMEOUT引數SQLServer
- [AlwaysOn] 建立SQL Server高可用性組T-SQL語法:FAILURE_CONDITION_LEVEL引數SQLServerAI
- [AlwaysOn] T-SQL語法:REQUIRED_SYNCHRONIZED_SECONDARIES_TO_COMMIT引數SQLUIsynchronizedMIT
- SQL Server 2022 AlwaysOn新特性之包含可用性組介紹SQLServer
- [AlwaysOn] AlwaysOn可用性組的可用性模式之間的差異模式
- T-SQL——基礎語法SQL
- SQL Server AlwaysOn可用性副本會話期間的可能故障SQLServer會話
- SQL Server Alwayson建立代理作業注意事項SQLServer
- SQL Server AlwaysOn搭建SQLServer
- SQL Server中的高可用性概覽SQLServer
- 15 個常用的 SQL Server 高階語法SQLServer
- T-SQL的CREATE TABLE語法(下)SQL
- T-SQL的CREATE TABLE語法(上)SQL
- 【T-SQL】〇、 T-SQL語法說明SQL
- SQL Server資料庫管理常用SQL和T-SQL語句SQLServer資料庫
- 雲中SQL Server高可用性最佳實踐SQLServer