SQL Server AlwaysOn 可用性组副本只读设置
栏目: 数据库 · SQL Server · 发布时间: 8年前
内容简介:SQL Server AlwaysOn 可用性组副本只读设置
SQL Server AlwaysOn 可用性组副本是允许只读的,默认情况下不可读。
其中副本的可读性有几个选项:
NO : 不可连接到副本数据库,因此也不可读。默认设置。
Read-intent only:只有限定 “read-only” 时才能访问数据库,但只读。
Yes:所有连接都有可访问数据库,但只读。
如果设置为 “Read-intent only” ,客户端查询该数据库对象时提示以下错误:
Msg 976, Level 14, State 1, Line 1
The target database, 'TestDB',
is participating in an availability group and is currently not accessible for queries.
Either data movement is suspended or the availability replica is not enabled for read access.
To allow read-only access to this and other databases in the availability group,
enable read access to one or more secondary availability replicas in the group.
For more information, see the ALTER AVAILABILITY GROUP statement in SQL Server Books Online.
若设置为 “Read-intent only” ,又打算可读副本数据库数据,客户端连接设置如下:
连接时加上 ReadOnly 参数: ApplicationIntent=ReadOnly
其他程序连接设置如: ApplicationIntent=readonly
("Driver={SQL Server Native Client 11.0};server=AGListener;Database=dbname;trusted_connection=yes;ApplicationIntent=readonly”)
使用 sqlcmd 工具连接需要设置参数 “-K”
sqlcmd -SAGListener -E -dDBName -Kreadonly
若都允许只读,选择 “Yes” 即可更改,或使用命令更改:
- USE [master]
- GO
- ALTER AVAILABILITY GROUP [AGName]
- MODIFY REPLICA ON N'InstanceName' WITH (SECONDARY_ROLE(ALLOW_CONNECTIONS = ALL))
- GO
参考:
将连接字符串关键字用于 SQL Server Native Client
onnect to SQL Server AlwaysOn replica with SSMS when Readable Secondary is set to Read-intent only
本文永久更新链接地址 : http://www.linuxidc.com/Linux/2017-05/143922.htm
以上就是本文的全部内容,希望对大家的学习有所帮助,也希望大家多多支持 码农网
猜你喜欢:- 如何提升系统可用性?
- WebP 可用性探测
- 持续交付与可用性
- 可用性高达5个9!支付系统高可用架构设计实战
- 浪潮InCloud OpenStack:度量可用性“三维”,实现高可用云环境
- 特征工程:特征设计、特征可用性评估
本站部分资源来源于网络,本站转载出于传递更多信息之目的,版权归原作者或者来源机构所有,如转载稿涉及版权问题,请联系我们。
我看电商3:零售的变革
黄若 / 电子工业出版社 / 2018-4 / 49
在《我看电商3:零售的变革》之前,黄若先生的“我看电商”系列图书《我看电商》《再看电商》《我看电商2》,均为行业畅销书。黄若先生的图书有两大特如一是干货满满,二是观点鲜明。 “新零售”是眼下的热门词。在2017年里,数以万计的企业以“新零售”作为标识进入市场。但是社会上对“新零售“存在着各种模糊的定义和不尽相同的解读。 《我看电商3:零售的变革》中明确提出:新零售不应过分关注于渠道形式......一起来看看 《我看电商3:零售的变革》 这本书的介绍吧!