Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Adding Linked Server to Oracle

Posted on 2006-11-14
13
Medium Priority
?
272 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 1000 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
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 

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 1000 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

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Ever wondered why sometimes your SQL Server is slow or unresponsive with connections spiking up but by the time you go in, all is well? The following article will show you how to install and configure a SQL job that will send you email alerts includ…
An alternative to the "For XML" way of pivoting and concatenating result sets into strings, and an easy introduction to "common table expressions" (CTEs). Being someone who is always looking for alternatives to "work your data", I came across this …
Via a live example combined with referencing Books Online, show some of the information that can be extracted from the Catalog Views in SQL Server.
Via a live example, show how to extract information from SQL Server on Database, Connection and Server properties

715 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