SQL Server Error: Could not execute remote procedu

2019-08-03 00:02发布

问题:

I have three SQL Server 2008 boxes, call them A, B & C. Servers A & B each have a linked server to server C. The linked servers use the exact same linked server setup on both A & B. Both connect to C using the exact same login information. The login has the sysadmin role assigned to it on box C. Both were configured with RPC and RPC OUT set to true. Both can perform SELECT, INSERT, UPDATE, DELETE with no problems whatsoever. C has Allow remote connections and Require distributed transactions checked.

The problem comes when I try to execute stored procedures. A->C works fine, but when I try to run from B, I get the error:

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

I have been completely unable to figure this out. I have checked and rechecked the linked server configurations. They are identical on both A & B. I have run test after test and every one works fine from A, but B always gives the error.

回答1:

When a stored procedure is executed, it runs as the security context of the user who created the stored procedure, not the user who is executing it. It is considered a security feature.

It may be that the account used to create the stored procedure on server B does not have the correct rights while the account used to create the stored procedure on server A does.

Recreating the stored procedure on B with another account may solve the problem.