English 中文(简体)
Any overhead using SQL Linked Servers between databases on the same server?
原标题:

We re looking to iron out issues in our different dev/test/prod environments.

Currently we have to remember to change the name of linked servers in stored procedures when we migrate from UAT into Production. For example, in Production, a sproc in SMOLDB calls across a linked server to LS_AUTH.AuthenticationDB.dbo.SomeSproc because AuthenticationDB is on a different server. But in Dev and UAT SMOLDB and Authentication are on the same server.

To get around this risk, we re thinking we ll set up consistent references to linked servers in all our environments. So even in UAT we d create a LS_AUTH linked server, and SMOLDB will still call LS_AUTH.AuthenticationDB.dbo.SomeSproc

Do calls to linked servers go out onto the network before they are resolved? Not sure if we want to impact network traffic in those cases when the two databases are on the same server and don t need to go through a Linked Server.

The idea of ServerVariables I guess is an option...

最佳回答

In SQL server you can also use synonyms to get around that problem. Use synonyms in queries and stored procedures, and just prepare synonyms for production server.

问题回答

We use linked servers to do exactly that, on both the production and test servers. We never noticed any performance overhead. The traffic certainly does not go over the network.

This may not work for you, but we had similar issues here. In our production environment, we have 2 servers, each with 1 DB. We used linked servers to go back and forth between the 2.

Now, in our testing/dev environments, we went with 2 SQL server instances; MYSERVERLIVEDB and MYSERVERLOCALDB. This allowed us to set up linked servers exactly like how we have in production.

As far as performance goes; we didn t notice anything out of the ordinary.





相关问题
Export tables from SQL Server to be imported to Oracle 10g

I m trying to export some tables from SQL Server 2005 and then create those tables and populate them in Oracle. I have about 10 tables, varying from 4 columns up to 25. I m not using any constraints/...

SQL server: Can NT accounts be mapped to SQL server accounts

In our database we have an SQL server account that has the correct roles to access some of the databases. We are now switching to windows authentication and I was wondering if we can create a NT user ...

SQL Server 2000, ADO 2.8, VB6

How to determine if a Transaction is active i.e. before issuing Begin Transaction I want to ensure that no previous transaction are open.. the platform is VB6, MS-SQL Server 2000 and ADO 2.8

热门标签