How to fix Linked Server from SQL Server 2016 to Oracle 12c? - sql-server

I set up a few weeks ago a linked server in my sql server 2016 to my oracle 12c following this guide. It was working properly, but after some windows updates that restarted my machine, it no longer works. I can log into oracle properly through sqlplus and sql developer, but not through sql server. I get the following error:
OLE DB provider "OraOLEDB.Oracle" for linked server "LINKED_ORACLE" returned message "ORA-12154: TNS:could not resolve the connect identifier specified".
Msg 7303, Level 16, State 1, Line 1
Cannot initialize the data source object of OLE DB provider "OraOLEDB.Oracle" for linked server "LINKED_ORACLE".
I restarted the SQL Server service, as well as restarted windows again, but still same error. What could have changed in a single restart? How can I fix it and get the linked server working again?

For some reason, SQL SERVER was properly reading the tnsnames.ora file before the restart, but after the restart it stopped. I had to recreate the linked server, and put the whole connection string in the Data Source field for it to work again.
Sample Data Source found here:
Data Source=(DESCRIPTION=(CID=GTU_APP)(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(HOST= server01.mydomain.com)(PORT=1521)))(CONNECT_DATA=(SID=OracleDB)(SERVER=DEDICATED)));

Related

Unable to connect from RHEL SQL Server to Windows SQL Server Linked Instance

I setup 3 exactly similar Dell rack servers with RHEL 8.3 and Sql Server 15.0.4102.2. There was an existing windows sql server that I added to all 3 RHEL sql server instances as a linked server using the exact same script on all 3 RHEL sql servers. 2 of the servers work fine, the third fails with the following error message every time:
Named Pipes Provider: Could not open a connection to SQL Server [2].
OLE DB provider "MSOLEDBSQL" for linked server "remserver" returned message "Login timeout expired".
OLE DB provider "MSOLEDBSQL" for linked server "remserver" returned message "A network-related or instance-specific error has occurred while establishing a connection to SQL Server. Server is not found or not accessible. Check if instance name is correct and if SQL Server is configured to allow remote connections. For more information see SQL Server Books Online.". (.Net SqlClient Data Provider)
Port 1433 is open on all 3 and remember 2 of the exactly similar servers work perfectly fine, allowing me to connect to the remote windows linked server just fine.
What I am looking for is some advice as to where I should start debugging things. A weird thing is that I was able to run Red-Gate's SQL Pro Compare tool to deploy the database from remserver to the 3rd server just fine, so I think Sql Server on the 3rd server is installed correctly. I just cannot connect to the linked remserver from the 3rd sql server.
Thanks, Don Bouchard
Sorry, I was trying everything I could think of and I stumbled upon what it was which was because of a DNS misconfiguration. A simple ping to the remserver name showed me the problem.

TSQL Having trouble adding a linked SQL Server 2008 R2 to SQL Server 2000

I'm having trouble trying to create a Linked Server to connect from a SQL Server 2008 R2 instance to a SQL Server 2000 instance using Windows Auth.
I can connect to SQL Server 2000 with SSMS with Windows Auth so network and user permissions should be OK.
Here's what I'm using so far
EXEC master.dbo.sp_addlinkedserver
#server = N'SalesLogix_db'
,#srvproduct=N'SalesLogix_db'
,#provider=N'SQLNCLI'
,#datasrc=N'xxx.xxx.xxx.xxx'
GO
--Windows Authentication
EXEC master.dbo.sp_addlinkedsrvlogin
#rmtsrvname=N'SalesLogix_db'
,#useself=N'True'
,#locallogin=NULL
,#rmtuser=NULL
,#rmtpassword=NULL
GO
EXEC master.dbo.sp_testlinkedserver SalesLogix_db;
And this is the error.
OLE DB provider "SQLNCLI10" for linked server "SalesLogix_db" returned message "Login timeout expired".
OLE DB provider "SQLNCLI10" for linked server "SalesLogix_db" returned message "A network-related or instance-specific error has occurred while establishing a connection to SQL Server. Server is not found or not accessible. Check if instance name is correct and if SQL Server is configured to allow remote connections. For more information see SQL Server Books Online.".
Msg 53, Level 16, State 1, Line 24
Named Pipes Provider: Could not open a connection to SQL Server [53].
Where am I going wrong?
Thanks in advance
+1, I got the exact same error message today in a similar setup (sql 2008 R2 server linking to a sql 2008 server). I had existing linked servers which worked fine, but all of a sudden stopped working (exact same error message as you).
I narrowed it down to a batch of recent Windows Security Updates (~14 of them) on the linked server (running windows 2008 R2). I ended up rolling back those updates which resolved the issue temporarily.
At this point, I'm trying to figure out which one of these updates (KBxxxx) is the exact culprit.
After much toing and froing I finally found the answer.
I was failing with double-hop authentication failure.
When I created the Linked Server using SSMS on the db server itself it worked.

How to create linked server from SQL Server 2014 to SQL Server 2012

I have two machines one is running SQL Server 2014 (Machine A) and the other one SQL Server 2012 (Machine B). Machine A has storage limitation and hence I decided to leave all databases on the Machine B so I can connect and use data from Machine A.
I set Machine B so I can connect it remotely. Now, I am able to connect from Machine A to Machine B. My problem is that, I am unable to push my data from Machine A to B. I guess I need Linked-Server. I tried to build Linked server but when I make linked server, it gives me below error:
Named Pipes Provider: Could not open a connection to SQL Server [5].
OLE DB provider "SQLNCLI11" for linked server "192.168.0.18/SQLEXPRESS" returned message "Login timeout expired".
OLE DB provider "SQLNCLI11" for linked server "192.168.0.18/SQLEXPRESS" returned message "A network-related or instance-specific error has occurred while establishing a connection to SQL Server. Server is not found or not accessible. Check if instance name is correct and if SQL Server is configured to allow remote connections. For more information see SQL Server Books Online.". (Microsoft SQL Server, Error: 5)
Linked server name is : 192.168.0.18/sqlexpress and I set to use my user name and password.
Machine A: Mac running Microsoft Windows on Parallel (I connect using Win 8.1 that runs over Mac Yosemite).
Machine B: Windows 8.1 on physical server (no VM).
I have enabled Named Pipe from network configuration of my Machine B SQL server. However, I think I need to do some modification on port number with my Firewall.
UPDATE: I disabled Firewall on Machine B, but no clue yet.
Please advise.
Thanks
It gave the same error to me
Msg 15015, Level 16, State 1, Procedure sp_addlinkedsrvlogin, Line 49
The server '.\SQLEXPRESS' does not exist. Use sp_helpserver to show available servers.
but still created the server ,so try .\SQLEXPRESS and see..!!
Also, if this doesn't work try
EXEC sp_helpserver
and see the full name of the server and then see if your linked server comes there..!!

Link Server between 2 servers doesn't work but works on all other servers

A little background on what has been going on. I have been in the process of upgrading our sql server from 2008 R2 to 2012. The way I have been doing this is by taking the server to upgrade, lets call it Server A. Then taking a server a new server, lets call it Server C.
Moving all databases from Server A to Server C.
Renaming Server C to Server A and Server A to Server C.
Completely blowing away the Server C (old Server A).
Installing windows 2012, and SQL Server 2012 on Server.
Rename both servers to their original name.
The network team actually installed Windows server, got it on the network, etc. I only installed SQL Server 2012. I have done this with 8 servers and have had no problems from them so far. Both servers are running SQL Server 11.0.3373 windows version 6.2 build(9200). I also am sysadmin on all sql servers, but not a domain admin.
The issue
I am trying to create a link server from Server A to Server B. I can create the link server without an error, but i get an error when i use it in a query.
More relevant information
The firewall is turned off on Server B on all these tests.
I am able to ping Server A from Server B and vice versa.
I did a tracert and it comes up with the correct server and ip address( from both servers)
When I create the link server with *Other data source*
“Microsoft OLE DB Provider for SQL Server” or “SQL Server native Client 11.0”
I am able to query the master database when I query a user created database I get this error:
Msg 7314, Level 16, State 1, Line 1
The OLE DB provider "SQLNCLI11" for linked server "SERVER_B" does not contain the table ""UserDB"."dbo"."Table1"". The table either does not exist or the current user does not have permissions on that table.
SSMS
When I RDP into the Server A, run SSMS, try to connect to Server B I get this error:
"A transport-level error has occurred when receiving results from the server (Provider TCP Provider, error: 0- The specified network name is no longer available.) (Microsoft SQL Server Error: 64)"
RDP
When I try to RDP into Server B from Server A. I get an error that says "This computer can't connect to the remote computer. I also had a domain admin try and gets the same error.
Server B to A errors
I tried going the other way with it.
I RDP into Server B. In SSMS I try to connect to Server A. Below is the error i get.
A connection was successfully established with the server, but then an error occurred during the login process. (provider: TCP Provider, error: 0 - The semaphore timeout period has expired.) (.Net SqlClient Data Provider)
Any help would be appreciated.

SQL Server and Sybase Linked Server Issue

In SQL Server 2008 using the Sybase 12.5 driver everything works fine but now we had migrated to SQL Server 2012 and Sybase 15 using the 64bit driver it seems that things are broken.
If I test linked server connection it gives me linked server succeeded message but as I visually drill down the catalogs though it lists all of them they show as blank like such
but the item count is correct as we have that many catalogs in our Sybase.
Another funny thing that I recognized is that when I perform and OPENQUERY it gives me the correct amount of rows and still it is showing empty strings, like such
I dont have any idea what is happening here and my only clue is this error message when I drill down inside those blank databases. This exception prompts.
Failed to retrieve data for this request. (Microsoft.SqlServer.Management.Sdk.Sfc)
------------------------------
ADDITIONAL INFORMATION:
An exception occurred while executing a Transact-SQL statement or batch. (Microsoft.SqlServer.ConnectionInfo)
------------------------------
Cannot obtain the schema rowset "DBSCHEMA_TABLES" for OLE DB provider "MSDASQL" for linked server "TEST". The provider supports the interface, but returns a failure code when it is used. (Microsoft SQL Server, Error: 7311)
Any ideas why this might be happening? does anyone know a solution to this?
I solved this by restarting my Server, it looks like the Sybase drivers was not fully registered on install.

Resources