Solved

How can i add linked server using Enterprise Manager ?

Posted on 2010-09-19
19
636 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 68

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 68

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
 
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
Enterprise Mobility and BYOD For Dummies

Like “For Dummies” books, you can read this in whatever order you choose and learn about mobility and BYOD; and how to put a competitive mobile infrastructure in place. Developed for SMBs and large enterprises alike, you will find helpful use cases, planning, and implementation.

 
LVL 68

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 68

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 68

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 68

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 68

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

U.S. Department of Agriculture and Acronis Access

With the new era of mobile computing, smartphones and tablets, wireless communications and cloud services, the USDA sought to take advantage of a mobilized workforce and the blurring lines between personal and corporate computing resources.

Question has a verified solution.

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

Load balancing is the method of dividing the total amount of work performed by one computer between two or more computers. Its aim is to get more work done in the same amount of time, ensuring that all the users get served faster.
The Delta outage: 650 cancelled flights, more than 1200 delayed flights, thousands of frustrated customers, tens of millions of dollars in damages – plus untold reputational damage to one of the world’s most trusted airlines. All due to a catastroph…
Via a live example, show how to set up a backup for SQL Server using a Maintenance Plan and how to schedule the job into SQL Server Agent.
The view will learn how to download and install SIMTOOLS and FORMLIST into Excel, how to use SIMTOOLS to generate a Monte Carlo simulation of 30 sales calls, and how to calculate the conditional probability based on the results of the Monte Carlo …

912 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

Need Help in Real-Time?

Connect with top rated Experts

21 Experts available now in Live!

Get 1:1 Help Now