Create Database link to MS SQL Server on Oracle database - sql-server

Please help.. I need to connect to a SQL Server database (B) from an Oracle database (A) which are both on Windows server machines. Here is what I did.
System DS created on (A):-
Name: ISECWM
Driver: ODBC Driver 11 for SQL Server
Test Results:
Microsoft ODBC Driver for SQL Server Version 12.00.5543
Running connectivity tests...
Attempting connection Connection established Verifying option settings
Disconnecting from server
TESTS COMPLETED SUCCESSFULLY!
$ORACLE_HOME/hs/admin/initISECWM.ora file contains
HS_FDS_CONNECT_INFO = ISECWM
HS_FDS_TRACE_LEVEL = OFF
$ORACLE_HOME/network/admin/listener.ora updated:-
SID_LIST_LISTENER = (SID_LIST = (SID_DESC =
(SID_NAME=ISECWM)
(ORACLE_HOME=c:\oracle\11g)
(PROGRAM=dg4odbc)
) )
$ORACLE_HOME/network/admin/tnsnames.ora updated:-
WORLDMAP.DBL = (DESCRIPTION=
(ADDRESS=(PROTOCOL=TCP)(HOST=SERVER A HOSTNAME)(PORT=1521))
(CONNECT_DATA=(SID=ISECWM)) (HS=OK) )
Database link created:-
CREATE PUBLIC DATABASE LINK TSTDBLINK CONNECT TO "sql server
username" IDENTIFIED BY "sql server password" USING 'WORLDMAP.DBL';
Tested the database link with:-
select * from dual#TSTDBLINK; --gives the error
Error:-
ORA-28513: internal error in heterogeneous remote agent ORA-02063:
preceding line from TSTDBLINK
28513. 00000 - "internal error in heterogeneous remote agent"
*Cause: An internal error has occurred in the Oracle remote agent
supporting a heterogeneous database link.
*Action: Make a note of how the error was produced and contact the
customer support representative of the agent vendor. Error at Line: 7 Column: 20

Ah, finally Oracle helped me with the issue.
It seems I had 2 homes, I put the initISECWM.ora in the wrong Oracle home.
Just copied and pasted it in the other home/hs/admin/ and it worked like a wonder! Voila!

Related

SSIS OLEDB Connection Manager - Unable to connect to a database (No database names appear)

I am trying to create a connection manager in Microsoft SQL Server Data Tools for Visual Studio 2017 (SSDT) for an integration services project.
In the Connection Manager:
The Provider is set to: Native OLE DB\SQL Server Naive Client 11.0
The Server name is set to: the name of the local machine
Log on to the server is set to: Windows Authentication
Connect to a database is set to: Select or enter a database name. However no database names appear in the drop down box - the drop down box is blank. I am expecting the name of the database i am working on, including the master database etc to be present.
When I Test Connection, I get an error message which says:
'Test connection failed because of an error in initializing provider. Login timeout expired
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.
Named Pipes Provider: Could not open a connection to SQL Server [2]..'
I am using SQL Server 2017 and Microsoft SQL Server Management Studio 18.
Allow remote connections has been ticked in SSMS.
The only thing i can see is the SQL Server Agent and SQL Server Browser has stopped / is not running and the TCP/IP Protocols for SQLEXPRESS is set to disabled - I am unable to enable it without a further Access is denied (0x80070005) error.
I have tried to follow all of the guides but cannot progress. Could somebody please offer some further guidance?
I have resolved the issue. It was an extremely silly oversight! On installation, the server name in the Visual Studio 17 Connection Manager was listed as: Local MachineName only. In SQL Server, the Server Name was listed as: LocalMachineName\SQLEXPRESS. The Server Name in VS17 has to be exactly the same as SQL Server. As i said, this is a very silly oversight on my part but have documented for future reference.
SQL Server Configuration Manager ==> SQL Server Services(Left sidebar) ==> Right Click and Start all Stopped services

Setting up/troubleshooting ODBC connection for SQL Server 2014

I've set up ODBC connections to databases before, but I'm currently having problems and can't seem to figure out what I'm missing. This isn't my area of expertise, and the Microsoft help/documentation is less than 'user friendly'. Appreciate any pointers.
I have a locally running instance of SQL Server 2014, with a couple of test databases I'm using to develop another application. Here's the info on the setup:
SELECT HOST_NAME() AS 'host_name()',
##servername AS 'ServerName\InstanceName',
SERVERPROPERTY('servername') AS 'ServerName',
SERVERPROPERTY('machinename') AS 'Windows_Name',
SERVERPROPERTY('ComputerNamePhysicalNetBIOS') AS 'NetBIOS_Name',
SERVERPROPERTY('instanceName') AS 'InstanceName',
SERVERPROPERTY('IsClustered') AS 'IsClustered'
query returns:
host_name() ServerName\InstanceName ServerName Windows_Name NetBIOS_Name InstanceName IsClustered
DECATHLETE DECATHLETE\SQLEXPRESS DECATHLETE\SQLEXPRESS DECATHLETE DECATHLETE SQLEXPRESS 0
In the Windows ODBC Data Source Administrator (64-bit) - I'm running W10 in a VMWare VM on Mac, btw - the server shows up as available when I try to configure a new System DSN. Following is the setup info:
Microsoft ODBC Driver for SQL Server Version 12.00.2000
Data Source Name: TEST
Data Source Description:
Server: DECATHLETE
Use Integrated Security: Yes
Database: (Default)
Language: (Default)
Data Encryption: No
Trust Server Certificate: No
Multiple Active Result Sets(MARS): No
Translate Character Data: Yes
Log Long Running Queries: No
Log Driver Statistics: No
Use Regional Settings: No
Use ANSI Quoted Identifiers: Yes
Use ANSI Null, Paddings and Warnings: Yes
Testing connectivity generates the following error message:
Microsoft ODBC Driver for SQL Server Version 12.00.2000
Running connectivity tests...
Attempting connection
[Microsoft][ODBC Driver 11 for SQL Server]Named Pipes Provider: Could not open a connection to SQL Server [2].
[Microsoft][ODBC Driver 11 for SQL Server]Login timeout expired
[Microsoft][ODBC Driver 11 for SQL Server]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.
TESTS FAILED!
I've confirmed access to the databases from SQL Server Management Studio. The login uses windows authentication with no password. I can get in, play with databases, run queries, etc. (See picture below).
I'm at a loss. I'd previously created ODBC connections with no problems. This seems to have cropped up as an issue since upgrading the virtual machine from W7 to W10. Hoping someone can point out an obvious oversight.
* Update *
Adding a screenshot of the ODBC configuration wizard below. Note that the SQL Server is showing up in the list of available servers on the wizard. So it seems to be seeing the server but failing to connect to it.
In the "Create a New Data Source to SQL Server" dialog/window, the incorrect "Server name:" is specified. Since you have a named instance of SQL Server, type in the name of the SQL Server host, a backslash, and the instance name. Here is the format: SQLHostName\SQLInstanceName.
Please check, whether you're allowing remote connections to the SQL Server using the 'Microsoft Sql Server 2014\Configuration Tools\Sql Server Configuration Tool' utility.
Go to Sql Server Network Configuration and make sure you allow TCP/IP for remote connections.
Also I'd try to play with Windows Firewall on the Sql Server PC.
I've been searching for a solution to this issue for a while now. I am trying to link SQL tables on another server to a Microsoft Access front end to make use of the Forms for data entry etc.
The comments here solved the issue and I thought I would provide a consolidated solution for clarity:
From the SQL Server Connection Manager:
Enable SQL Server Browser
From 'SQL Server Services', modify the Properties of the 'SQL Server Browser' and set the 'Start Mode' to 'Automatic'. Apply the changes and exit.
Start the 'SQL Server Browser'.
Enable TCP/IP
From 'SQL Server Network Configuration' -> 'Protocols for [your server name]', then enable TCP/IP.
Then create an ODBC connection from your local computer. From there I used the named ODBC connection in access to link the tables I needed.

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..!!

How can I connect to a local ODBC datasource

I created an ODBC database on my local machine with driver SQL server Native client 10.0, which connects to a remote server, see
.
I am working on a project about customized ODBC to an inhouse database and want to Test how I can connect to a data source using ODBC.
The question is how can I connect to the local ODBC using sql server studio manager? I tried
but it returns an error:
A network-related or instance-specific error occurred while
establishing a connection to SQL Server. The server was not found or
was not accessible. Verify that the instance name is correct and that
SQL Server is configured to allow remote connections. (provider: Named
Pipes Provider, error: 40 - Could not open a connection to SQL Server)
Any idea?
Connect to your local server through SSMS then create a linked server to the ODBC connection.
Echoing #Brian Boyd...
It is possible to create an ODBC connection to a SQL server running locally.
If you start SSMS and point it to a local database engine the Server Name should be Computer_Name\SQLEXPRESS with Authentication set to Windows Auth (ie the logged-in user: you). Computer_Name is found in the System window (Windows Key + Break) and is not localhost, 127.0.0.1, etc.
So, to set up an ODBC connection by running %windir%\syswow64\odbcad32.exe
In the System DSN tab, click [Add...]
Select SQL Server in the drivers list, click [Finish]
Now add a Name and Description but most importantly set the Server to be Computer_Name\SQLEXPRESS (whatever was shown in SSMS)
Click [Next] and leave the authentication set to Windows NT
Click [Next] and tick the default database tickbox to reveal a list of databases locally (if yours is listed here the ODBC settings have already worked)
Click [Next], [Finish] then [Test Data Source...] then all should be well
To connect to a remote server you don't need a DSN. You can enter the server name in the Server name field of SQL Server Management Studio and select Windows authentication or Database authentication.
It is not possible to connect SSMS to an ODBC data source. The only way is to create a linked server in your local SQL server as #Brian Boyd described.
Instructions are:
https://community.sagecrm.com/partner_community/b/hints_tips_and_tricks/archive/2010/05/10/connecting-to-a-sage-mas-erp-90-database-as-a-linked-server-within-ms-sql-server-2008.aspx
... and sp_AddLinkedServer documentation from MS HERE
… and with search = “sp_addlinkedserver for SOTAMAS90“, even an example from 2005
https://blog.coryfoy.com/2005/06/lets-go-crazy-accessing-timberline-pervasive-data-from-a-sql-linked-server/
Let’s see what turn says …. And think I will / would get the same error adding a linked server through UI that I get TSQL
Based on above, I tried …
EXEC sp_addlinkedserver
#server = 'TimberlineTest',
#provider = 'SOTAMAS90', -- Original command #provider = MSDASQL',
#srvproduct = '', --- MAS 90 4.0 ODBC Driver Original is #srvproduct='Timberline Data',
#datasrc = 'DataTest'

Resources