debugMinor
SQL Server - Linked Server error - Could not connect to server XYZ because
Viewed 0 times
errorconnectsqlxyzcouldbecauseserverlinkednot
Problem
Server being used: SQL Server 2012 SP3
I just received a strange error (strange because it worked earlier)
Not sure why we are receiving the error.
The sys.servers says is_linked = 0 for LNK_SRV - not sure why.
The following returns results
But the procedures are failing
It was working fine before we dropped the linked server and re-added it.
Also, the LNK_SRV is being used as for replication as well.
Note: I am aware sa is bad. It will be taken care soon.
I just received a strange error (strange because it worked earlier)
could not connect to server LNK_SRV because sa is not defined as a remote loginNot sure why we are receiving the error.
The sys.servers says is_linked = 0 for LNK_SRV - not sure why.
The following returns results
select top 10 * from LNK_SRV.DBName.dbo.TblNameBut the procedures are failing
exec LNK_SRV.DBName.dbo.ProcNameIt was working fine before we dropped the linked server and re-added it.
Also, the LNK_SRV is being used as for replication as well.
Note: I am aware sa is bad. It will be taken care soon.
Solution
The linked server was also used for replication.
The order of Subscribe and Create linked server was the issue.
Reproduce the error:
Fix:
Also, executing the following on Linked Server worked as well.
The order of Subscribe and Create linked server was the issue.
Reproduce the error:
- Drop the subscription
- Drop the linked server
- Configure the Subscription first
- Linked Server next
- Testing
- a. Select will return results
- b. Exec proc result in error
Fix:
- Drop the subscription
- Drop the Linked Server
- Create the Linked Server first
- Configure the Subscription next
- Testing
- a. Select will return results
- b. Exec proc will succeed
Also, executing the following on Linked Server worked as well.
--Run this statement on LNK_SRVR
exec sp_AddRemoteLogin 'CurrServer','sa'Code Snippets
--Run this statement on LNK_SRVR
exec sp_AddRemoteLogin 'CurrServer','sa'Context
StackExchange Database Administrators Q#170914, answer score: 5
Revisions (0)
No revisions yet.