[英]Using linked server returns error - “Cannot obtain the schema rowset for OLE DB provider”
I tried to move data aka ETL from one sql server to another as mentioned in a previous question - Copy data from one column into another column . 如上一个问题所述,我试图将ETL数据从一台sql服务器移动到另一台sql服务器- 将数据从一列复制到另一列 。 Now, I get an error when I try to execute a query.
现在,当我尝试执行查询时出现错误。
Query - 查询-
INSERT INTO [Target_server].[Target_DB1].[dbo].[Target_Table1](Target_Column1)
SELECT Source_Column222
FROM [Source_server].[Source_DB1].[dbo].[Source_Table1]
WHERE Source_Column1 = 'ID7162'
Error - 错误-
OLE DB provider "SQLNCLI" for linked server "MYLINKEDSERVER" returned message "Unspecified error".
OLE DB provider "SQLNCLI" for linked server "MYLINKEDSERVER" returned message "The stored procedure required to complete this operation could not be found on the server. Please contact your system administrator.".
Msg 7311, Level 16, State 2, Line 1
Cannot obtain the schema rowset "DBSCHEMA_TABLES_INFO" for OLE DB provider "SQLNCLI" for linked server "MYLINKEDSERVER". The provider supports the interface, but returns a failure code when it is used.
If your wrote that simple select is not working, the issue is in security configuration of the linked server and permissions which your user receive there. 如果您写的简单选择不起作用,则问题出在链接服务器的安全配置和用户在此处获得的权限。
Among this, when you execution your query, you don't need to specify the server name and DB name for both parts - source and target. 其中,执行查询时,无需为源和目标这两个部分都指定服务器名称和数据库名称。 You simply need to execute the query on target server and target database.
您只需要在目标服务器和目标数据库上执行查询。 In this case your query instead of
在这种情况下,您的查询而不是
INSERT INTO [Target_server].[Target_DB1].[dbo].[Target_Table1](Target_Column1)
SELECT Source_Column222
FROM [Source_server].[Source_DB1].[dbo].[Source_Table1]
WHERE Source_Column1 = 'ID7162'
will looks like the following: 将如下所示:
INSERT INTO [dbo].[Target_Table1](Target_Column1)
SELECT Source_Column222
FROM [Source_server].[Source_DB1].[dbo].[Source_Table1]
WHERE Source_Column1 = 'ID7162'
and you need your connection to be opened on server [Target_server]
and database [Target_DB1]
. 并且您需要在服务器
[Target_server]
和数据库[Target_DB1]
上打开连接。 Also the linked server security properties need to be checked on [Target_server]
against the [Source_server]
. 另外,链接服务器的安全性需要对被检查
[Target_server]
反对[Source_server]
If you are using loop back linked server (linked server refering to the same database in the same server) then refer the below mentioned link: 如果您正在使用回送链接服务器(链接服务器引用同一服务器中的同一数据库),则请参考以下链接:
Transaction with loopback linked server - locking issues 与环回链接服务器进行事务处理-锁定问题
If that is not the case, this is the solution provided by Microsoft. 如果不是这种情况,则这是Microsoft提供的解决方案。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.