Solved

Adding Linked Server to Oracle

Posted on 2006-11-14
13
220 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
  • 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
 

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
Highfive + Dolby Voice = No More Audio Complaints!

Poor audio quality is one of the top reasons people don’t use video conferencing. Get the crispest, clearest audio powered by Dolby Voice in every meeting. Highfive and Dolby Voice deliver the best video conferencing and audio experience for every meeting and every room.

 
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

Do You Know the 4 Main Threat Actor Types?

Do you know the main threat actor types? Most attackers fall into one of four categories, each with their own favored tactics, techniques, and procedures.

Join & Write a Comment

Everyone has problem when going to load data into Data warehouse (EDW). They all need to confirm that data quality is good but they don't no how to proceed. Microsoft has provided new task within SSIS 2008 called "Data Profiler Task". It solve th…
JSON is being used more and more, besides XML, and you surely wanted to parse the data out into SQL instead of doing it in some Javascript. The below function in SQL Server can do the job for you, returning a quick table with the parsed data.
Familiarize people with the process of retrieving data from SQL Server using an Access pass-thru query. Microsoft Access is a very powerful client/server development tool. One of the ways that you can retrieve data from a SQL Server is by using a pa…
Using examples as well as descriptions, and references to Books Online, show the documentation available for datatypes, explain the available data types and show how data can be passed into and out of variables.

707 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

12 Experts available now in Live!

Get 1:1 Help Now