我的编程空间,编程开发者的网络收藏夹
学习永远不晚

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

短信预约 -IT技能 免费直播动态提醒
省份

北京

  • 北京
  • 上海
  • 天津
  • 重庆
  • 河北
  • 山东
  • 辽宁
  • 黑龙江
  • 吉林
  • 甘肃
  • 青海
  • 河南
  • 江苏
  • 湖北
  • 湖南
  • 江西
  • 浙江
  • 广东
  • 云南
  • 福建
  • 海南
  • 山西
  • 四川
  • 陕西
  • 贵州
  • 安徽
  • 广西
  • 内蒙
  • 西藏
  • 新疆
  • 宁夏
  • 兵团
手机号立即预约

请填写图片验证码后获取短信验证码

看不清楚,换张图片

免费获取短信验证码

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

PRIMARY_ROLE ( ... )

指定当此可用性副本当前拥有主要角色(即,无论何时为主要副本)时生效的特定于角色的设置。Specifies role-specific settings that take effect if this availability replica currently owns the primary role (that is, whenever it is the primary replica). 在括号内,指定一个或两个主要角色选项。Within the parentheses, specify either or both primary-role options. 如果两者都指定,请使用逗号分隔的列表。If you specify both, use a comma-separated list.

主要角色选项如下:The primary role options are as follows:

ALLOW_CONNECTIONS = { READ_WRITE | ALL }

指定执行主要角色(即充当主要副本)的给定可用性副本的数据库可以从客户端接受的连接类型,其中之一:Specifies the type of connection that the databases of a given availability replica that is performing the primary role (that is, is acting as a primary replica) can accept from clients, one of:

READ_WRITE

不允许将应用程序意向连接属性设置为只读的连接。Connections where the Application Intent connection property is set to ReadOnly are disallowed. 当Application Intent属性设置为ReadWrite或未设置Application Intent连接属性时,允许进行连接。When the Application Intent property is set to ReadWrite or the Application Intent connection property is not set, the connection is allowed.有关应用程序意向连接属性的详细信息,请参阅将连接字符串关键字用于SQL Server本机客户端。For more information about Application Intent connection property, see Using Connection String Keywords with SQL Server Native Client.

ALL

允许所有连接到主副本中的数据库。All connections are allowed to the databases in the primary replica. 这是默认行为。This is the default behavior.

READ_ONLY_ROUTING_LIST = { ('<server_instance>' [ ,...n ] ) | NONE }

指定在辅助角色下运行时承载此可用性组的可用性副本并满足以下要求的服务器实例的逗号分隔列表:Specifies a comma-separated list of server instances that host availability replicas for this availability group that meet the following requirements when running under the secondary role:

l   配置为允许所有连接或只读连接(见上文辅助角色选项的“允许连接”参数)。Be configured to allow all connections or read-only connections (see the ALLOW_CONNECTIONS argument of the SECONDARY_ROLE option, above).

l   定义其只读路由URL(见上文辅助角色选项的只读路由URL参数)。Have their read-only routing URL defined (see the READ_ONLY_ROUTING_URL argument of the SECONDARY_ROLE option, above).

只读路由列表值如下:The READ_ONLY_ROUTING_LIST values are as follows:

<server_instance> 指定作为副本主机的SQL Server实例的地址,该副本在辅助角色下运行时是可读的辅助副本。<server_instance> Specifies the address of the instance of SQL Server that is the host for a replica that is a readable secondary replica when running under the secondary role.

使用逗号分隔的列表指定可能承载可读的辅助副本的所有服务器实例。Use a comma-separated list to specify all the server instances that might host a readable secondary replica. 只读路由遵循在列表中指定服务器实例的顺序。Read-only routing follows the order in which server instances are specified in the list. 如果在副本的只读路由列表中包含副本的主机服务器实例,那么将此服务器实例放在列表末尾通常是一个好的做法,这样,如果有可用的话,读意向连接将转到辅助副本。If you include a replica's host server instance on the replica's read-only routing list, placing this server instance at the end of the list is typically a good practice, so that read-intent connections go to a secondary replica, if one is available.

从SQL Server 2016(13.x)开始,您可以在可读的辅助副本之间负载平衡读意向请求。Beginning with SQL Server 2016 (13.x), you can load-balance read-intent requests across readable secondary replicas. 您可以通过将副本放置在只读路由列表中一组嵌套的圆括号中来指定这一点。You specify this by placing the replicas in a nested set of parentheses within the read-only routing list. 有关更多信息和示例,请参阅跨只读副本配置负载平衡。For more information and examples, see Configure load-balancing across read-only replicas.

注释 NONE

指定当此可用性副本是主副本时,不支持只读路由。Specifies that when this availability replica is the primary replica, read-only routing is not supported.这是默认行为。This is the default behavior.

免责声明:

① 本站未注明“稿件来源”的信息均来自网络整理。其文字、图片和音视频稿件的所属权归原作者所有。本站收集整理出于非商业性的教育和科研之目的,并不意味着本站赞同其观点或证实其内容的真实性。仅作为临时的测试数据,供内部测试之用。本站并未授权任何人以任何方式主动获取本站任何信息。

② 本站未注明“稿件来源”的临时测试数据将在测试完成后最终做删除处理。有问题或投稿请发送至: 邮箱/279061341@qq.com QQ/279061341

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

下载Word文档到电脑,方便收藏和打印~

下载Word文档

编程热搜

目录