简体   繁体   中英

Is it possible to connect to a local SQL Server from a Remote server?

My requirement is to retrieve data from a local SQL server and store that data in remote server. I would like to get the data from the local SQL Server and use that data in my application to proceed further.

Yes, see Create linked server with SQL command .

You can create the linked server either locally (I'd recommend that) or remotely

If you mean you want your remote server to execute queries on the local one then yes, but... Setting this up is a fair bit of work and if I remember rightly needs a hefty amount of privileges on the remote server.

Might be easier to set up the linked server locally. NB assumes the account the local server is running as can reach the remote machine, and can access it.

I'd be a bit nervous about doing this, internally for fear of some admin type breaking it, if it's over the internet, then securing it will be a nightmare even if they allowed their server to be accessed directly..

You might find it easier to do it via the client, though that will dpend on how much data you want to synchronise, and then perhaps a briefcase approach might do the job better.

You can set up linked servers either via the GUI in SSMS, or via scripts. A couple of things to look out for though - first make sure you create a login account on each server that is mapped to the appropriate database on each server, with the least possible permissions. Then verify the mapping after you've set it up. Be aware that you are opening up the attack surface via this solution, so you may want to have your admin set up auditing too.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM