Solved

Adding Linked Server to Oracle

Posted on 2006-11-14
13
266 Views
Last Modified: 2008-03-04
Hi, I'm aware of the stored procedure to run to add a linked server... however, what would the syntax be to add a link to an oracle server?  I cannot figure out how to word the driver for oracle to get the link to work.

Thanks.
0
Comment
Question by:Roxanne25
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 5
  • 4
  • 4
13 Comments
 
LVL 75

Assisted Solution

by:Aneesh Retnakaran
Aneesh Retnakaran earned 250 total points
ID: 17938244
Hi Roxanne25,
from BOL

C. Use the Microsoft OLE DB Provider for Oracle
This example creates a linked server named LONDON Mktg that uses the Microsoft OLE DB Provider for Oracle and assumes that the SQL*Net alias for the Oracle database is MyServer.

USE master
GO
-- To use named parameters:
EXEC sp_addlinkedserver
   @server = 'LONDON Mktg',
   @srvproduct = 'Oracle',
   @provider = 'MSDAORA',
   @datasrc = 'MyServer'
GO
-- OR to use no named parameters:
USE master
GO
EXEC sp_addlinkedserver
   'LONDON Mktg',
   'Oracle',
   'MSDAORA',
   'MyServer'
GO



Cheers!
0
 
LVL 28

Expert Comment

by:imran_fast
ID: 17938383
Practically  before the above you have to install
oracle client on your sql server.


Regards

Imran
0
 
LVL 28

Expert Comment

by:imran_fast
ID: 17938391

In other words You cannot create link server to oracle if you don't have oracle client install on your sql server machine.
0
How Blockchain Is Impacting Every Industry

Blockchain expert Alex Tapscott talks to Acronis VP Frank Jablonski about this revolutionary technology and how it's making inroads into other industries and facets of everyday life.

 

Author Comment

by:Roxanne25
ID: 17938401
What about the username and the password?
0
 
LVL 28

Expert Comment

by:imran_fast
ID: 17938478
that will be oracles user name and password.
0
 
LVL 75

Accepted Solution

by:
Aneesh Retnakaran earned 250 total points
ID: 17938480
sp_addlinkedsrvlogin [ @rmtsrvname = ] 'rmtsrvname'
    [ , [ @useself = ] 'useself' ]
    [ , [ @locallogin = ] 'locallogin' ]
    [ , [ @rmtuser = ] 'rmtuser' ]
    [ , [ @rmtpassword = ] 'rmtpassword' ]

refer BOL for examples
0
 
LVL 28

Expert Comment

by:imran_fast
ID: 17938483
once you install oracle client you will see new provider in the list of adding link server you have to select the appropriate provider and then use oracle user id and password.
0
 

Author Comment

by:Roxanne25
ID: 17938515
Aneeshattingal,

So, if there are two different stored procedures for connecting and then one for login... do I have to run the login procedure each time before I run a query or will it store the information?  I'm used to doing this through the wizard but the interface I have now I can only use code to it, so forgive the questions.  I know when I use the wizard to link the connection/login stuff is all done automatically once its set up.  
0
 
LVL 75

Expert Comment

by:Aneesh Retnakaran
ID: 17938533
Roxanne25,
>  do I have to run the login procedure each time before I run a query
> or will it store the information?  

Once your sql login is mapped with the oracle login, it will stay for ever untill u explicitly removes it
0
 

Author Comment

by:Roxanne25
ID: 17938608
Cool, thank you very much. :)
0
 

Author Comment

by:Roxanne25
ID: 17938784
I linked the server successfully but I got an error when I tried to do a login:

exec sp_addlinkedsrvlogin
    [ @rmtsrvname = ] 'PRDEPM'
    [ , [ @useself = ] 'FALSE' ]
    [ , [ @rmtuser = ] 'username' ]
    [ , [ @rmtpassword = ] 'password' ]

It said incorrect syntax near PRDEPM.
0
 

Author Comment

by:Roxanne25
ID: 17938821
Nevermind I did it like this:
EXEC sp_addlinkedsrvlogin 'Accounts', 'false', NULL, 'SQLUser', 'Password'

And it worked ;)
0
 
LVL 75

Expert Comment

by:Aneesh Retnakaran
ID: 17938830
great  :)
0

Featured Post

Get proactive database performance tuning online

At Percona’s web store you can order full Percona Database Performance Audit in minutes. Find out the health of your database, and how to improve it. Pay online with a credit card. Improve your database performance now!

Question has a verified solution.

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

For both online and offline retail, the cross-channel business is the most recent pattern in the B2C trade space.
What if you have to shut down the entire Citrix infrastructure for hardware maintenance, software upgrades or "the unknown"? I developed this plan for "the unknown" and hope that it helps you as well. This article explains how to properly shut down …
This video shows, step by step, how to configure Oracle Heterogeneous Services via the Generic Gateway Agent in order to make a connection from an Oracle session and access a remote SQL Server database table.
This videos aims to give the viewer a basic demonstration of how a user can query current session information by using the SYS_CONTEXT function

635 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