Solved

How can i add linked server using Enterprise Manager ?

Posted on 2010-09-19
19
646 Views
Last Modified: 2013-11-24
Hi;

I have two databases on separate servers and I need to combine the data from the two servers.

I tried adding linked server using Enterprise Manager and I chose other data source
--> Microsoft OLE DB provider for SQL server, product name --> SQL Server, data source --> the IP address of the other server (also tried the server name) , provider string -->SQLOLEDB, Catalog -->the DB I need to retrieve the data from.
In the security tap I wrote the local account and the remote account and both of them have the same credentials same user name and same password, from the connections I chose be made using this security context and I typed the SA user name and password (the SA password of database on the other server I am trying to connect).
I got an error message access is denied.
I don't know what the problem is as this is the first time for me to create linked server.
0
Comment
Question by:bateg
  • 7
  • 5
  • 2
  • +2
19 Comments
 
LVL 69

Expert Comment

by:Qlemo
ID: 33710727
You should not use the "Other source" for MSSQL. Choose the SQL Server as source instead. That will hide unnecessary fields, and make it easier for you to connect.
Nevertheless, what you have configured sounds correct. The remote SA account should work in "Security Context" section.
0
 
LVL 5

Expert Comment

by:Priya Perumpilavil
ID: 33710814
trythis
EXEC sp_addlinkedserver  'linkedServename',  N'SQL Server'
 EXEC master.dbo.sp_addlinkedsrvlogin @rmtsrvname = N''linkedServename'', @locallogin = NULL , @useself = N'False', @rmtuser = N'" & sLinkUser & "', @rmtpassword = N'" & sLinkPWD & "'
0
 
LVL 69

Expert Comment

by:Qlemo
ID: 33710817
PriyaPadman,
If you provide T-SQL scripts, please do so completely. The above is missing (a) the declares of vars and (b) the particular values for this case, as far as known.
0
PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

 
LVL 5

Expert Comment

by:Priya Perumpilavil
ID: 33710840
dear qlemo: sorry 4 ma mistake
details can be seen n this link
http://msdn.microsoft.com/en-us/library/ms190479(SQL.90).aspx
0
 

Author Comment

by:bateg
ID: 33710936
The problem is that when i tried SQL server , only the master database apperead in the tables list , i need to use our database not the default one that's why i used other datasouces so i can choose the DB i want to connect to .
0
 
LVL 8

Expert Comment

by:Mohit Vijay
ID: 33710947
Below link is my tested for MySQL to SQL Migration using Linked Server, You can use it for SQL Server Linking

http://www.codeproject.com/KB/database/migrate-mysql-to-mssql.aspx

0
 
LVL 11

Expert Comment

by:JoeNuvo
ID: 33710986
when you try to get data via link server.
you have to put database name also

for ex.

SELECT * FROM [ServerName].[Database].[dbo].[tablename]

with SA password entering for security context.
you should able to access almost all objects via Linked Server
0
 

Author Comment

by:bateg
ID: 33711167
I created the data source successfully.
but when i typed your code after changing the parameters.
EXEC master.dbo.sp_addlinkedserver
@server = N'MYSQL', --> i typed the data source name that created
@srvproduct=N'MySQL', --> SQLServer
@provider=N'MSDASQL', -->SQLOLEDB
@provstr=N'DRIVER={SQL Server}; SERVER=the ip address of the server; _
      DATABASE=Mydatabase; USER=sa; PASSWORD=Password; OPTION=3'

I got a message saying one row created successfully. Then when tried to query the results I got another message:-

<<OLE DB provider 'SQLOLEDB' returned a 'NON-CLUSTERED and NOT INTEGRATED' index 'IX_RouteMaster' with incorrect bookmark ordinal 0.
OLE DB error trace [Non-interface error:  OLE/DB provider returned an invalid bookmark ordinal from the index rowset.].>>
0
 
LVL 69

Expert Comment

by:Qlemo
ID: 33711348
And you are certain that the same SQL (without using the linked server) works on the remote server?
0
 

Author Comment

by:bateg
ID: 33714074
Yes, i just tried logging in , it's working , both servers.
When i opened the linked server node i couldn't find any servers created under that list .
I really don't know what is the problem .
0
 
LVL 69

Accepted Solution

by:
Qlemo earned 500 total points
ID: 33714218
That's more than odd, you should see your newly created entry there.

Try to drop it with
sp_dropserver N'YourDatasourceName'
and recreate it via Enterprise Manager with the SQL Server type.
You still will need to fully qualify your table:
select * from server.db.schema.table
and will only see the system tables and views when you use the tree view in Enterprise Manager.

Your changes to the above T-SQL for creating a linked server are wrong. You are using SqlOleDB, but providing an ODBC MSSQL connection string. If you want to go that way, use
@provstr=N'Provider=SqlOleDB; SERVER=the ip address of the server; _        DATABASE=Mydatabase; USER=sa; PASSWORD=Password;'
0
 

Author Comment

by:bateg
ID: 33714801
I created the linked server using your modified T-SQL and it appeared under the linked server node (myDB) the tables and the views but I was not able to run the query result directly so I  tried to run a simple select statement using query analyzer and I got this  strange error message:-

Server: Msg 7319, Level 16, State 1, Line 1
OLE DB provider 'SQLOLEDB' returned a 'NON-CLUSTERED and NOT INTEGRATED' index 'IX_RouteMaster' with incorrect bookmark ordinal 0.
OLE DB error trace [Non-interface error:  OLE/DB provider returned an invalid bookmark ordinal from the index rowset.].
0
 
LVL 69

Expert Comment

by:Qlemo
ID: 33715205
We should check if the SqlOleDB provider options include something unwanted or conflicting.

In Enterprise Manager, start creating a new linked server, choosing the "Microsoft OLE DB Provider for SQL Server". That will enable the "Provider Options" button below the provider name. Press it, and untick anything. Close this dialog by taking the changes over. You can cancel the linked server creation - this action was taken only to be able to set the provider options.

Now try the query again with the same linked server.
0
 

Author Comment

by:bateg
ID: 33723267
Apparently there is a problem with SQL OLEDB provider with the server I am trying to connect, so as soon as we fix the problem
I will try the query again with the linked server I created and I will get back to you.
0
 
LVL 69

Expert Comment

by:Qlemo
ID: 35176458
http:#a33714218 answers the original question. There are issues outside the scope of the question which do not allow to use the database link.
0
 
LVL 69

Expert Comment

by:Qlemo
ID: 35715049
Objection:
a) The original question has been answered (see http:#35176458)
b) Despite a Cleanup Volunteer's ping 6 weeks ago, the asker only returned to the question after 7 months, when he needed to post a new question. That is inproper handling of questions.
0

Featured Post

Salesforce Made Easy to Use

On-screen guidance at the moment of need enables you & your employees to focus on the core, you can now boost your adoption rates swiftly and simply with one easy tool.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Why is this different from all of the other step by step guides?  Because I make a living as a DBA and not as a writer and I lived through this experience. Defining the name: When I talk to people they say different names on this subject stuff l…
This article shows gives you an overview on SQL Server 2016 row level security. You will also get to know the usages of row-level-security and how it works
The viewer will learn how to create a normally distributed random variable in Excel, use a normal distribution to simulate the return on an investment over a period of years, Create a Monte Carlo simulation using a normal random variable, and calcul…
The viewer will learn how to create two correlated normally distributed random variables in Excel, use a normal distribution to simulate the return on different levels of investment in each of the two funds over a period of ten years, and, create a …

830 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question