Learning Linked Servers - Why would a database be linked to itself

Frederick Goodrum 20 Reputation points
2023-03-08T17:55:17.5833333+00:00

I was looking into an old copy of Biztalk and noticed that the default install linked the SQL Server database to itself. My question is why might this have been done?

I'm assuming there was a performance reason and would like to know of any whitepaper or other reference that would describe this design.

Microsoft BizTalk Server
Microsoft BizTalk Server
A family of Microsoft server products that support large-scale implementation management of enterprise application integration processes.
358 questions
SQL Server
SQL Server
A family of Microsoft relational database management and analysis systems for e-commerce, line-of-business, and data warehousing solutions.
13,214 questions
SQL Server Integration Services
SQL Server Integration Services
A Microsoft platform for building enterprise-level data integration and data transformations solutions.
2,503 questions
{count} votes

Accepted answer
  1. Seeya Xi-MSFT 16,461 Reputation points
    2023-03-09T01:49:27.9533333+00:00

    Hi @Frederick Goodrum ,

    Please refer to this similar thread:

    https://dba.stackexchange.com/questions/62580/loopback-linked-server

    Hope this would give you some help.

    Best regards,

    Seeya


    If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".

    1 person found this answer helpful.
    0 comments No comments

3 additional answers

Sort by: Most helpful
  1. Michael Taylor 50,591 Reputation points
    2023-03-08T19:25:17.8533333+00:00

    Refer to this discussion in the docs about why a loopback linked server could be useful.

    In general, no, you shouldn't be using loopback linked servers (or ideally linked servers at all). There is a performance hit, not gain by using linked servers. However linked servers can provide a level of indirection in the database in the rare case you need it. For example suppose that you needed data from another database. If the databases are on the same server you could just reference the other DB. But that might be the case across your environments. For example maybe your development environment has multiple databases on the same server so direct references would be fine. But in production your databases reside on different servers. In that case a linked server might be a way to indirectly reference the other DB. In dev it points to itself but in prod it points to the other server. Because it is hidden behind a synonym the actual DB code doesn't have to change, just the linked server reference.

    Linked servers may also be useful during migrations when you're splitting a larger database into smaller one's, or perhaps moving from one server to another piecemeal. In all cases you should avoid using linked servers if possible but if you really need the indirection then that is what they are there for.

    I cannot answer to why an older version of BizTalk would be using it. Perhaps they needed it for indirection.

    2 people found this answer helpful.
    0 comments No comments

  2. Erland Sommarskog 105.8K Reputation points MVP
    2023-03-08T22:17:21.25+00:00

    Adding to Michaels post, another reason for loopback servers is that you want autonomous transactions. Say that you you want to log a progress message to a table. And you are working inside a transaction. Furthermore, you want those log messages to remain in the table, even if the transaction fails and is rolled back. One way to achieve this is to set up a loopback server, and configure not to promote the local transaction to be distributed.

    1 person found this answer helpful.
    0 comments No comments

  3. Frederick Goodrum 20 Reputation points
    2023-03-13T16:56:20.4266667+00:00

    Thank you very much for the answers. I found all three extremely helpful and clear. I Selected the Link to Stack exchange as it provided a very detailed response and links to additional discussions on this topic.

    0 comments No comments