I have personally seen when people use Linked Server there are a number of issues from authentication to performance. These issues are part of working with something that has so many variations and permutations of actually going wrong. Many a times I suggest people to keep away from it as much as possible. But it cannot happen all the times and there are code blocks in their application that relies on this as a requirement.
This is one of the common error I see in various forums. When someone is new to SQL Server and tried to create a linked server, he/she would just give server name and choose SQL Server as server type and hit OK. But SSMS would provide below error
TITLE: Microsoft SQL Server Management Studio
——————————
The linked server has been created but failed a connection test. Do you want to keep the linked server?
——————————
ADDITIONAL INFORMATION:
An exception occurred while executing a Transact-SQL statement or batch. (Microsoft.SqlServer.ConnectionInfo)
——————————
The OLE DB provider “SQLNCLI11” for linked server “BIGPINAL” reported an error. Authentication failed.
Cannot initialize the data source object of OLE DB provider “SQLNCLI11” for linked server “BIGPINAL”.
OLE DB provider “SQLNCLI11” for linked server “BIGPINAL” returned message “Invalid authorization specification”. (Microsoft SQL Server, Error: 7399)
——————————
BUTTONS:
&Yes
&No
——————————
Above message has two messages
- A Question: The linked server has been created but failed a connection test. Do you want to keep the it?
- An Error: Microsoft SQL Server, Error: 7399 – The OLE DB provider “%ls” for linked server “%ls” reported an error. %ls
We can click Yes and linked server would be created but it won’t work. Once we click on Test Connection as shown below – we would get same error what we got during creation.
To fix this problem, we need to understand little about connectivity and authentication. Whenever we connect to SQL, there are two ways
- SQL Authentication: To use this, we need to provide login name and password while connecting to SQL Server. These account are stored within SQL Server.
- Windows Authentication: While using Windows operating system, we can use logged in account to SQL and it would allow us to connect to SQL Server without providing password because we have already logged into operating system and have been authenticated by Windows.
When the linked server is created, the default values under security is “Be made without using a security context” – this is the cause of the problem.
Solution: Choose one of the two from below highlighted.
Have you seen this earlier? How would you provide windows account here? What are your opinion? Do let me know via comments below.
Reference: Pinal Dave (http://blog.SQLAuthority.com)
First appeared on SQL SERVER – FIX – Linked Server Error 7399 Invalid authorization specification