After joining a new organization, one day an application support came to ask brief information about all the SQL Server linked servers and few more important configuration details.
They were looking to upgrade their application and database. In order to know all possible sources of their data feed, the guy needed this information.
Most of the information could have been taken by running sp_linkedservers but because login information was also required I preferred to run following query to collect the required data.
SELECT
srv.name as LinkedServerName
,srv.product
,srv.provider
,srv.data_source
,srv.catalog
,sp.name
,lgn.uses_self_credential
,lgn.remote_name remote_login_in_use
FROM
sys.serversAS srv JOIN sys.linked_loginsAS lgn
ON srv.server_id = lgn.server_idAND srv.is_data_access_enabled= 1
LEFTJOINsys.server_principalsAS sp ON lgn.local_principal_id= sp.principal_id
Image may be NSFW.
Clik here to view.
WHAT IS actual data source Server Name
Although they got the information, but they could not recognize the actual server names as highlighted in thesrv_data_source column. All they said that, the linked servers were created by DBAs.
- I tried to ping these names from my user desktop, but could not Ping request could not find host.
- Tried to check the SQL Server Aliases but there were no alias defined for any of the server names.
- Finally I looked into the host file and found the entries. The ping from my desktop did not work because the host file entries are local to the database server. Because SQL Server instance is sitting on the same server where the names are entered into the host file, it was able to resolve the host names. Also Ping from the database server worked. The host file looked like as below (C:\Windows\System32\drivers\etc)
Image may be NSFW.
Clik here to view.
Hope this information helps you!!.
Warm Regards, Ajay