Solved

Adding Linked Server to Oracle

Posted on 2006-11-14
13
256 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
Optimizing Cloud Backup for Low Bandwidth

With cloud storage prices going down a growing number of SMBs start to use it for backup storage. Unfortunately, business data volume rarely fits the average Internet speed. This article provides an overview of main Internet speed challenges and reveals backup best practices.

 

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

Optimizing Cloud Backup for Low Bandwidth

With cloud storage prices going down a growing number of SMBs start to use it for backup storage. Unfortunately, business data volume rarely fits the average Internet speed. This article provides an overview of main Internet speed challenges and reveals backup best practices.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
SQL Throw Error 7 34
SQL Instance service gone? 5 36
T-SQL: Need Group By to use "fuzzy logic"?? 3 18
How to trim a value in SQL 2 20
Let's review the features of new SQL Server 2012 (Denali CTP3). It listed as below: PERCENT_RANK(): PERCENT_RANK() function will returns the percentage value of rank of the values among its group. PERCENT_RANK() function value always in be…
Introduction SQL Server Integration Services can read XML files, that’s known by every BI developer.  (If you didn’t, don’t worry, I’m aiming this article at newcomers as well.) But how far can you go?  When does the XML Source component become …
Using examples as well as descriptions, and references to Books Online, show the different Recovery Models available in SQL Server and explain, as well as show how full, differential and transaction log backups are performed
Viewers will learn how to use the UPDATE and DELETE statements to change or remove existing data from their tables. Make a table: Update a specific column given a specific row using the UPDATE statement: Remove a set of values using the DELETE s…

749 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