SQL Linked server - Remote access error when executing SP

梦想的初衷 提交于 2019-12-08 04:00:43

问题


I've set up a linked server between an instance on SQL 2012 and SQL 2008R2 but I keep getting the below error when trying to execute a stored procedure on a remote server:

 Msg 7201, Level 17, State 4, Line 1
Could not execute procedure on remote server 'TEST' because SQL Server is not configured for remote access. Ask your system administrator to reconfigure SQL Server to allow remote access.

I've checked on both servers and they're configured to allow remote connections. The login that I've used has sysadmin access on the remote server and I can see all the databases when I expand 'Catalogs' within the linked server. When I test the connection this also says it's connected successfully. The SQL Service account also has SA on both instances for what it's worth

The odd thing is when I run a simple select query on one of the tables within the database it shows a result but it doesn't seem to like the SP.

Select * from Linkserver.database.dbo.table 

The above works fine but this SP doesn't:

EXECUTE  Linkedserver.database.[dbo].[SP] ....

Any recommendation would be appreciated.


回答1:


Despite being an old thread, forget about enabling remote access (and restart service) on remote server and try:

EXECUTE (N'database.[dbo].[SP]') AT Linkedserver



回答2:


If you want to run SPs from Server B, then make Server B as the linked server in server A.

Run the script below in Server A, not B:

EXEC sp_configure 'remote access', 1; RECONFIGURE;

Then restart SQL Service in A. Done.




回答3:


Please first check your server properties if remote connections is allowed (related picture below). IF yes, use: exec nameofyourSP 'remote access', 1 reconfigure and try again.




回答4:


First Run:

EXEC sp_configure 'remote access', '1';

RECONFIGURE;

You now need to restart MSSQLSERVER in order for the sp_configure command to take effect.

Once you restart it, run sp_configure again and notice that the run_value is 1 now. That's what you want.



来源:https://stackoverflow.com/questions/36407261/sql-linked-server-remote-access-error-when-executing-sp

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!