Enable RPC over SQL link

  • Hello,

    Is it possible to enable RPC over an SQL link? What i am attempting to do is this:

    select * from openquery("server1",'EXECUTE(''sp_serveroption ''''server2'''', ''''rpc out'''', ''''TRUE'''''') AT "server2";')

    I am a member of SYSADMINS group on the server, so it is not a permission issue I think. But i get the following error:

    "Server2 is not configured for RPC".

    So it seems like RPC must be enabled to run this command. So kind of a Catch22 scenario.

    Must I have direct access to the server to enable RPC?

    Thanks in advance.

  • look at the properties of the linked server you are using and enable the RPC options

  • One thing to watch out for is with your linked server, are you passing your credentials along OR using a hard-coded username and password?

    If it is hard coded, that account will need permissions to run the command on the remote server.  Also, if it is hard coded, make 110% sure that hard coded account ONLY has access to things that need to be run.  And NEVER EVER EVER have a hard coded sysadmin account on a linked server with RPC enabled.

    But to  answer your first question - if RPC is disabled on the server, you cannot use RPC to turn it on.  You will need to connect to the server directly to turn it on.  If your car keys are locked in your trunk, you cannot use those keys to unlock your trunk to get your keys back as you have no access to your keys.  BUT if you were in the trunk, you could get your keys.  Similar idea here.  If you are outside of "server2" you cannot turn RPC on without first connecting to server2.

    The above is all just my opinion on what you should do. 
    As with all advice you find on a random internet forum - you shouldn't blindly follow it.  Always test on a test server to see if there is negative side effects before making changes to live!
    I recommend you NEVER run "random code" you found online on any system you care about UNLESS you understand and can verify the code OR you don't care if the code trashes your system.

Viewing 3 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic. Login to reply