如何启用即席分布式查询

问题描述 投票:0回答:5

当我在 SQL Server 2000 中使用

OPENROWSET
运行查询时,它可以工作。

但是 SQL Server 2008 中的相同查询会生成以下错误:

SQL Server 阻止访问组件“临时分布式查询”的语句“OpenRowset/OpenDatasource”,因为该组件作为该服务器安全配置的一部分被关闭。系统管理员可以通过使用 sp_configure 启用“临时分布式查询”

sql sql-server-2008
5个回答
253
投票

以下命令可能会帮助你..

EXEC sp_configure 'show advanced options', 1
RECONFIGURE
GO
EXEC sp_configure 'ad hoc distributed queries', 1
RECONFIGURE
GO

17
投票

您可以检查以下命令

sp_configure 'show advanced options', 1;
RECONFIGURE;
GO  --Added        
sp_configure 'Ad Hoc Distributed Queries', 1;
RECONFIGURE;
GO

SELECT a.*
FROM OPENROWSET('SQLNCLI', 'Server=Seattle1;Trusted_Connection=yes;',
     'SELECT GroupName, Name, DepartmentID
      FROM AdventureWorks2012.HumanResources.Department
      ORDER BY GroupName, Name') AS a;
GO

或者这个文档链接


5
投票

如果“不支持”对系统目录的临时更新,或者如果您收到“Msg 5808”,那么您将需要像这样配置覆盖:

EXEC sp_configure 'show advanced options', 1
RECONFIGURE with override
GO
EXEC sp_configure 'ad hoc distributed queries', 1
RECONFIGURE with override
GO

3
投票
sp_configure 'show advanced options', 1;
GO
RECONFIGURE;
GO
sp_configure 'Ad Hoc Distributed Queries', 1;
GO
RECONFIGURE;
GO

0
投票

15281,16 楼,1 号州,21 号线 SQL Server 阻止了对组件“临时分布式查询”的语句“OpenRowset/OpenDatasource”的访问,因为该组件作为该服务器安全配置的一部分被关闭。系统管理员可以使用 sp_configure 启用“临时分布式查询”。有关启用“临时分布式查询”的详细信息,请在 SQL Server 联机丛书中搜索“临时分布式查询”。

EXEC sp_configure '显示高级选项', 1 重新配置并覆盖 去 EXEC sp_configure '临时分布式查询', 1 重新配置并覆盖 去吧

这对我不起作用 我正在使用 MSSQL destop 2020 和 2019 SQL 管理? 我可能只是DBO

如有任何帮助,我们将不胜感激! 谢谢你

© www.soinside.com 2019 - 2024. All rights reserved.