You may occasionally need to enable the “RPC Out” option on a linked server. This option enables RPC to the given server.
RPC stands for Remote Procedure Calls. RPC is basically a stored procedure being run remotely from Server 1 to linked Server 2.
If you don’t enable this and you try to execute a stored procedure on the linked server, you’ll probably get error Msg 7411 telling you that the server is not configured for RPC.
Anyway, you can enable/disable this option either using SQL Server Management Studio (SSMS) or with T-SQL.
In SSMS, you can go to the Linked Server Properties
by right-clicking on the linked server’s name. From there, click on Server Options
, where you’ll see the RPC Out
option set to either True
or False
.
In T-SQL you can use the sp_serveroption
system stored procedure to do the same thing.
Example
Here’s an example of using sp_serveroption
to enable “RPC Out” on a linked server.
EXEC sp_serveroption 'MyLinkedServer', 'rpc out', 'true';
This enables the RPC Out option for the linked server called MyLinkedServer.
Another way of executing this procedure is to explicitly name the parameter names:
EXEC sp_serveroption
@server = 'MyLinkedServer',
@optname = 'rpc out',
@optvalue = 'on';
So you can see that the first argument (@server
) is the name of the linked server, the second (@optname
) specifies the option name, and the third argument (@optvalue
) specifies its value.
That’s all there is to it. RPC Out is now enabled on the linked server.
Check the RPC Out Setting
We can check our RPC out setting with the following code.
SELECT
is_rpc_out_enabled
FROM sys.servers
WHERE name = 'MyLinkedServer';
Result:
+----------------------+ | is_rpc_out_enabled | |----------------------| | 1 | +----------------------+
A value of 1
means that RPC Out is enabled. A value of 0
means that it’s disabled.
Disabling RPC Out
You can use false
instead of true
to disable it.
EXEC sp_serveroption 'MyLinkedServer', 'rpc out', 'false';
Executing that code will disable RPC Out on MyLinkedServer.
You can alternatively use on
and off
instead of true
and false
to toggle this option.