[英]Azure SQL Server Elastic query with ApplicationIntent ReadOnly
I'm using SQL Server Management Studio v18.2* to create an Elastic Query to different Azure databases ( horizontal partitioning ). 我正在使用SQL Server Management Studio v18.2 *创建对不同Azure数据库( 水平分区 )的弹性查询。 The access to the databases must contain the flag
ApplicationIntent=ReadOnly
. 对数据库的访问必须包含标志
ApplicationIntent=ReadOnly
。
I've created the master key and the scoped credentials: 我创建了主密钥和范围凭证:
CREATE MASTER KEY ENCRYPTION BY PASSWORD = 'password'
CREATE DATABASE SCOPED CREDENTIAL stg_credentials
WITH IDENTITY = 'user',
SECRET = 'pass';
And then, I need to create the external data source . 然后,我需要创建外部数据源 。 According to the documentation, the syntax is:
根据文档,语法为:
CREATE EXTERNAL DATA SOURCE <data_source_name>
WITH
( LOCATION = '<prefix>://<path>[:<port>]'
[, CONNECTION_OPTIONS = '<name_value_pairs>']
[, CREDENTIAL = <credential_name> ]
[, PUSHDOWN = ON | OFF]
[, TYPE = HADOOP | BLOB_STORAGE ]
[, RESOURCE_MANAGER_LOCATION = '<resource_manager>[:<port>]'
)
[;]
I'm using the following query: 我正在使用以下查询:
CREATE EXTERNAL DATA SOURCE stg_1 WITH
(TYPE = RDBMS, LOCATION = 'myserver.database.windows.net', CONNECTION_OPTIONS = 'ApplicationIntent=ReadOnly', DATABASE_NAME = 'mydatabase', CREDENTIAL = stg_credentials);
But when executing it, I get the following error, although I'm using the right syntax for that option. 但是在执行它时,尽管我为该选项使用了正确的语法 ,但出现以下错误。
Incorrect syntax near 'CONNECTION_OPTIONS'.
“ CONNECTION_OPTIONS”附近的语法不正确。
Do I need to install any extra components to the SSMS? 我是否需要在SSMS中安装任何其他组件? Is there anything wrong with the syntax?
语法有什么问题吗? Any help would be greatly appreciated.
任何帮助将不胜感激。
* SQL Server Management Studio 15.0.18142.0 Microsoft Analysis Services Client Tools 15.0.1389.0 Microsoft Data Access Components (MDAC) 10.0.17763.1 * SQL Server Management Studio 15.0.18142.0 Microsoft Analysis Services客户端工具15.0.1389.0 Microsoft数据访问组件(MDAC)10.0.17763.1
请安装最新版本的SQL Server Management Studio( v18.2 ),以获得所有Azure SQL Database PaaS产品的最佳体验。
Query across Azure SQL databases completely in T-SQL. 完全在T-SQL中跨Azure SQL数据库查询。 This allows for read-only querying of remote databases and provides an option for current on-premises SQL Server customers to migrate applications using three- and four-part names or linked server to SQL DB.
这允许对远程数据库进行只读查询,并为当前的本地SQL Server客户提供使用三部分和四部分名称或链接服务器将应用程序迁移到SQL DB的选项。
And for Azure SQL database, it doesn't have the Argument "CONNECTION_OPTIONS". 对于Azure SQL数据库,它没有参数“ CONNECTION_OPTIONS”。
You can find this from the document you have provided: Azure SQL Database . 您可以从提供的文档中找到它: Azure SQL数据库 。
You also can reference this document Get started with cross-database queries (vertical partitioning) (preview) . 您也可以参考本文档跨数据库查询入门(垂直分区)(预览) 。 It also give the examples.
它还给出了示例。
External data sources: 外部数据源:
CREATE EXTERNAL DATA SOURCE MyElasticDBQueryDataSrc WITH
(TYPE = RDBMS,
LOCATION = '<server_name>.database.windows.net',
DATABASE_NAME = 'Customers',
CREDENTIAL = ElasticDBQueryCred,
) ;
Update: 更新:
Elastic Query Preview limitations : 弹性查询预览限制 :
Elastic query works with Azure SQL Database only.
弹性查询仅适用于Azure SQL数据库。 You cannot use it for querying on-premises SQL Server, or SQL Server in a VM.
您不能将其用于查询本地SQL Server或VM中的SQL Server。
So you can not connect to a SQL Server on a virtual machine with Elastic Query. 因此,您无法使用Elastic Query连接到虚拟机上的SQL Server。
Hope this helps. 希望这可以帮助。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.