Fix it now
Error 7399 is published as the OLE DB provider for the linked server reporting an error, followed by the provider’s own message, and 7303 as being unable to initialise the data source object. The useful information is never in the numbers: it is in the sentence underneath, and in which account actually made the connection.
SELECT name, provider, data_source FROM sys.servers;
SELECT s.name, l.remote_name, l.uses_self_credential
FROM sys.servers s
JOIN sys.linked_logins l ON s.server_id = l.server_id;
SELECT auth_scheme FROM sys.dm_exec_connections WHERE session_id = @@SPID;
- Read the whole message, not the first line. The provider’s own text sits under the 7399 and names the real problem.
- Check who connects. If the linked server uses the login’s current security context, you depend on Kerberos delegation and are probably hitting a double hop; the third query tells you whether your own connection is even using Kerberos.
- Test that theory by switching temporarily to a fixed remote login you know works and rerunning the query. If it now works, the problem is authentication and not the provider.
- If the message names a provider, data source or file rather than a login, confirm the provider is installed on the SQL Server machine with the same architecture as the instance, and that any file path is a UNC path the service account can read.
Error 7416 is published as access being denied because no login mapping exists. That is unusual, because creating a linked server also creates a default mapping for all logins, so seeing it means the default was dropped or replaced.
If the four-part-name query returns rows for an ordinary login, stop here. If not, the next section works through the provider and the identity separately.
Why it happens
A linked server is SQL Server hosting somebody else’s OLE DB provider. Using a four-part name loads that provider, hands it a connection string and asks it for rowsets. Anything the provider returns as an error is repackaged as 7399 with the provider’s own text attached, which is why 7399 is a category rather than a diagnosis. The sentence after it is the actual error, and skipping past it is the single most common reason people troubleshoot the wrong thing.
Error 7303 narrows the picture: the provider loaded but could not create a usable data source from what it was given. Bad credentials, an unreachable server name, or a file-based provider that cannot open its file all end here. Error 7302 is one step earlier again, published as being unable to create an instance of the provider at all. Microsoft names three causes for that one: the provider or driver is not installed on the server, the installed provider’s architecture does not match SQL Server, or it is installed but not properly registered.
Architecture matters because providers load inside the SQL Server process by default, so a 64-bit instance can only load a 64-bit provider. Installing the driver on your workstation proves nothing; it has to be on the machine running the instance, and it has to match that instance rather than the file you are reading.
The other half of the picture is identity. Under an explicit mapping the remote server sees the mapped login. Under the caller’s own context SQL Server must forward your Windows credential a second time, and the remote side refuses that unless Kerberos delegation is configured for it. That is why the same query works in a remote desktop session on the server and fails from your own machine: one hop against two.
The double hop: your credential cannot be forwarded
You have this one if The query works when you run it on the SQL Server itself and fails from your own machine.
- Confirm the first hop uses Kerberos:
SELECT auth_scheme FROM sys.dm_exec_connections WHERE session_id = @@SPID;should return KERBEROS, not NTLM. - If it returns NTLM, the service principal name is missing or duplicated; have the domain team check what is registered for the SQL Server service account.
- Grant the SQL Server service account constrained delegation to the remote SQL Server service, then restart the service and retest.
Delegation is an Active Directory change owned by your domain team, not something you set from Management Studio. If it cannot be arranged, an explicit login mapping is the supported alternative.
There is no login mapping for the caller
You have this one if Error 7416, or the remote server rejecting a login you never configured. Sysadmins work and ordinary users do not.
- Read what exists from
sys.serversjoined tosys.linked_logins, paying attention touses_self_credential. - Add the mapping you need:
EXEC sp_addlinkedsrvlogin @rmtsrvname = N'LINKEDSRV', @useself = N'FALSE', @locallogin = N'DOMAIN\User', @rmtuser = N'remoteuser', @rmtpassword = N'...'; - Remove wrong entries with
sp_droplinkedsrvloginand retest.
Creating the linked server also creates a default mapping equivalent to @useself = true for every login, so 7416 means somebody removed or replaced that default.
The provider is missing, unregistered or the wrong architecture
You have this one if Error 7302, or a message about a class not being registered. The same definition works on another server where the driver is installed.
- Read the provider name from
sys.serversand confirm it appears in Management Studio under Server Objects, Linked Servers, Providers. - Install the build of the driver that matches the instance’s architecture, on the SQL Server machine rather than on your workstation.
- Restart the SQL Server service so the provider is loaded, then retest.
The provider loads but cannot open the source
You have this one if Error 7303 with a message naming a server, data source or file rather than a login.
- For SQL Server targets, confirm the instance name and port, and that either SQL Server Browser or an explicit port is available.
- For file targets, use a UNC path. Mapped drive letters are per-session and do not exist for a service.
- Grant the SQL Server service account read access, and write if you update, on both the share and the file system permissions.
If a provider misbehaves in-process, the option that runs it out of the SQL Server process is on the provider’s properties page. Some providers only work one way round, so change one setting at a time and write down what you changed.
The failure is not a linked server at all
You have this one if The message names no linked server, and the call was an ad hoc one rather than a four-part name.
- Look at the connection details inline in the query, since that is where they live for an ad hoc call.
- Confirm ad hoc distributed queries are permitted on this instance if that is the route you intend to use.
- Consider defining a linked server instead, so the credentials and provider options are configured once rather than per query.
Full reference
Matching the message to the fault
| What the message mentions | Where the fault is |
|---|---|
| A login, or a failed login for an empty account | Security mapping, or a double hop |
| A class that is not registered | The provider is missing, unregistered or the wrong architecture: 7302 |
| A file or a path | The service account cannot reach it, or it is a mapped drive |
| A server name or port | The target instance: 7303 |
| Access denied because no login mapping exists | 7416: the default mapping has been removed or replaced |
Commands that answer one question each
| Command | What it gives you |
|---|---|
SELECT name, provider, data_source FROM sys.servers; |
Which provider each linked server uses, and what it points at |
sys.servers joined to sys.linked_logins |
Which local logins map to which remote name, and which use their own credential |
SELECT auth_scheme FROM sys.dm_exec_connections WHERE session_id = @@SPID; |
Whether your own connection is using Kerberos or NTLM |
EXEC sp_addlinkedsrvlogin ... |
Creates or replaces a mapping |
EXEC sp_droplinkedsrvlogin ... |
Removes a mapping, including the default one |
How the mapping actually resolves
- Creating a linked server also creates a default mapping: every local login connects using its own credentials.
- An explicit mapping for a specific local login overrides that default for that login.
- With
@useself = true, the remote user and password are ignored and the login’s own credentials are used. - With
@useself = false, the remote user and password are used for that local login. - If the default has been dropped and no explicit mapping covers the caller, you get 7416.
Installing a provider and restarting the SQL Server service is downtime for every database on that instance, not just the one running the query. Schedule it rather than doing it while people are connected.
Choosing between delegation and a fixed account
- A fixed remote account is simpler, works across trust boundaries, and is a legitimate choice.
- It costs you auditing, because every query arrives remotely as one login, and it leaves a stored password inside your instance.
- Delegation preserves per-user identity remotely and needs Active Directory changes you do not own.
- Whichever you choose, give the remote account least privilege and rotate its password with everything else.
- Do not mix the two on one linked server without writing down which logins take which path.
File-based sources, which behave differently
Spreadsheet and desktop-database sources fail in their own way because the provider has to open a file as the service account. Use a UNC path rather than a drive letter, grant the service account rights on both the share and the file system, and install the driver whose architecture matches the instance rather than the one that matches the file. If the provider misbehaves inside the SQL Server process, the out-of-process option on its properties page is the supported place to change that.
Every code this article covers
| Code | What it points at | Source |
|---|---|---|
7399 |
The OLE DB provider for the linked server reported an error, followed by the provider’s own message, which is the actual diagnosis | Microsoft Learn |
7303 |
Cannot initialise the data source object of the OLE DB provider for the linked server | Microsoft Learn |
7302 |
Cannot create an instance of the OLE DB provider; Microsoft names three causes – not installed, an architecture mismatch with SQL Server, or installed but not properly registered | Microsoft Learn |
7416 |
Access to the remote server is denied because no login mapping exists | Microsoft Learn |
Confirm the fix worked
- A four-part-name SELECT returns rows for an ordinary application login, not only for a sysadmin.
- The same query works from a client workstation, not only from a session on the server itself.
sys.linked_loginsshows the mapping you intended and no leftovers.- If you depend on delegation,
auth_schemereads KERBEROS on the first hop. - The provider appears under Server Objects, Linked Servers, Providers on the SQL Server itself.
Questions people ask about this
Why does the message sometimes name no linked server at all?
Because the failure came from an ad hoc call rather than a defined linked server, so there is no name to print. The connection details are inline in the query, which is where to look.
Does any of this need a purchase?
No. Login mappings, service principal names, delegation and provider options are all configuration. The only thing you may need to install is a driver redistributable, which is a free download.
Why does it work in SSMS on the server but not from my PC?
On the server your credential is used directly, one hop. From your PC it travels two hops, and Windows will not forward a credential a second time unless delegation is configured.
Should I just use a fixed account instead of fixing Kerberos?
It is a legitimate and common choice. The trade-offs are auditing, since every query arrives remotely as one login, and a stored password you now own. If per-user identity matters remotely, fix delegation instead.
I get 7416 and I never configured any mapping. How is that possible?
Creating a linked server also creates a default mapping in which every login connects with its own credentials. Error 7416 means that default has been dropped or replaced by something that does not cover the caller, so add an explicit mapping or restore the default.
