Error while calling stored procedure on linked server - sql-server

I had configured a linked server to enable the SQL Server Database Engine to execute commands against OLE DB data sources outside of the instance of SQL server by executing sp_addlinkedserver procedure. After doing that I was trying to execute a procedure on a linked server using the following statement
EXEC [LinkedServer].[DatabaseName].[DatabaseOwner].[StoredProcedure] param1, param2
When I tried to execute the statement mentioned above it threw me the following error
OLE DB provider "SQLNCLI10" for linked server "server name" returned message "Unable to complete login process due to delay in opening server connection".
Msg 7303, Level 16, State 1, Line 1
Cannot initialize the data source object of OLE DB provider "SQLNCLI10" for linked server "server name".
I tried the following
Check if a linked server has remote access enabled
Increase remote query timeout
Check firewall to see if port was enabled.
What am I missing here? I appreciate your help.

Related

SQL Server -- CREATE EXTERNAL FILE FORMAT to query Parquet files via Polybase -- failing due to TCP error

Context: I'm trying to use SQL Server's Polybase to query data in parquet files. One of the steps required to do so is to create an external file format that maps to parquet. MSDN provides SQL sample below.
CREATE EXTERNAL FILE FORMAT parquet_file_format
WITH (
FORMAT_TYPE = PARQUET,
--DATA_COMPRESSION = 'org.apache.hadoop.io.compress.SnappyCodec'
DATA_COMPRESSION = 'org.apache.hadoop.io.compress.GzipCodec'
);
When I execute it I get the following error.
OLE DB provider "MSOLEDBSQL" for linked server "(null)" returned message "Login timeout expired".
OLE DB provider "MSOLEDBSQL" for linked server "(null)" 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 10061, Level 16, State 1, Line 40
TCP Provider: No connection could be made because the target machine actively refused it.
I've tried enabling TCP network protocol
and also tried configuring the remote access server configuration option neither of which resolve the error.
EXEC sp_configure 'remote access', 0 ;
GO
RECONFIGURE ;
GO
Question: Can someone please point me in the right direction, or tell me what I'm doing wrong?
Turns out issue was Polybase services weren't running. I was able to run them in the sql server configuraion manager under sql server network configuration. This was helpful: https://www.sqlservercentral.com/forums/topic/polybase-syntax-error

SELECT Query between two different servers

I want to pull out data from different tables from different servers. I took a query at V5\SQL2014 Server and run these following to connect to V5_27\SQL2005 Server
EXEC sp_addlinkedserver
#server= 'V5_27\SQL2005',
#srvproduct='V5_27\SQL2005',
#provider='SQLNCLI',
#datasrc='tcp:0.0.0.0'
EXEC sp_addlinkedsrvlogin
#useself='FALSE',
#rmtsrvname='V5_27\SQL2005',
#rmtuser='sa',
#rmtpassword='123'
SELECT * FROM Stk006,[V5_27\SQL2005]..[TESTACC].Stk006
It shows me following errors.
OLE DB provider "SQLNCLI11" for linked server "V5_27\SQL2005" returned message "Login timeout expired".
OLE DB provider "SQLNCLI11" for linked server "V5_27\SQL2005" 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 10049, Level 16, State 1, Line 22
TCP Provider: The requested address is not valid in its context.
User and Password are not wrong.
Allow remote is enabled in both servers.
TCP/IP and Named Pipes are enabled in both servers.
Please help me, thanks!
Thanks everyone, I found a solution for my problem.
You can check the solution link here or do below steps.
Try to create a linkServer , Object Explorer -> Server Objects -> Linked Servers (Right click and create new)
Configure Settings
Enter your Server Name
Login with sa and password
Then Test Connection of it.
Enjoy your query.
select
lc.t2 as 'Local Stock Code',
ext.t2 as 'External Stock Code'
from
Stk001 lc,
[V5_27\SQL2005].[TESTACC].[dbo].[STK001] ext

Creating a view from another Server error

Hi All I am trying to create a View from another database server...
I have have got server A an din Server A is where i want to create a view referencing a table from Server B.... when I run the command below:
create view TableFromServerB as select * from ServerB.master.information_schema.table;
I get the following error:
OLE DB provider "SQLNCLI11" for linked server "ServerB" returned
message "Login timeout expired". OLE DB provider "SQLNCLI11" for
linked server "ServerB" 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 0 Named Pipes Provider:
Could not open a connection to SQL Server [53].
I have done some research online and i came to a source that suggested using sp_addlinkedserver in my command .. which i have done and when i did this it said server already exists . So is there anything i am missing out here??
I have seen an issue like this before:
Can you please do something like this:
Create a view in your linked server to access the object i.e master.information_schema.table;
Use this view in the queries from the server where you want to display the results.
Eg:
--- create view script--
create view dbo.vINFORMATION_SCHEMATABLES
as
SELECT *
FROM INFORMATION_SCHEMA.TABLES
go
-- select statement from local server
select * from [testSRV].[testDB_far].[dbo].[vINFORMATION_SCHEMATABLES]
Let me know if this helps.

Connect Oracle to SQL Server

I am trying to connect Oracle 9i database using SQL Management studio 2008.
I tried this but it doesn't work
EXEC sp_addlinkedserver 'OracleLinkedServer','Oracle','OraOLEDB.Oracle','TestDB';
EXEC sp_addlinkedsrvlogin 'OracleLinkedServer','false','SA','TestUsername','TestPassword';
I am able to create the linked server and it test correctly,
But when I execute this statement:
SELECT sysdate FROM OracleLinkedServer...dual;
...it gives an error:
Msg 7399, Level 16, State 1, Line 1
The OLE DB provider "OraOLEDB.Oracle" for linked server "OracleLinkedServer" reported an error. Provider caused a server fault in an external process.
Msg 7311, Level 16, State 2, Line 1
Cannot obtain the schema rowset "DBSCHEMA_TABLES" for OLE DB provider "OraOLEDB.Oracle" for linked server "OracleLinkedServer". The provider supports the interface, but returns a failure code when it is used.
You should UNCHECKED the Allow inprocess in OraOLEDB.Oracle provider under the Linked Servers node.

OpenDataSource fails

I'm trying to export records from SQL Server 2008 to mdb file using OpenDataSource. It works when I log in using Windows authentication. But it fails when I use SQL Server authentication.
This is the error I get
OLE DB provider
"Microsoft.Jet.OLEDB.4.0" for linked
server "(null)" returned message
"Could not delete from specified
tables.". Msg 7320, Level 16, State 2,
Procedure EXPORT_Employee, Line 110
Cannot execute the query "DELETE FROM
employee_export " against OLE DB
provider "Microsoft.Jet.OLEDB.4.0" for
linked server "(null)".
A bit speculative but maybe you need to grant the SQL Server Service Account Write Access to the mdb file and make sure that you don't have it open at the same time.
Edit: A different type of permissions error anyway I think http://blogs.msdn.com/spike/archive/2008/07/23/ole-db-provider-microsoft-jet-oledb-4-0-for-linked-server-null-returned-message-unspecified-error.aspx

Resources