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
Related
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
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.
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.
Wow i was just playing around with sp_addlinkedserver and i accidentally ran this command: sp_addlinkedserver abc,'SQL Server'
1) i had command(s) completed successfully.. but what happened?
2) how do i undo what i did?
You created a link to a server named abc.
You could try to query the server across this link using a command such as:
select *
from abc.master.information_schema.tables
But (unless you really do have a server called abc) it'll return you a message similar to:
OLE DB provider "SQLNCLI10" for linked server "abc" 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.".
You can view your linked server in SSMS under Server Objects>>Linked Servers in the Object Explorer.
To get rid of the linked server, use the following statement:
sp_dropserver abc
You now have a linked server called abc
To remove, use sp_dropserver (There is no sp_droplinkedserver). Thus:
EXEC sp_dropserver 'abc', 'droplogins'
You added the Linked Server, see here about using it. Briefly, Linked servers used to obtain the ability to make distributed queries between your and linked servers:
SELECT MyServer.MyDatabase.dbo.Table1.Field1,
LinkedServer.MyDatabase.dbo.Table2.Field2
FROM MyServer.MyDatabase.dbo.Table1
INNER JOIN LinkedServer.MyDatabase.dbo.Table2
ON MyServer.MyDatabase.dbo.Table1.ID=LinkedServer.MyDatabase.dbo.Table2.ID
Can anyone guide me around to linking a server to another in SQL Server 2008 R2? I am getting the following error when trying to do so in 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 "SQLNCLI" for
linked server "CDSPM1" reported an
error. Authentication failed. Cannot
initialize the data source object of
OLE DB provider "SQLNCLI" for linked
server "CDSPM1". OLE DB provider
"SQLNCLI" for linked server "CDSPM1"
returned message "Invalid
authorization specification".
(Microsoft SQL Server, Error: 7399)
Seems like Authentication problem.
Test by creating the linked Server using "Server Type" as "Sql Server". Then go into "Security" and set your user mapping. As a test, create a SQL login on the remote system and specify that on the "Be made using this security context"
Be sure that you can PING the "Linked Server" name first. HTH
Use drop down and choose
SQL Server Native Client
instead of
SQL Server
Use below link to view the screenshots of connecting the linked server with SQL Server
To solve "Cannot initialize the data source object of OLE DB provider "SQLNCLI10" for linked server" problem
Connect MS Access to SQL server 2008 via linked server
Then use below query to get more information about the linked server
select * from openquery("owner_pc\sqlserver2008",'select * from Testing.dbo.test')
This was driving me round the bend. And the fact you can't edit a Linked server after you entered it is just bananas.
Anyway, just leave most of the boxes empty on the linked server dialogue! Use "SQL Server Native Client" like #abatishchev mentioned then..
Check Kamran's article here for the settings. Only Datasource was filled in for me as IP hostname, after I'd give the server a friendly name in "Linked server", and on the second tab didn't need to bother with any logins just radio button the bottom one and used the SA login on the remote box.
In the general page of New Linked Server, type the sql-server instance name in the [Linked Server] box. Click on the [SQL Server] check box when selecting [Server Type]. Type remote username and password atfer selecting [Be made using this security context] of Security tab.
Select top 10 * from [LINKEDSERVERNAME].[DATABASENAME].[SCHEMANAME].[TABLENAME]
Best of luck.
for more details information http://msdn.microsoft.com/en-us/library/ff772782.aspx
A possible cause, if you have clustered service , and has recently been balanced , it is likely that a connection has been blocked pointing to old resource.
Try moving again resource to another node and reopening the Management studio, try again linked server connection.