Finding external Linkserver Connections

Allen Francis 26 Reputation points
2023-01-25T14:43:00.28+00:00

There is a request from user to find how many external connection comes in as linked server to a database. Highly appreciated for answers

SQL Server Other
{count} votes

4 answers

Sort by: Most helpful
  1. Seeya Xi-MSFT 16,586 Reputation points
    2023-01-26T06:10:40.34+00:00

    Hi Allen Francis,

    You can run this procedure sp_linkedservers to see the list of linked servers defined in the local server.

    Please feel free to let me know if I have misunderstood your meaning.

    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".


  2. Olaf Helper 47,436 Reputation points
    2023-01-26T06:51:06.5633333+00:00

    An access via Linked Server from an other SQL Server is as any other client access, there is no difference.

    If that are dedicated SQL Server without any other app running on it, then you can get them by the server IP address.

    0 comments No comments

  3. Erland Sommarskog 121.4K Reputation points MVP Volunteer Moderator
    2023-01-26T22:29:41.06+00:00

    Yes an incoming connection to specific database. Simple we need to upgrade an instance from sql2012 to sql2019.

    And you are only moving one of the databases on that instance?

    I think the only option is to scan sys.servers in your entire estate for linked server that points to this instance. Now, if there are umpteen databases on this instance, you may find many references that are unaffected, since they relate to other databases on this instance. A linked server can be setup with a certain target database, but that is not always the case. But at least, you can start there.

    As for running a query on all your servers, check out what the friendly people at dbatools.io can offer.

    0 comments No comments

  4. Seeya Xi-MSFT 16,586 Reputation points
    2023-01-27T02:40:56.7666667+00:00

    Hi Allen Francis,

    You can run this query for more detailed information:

    SELECT *
    FROM sys.Servers a
    LEFT OUTER JOIN sys.linked_logins b ON b.server_id = a.server_id
    LEFT OUTER JOIN sys.server_principals c ON c.principal_id = b.local_principal_id
    

    Best regards,

    Seeya


    If the answer is the right solution, please click "Accept Answer" and kindly upvote it. Your contribution is highly appreciated.


Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.