SQL Server: Creating Linked Server with Oracle

So far I have used two ways to create linked server with Oracle. By
1. MS OLE DB Provider for ODBC Driver
2. OraOLEDB.Oracle Provider

For first one steps are like
[this actions will be done where the sql server resides. assume oracle db is in remote machine]
1. Install Oracle Client with all options.
2. Reboot the machine (not sure mandatroy or not)
3. Go to tnsnames.ora and note the oracle database info you want to connect
4. Create a system DSN name through adminsitrative tool --> Data Source --> System Driver --> Add new [configure and test it oracle user name and password]
5. Right Click of Provider MSDASQL in SSMS->Server Objects->Linked Server and check the box "Allow In Process"
6. Now open SSMS and put the below queries
exec master.dbo.sp_addlinkedserver @server = N'TEST2ORACLE', @srvproduct=N'DSN_NAME', @provider=N'MSDASQL', @datasrc=N'DSN_NAME'
exec master.dbo.sp_addlinkedsrvlogin @rmtsrvname=N'TEST2ORACLE',@useself=N'False',@locallogin=NULL,@rmtuser=N'oracleusername',
@rmtpassword='password'


For first one steps are like

1.  Install Oracle Client [here I don't suggest to do it first. Instead one can try with installing ODAC first]
link for ODAC download [read the readme file as installation guide]
http://www.oracle.com/technetwork/database/windows/downloads/utilsoft-087491.html

2. No system DSN needs to be created. Instead you can use either TNS Service name of Oracle DB or conncetion string. Below link contains a great description about all the steps

http://www.mssqltips.com/sqlservertip/1433/how-to-setup-linked-servers-for-sql-server-and-oracle-64-bit-client/

3. For trouble shooting this link may be useful

http://sqlserverpedia.com/blog/sql-server-bloggers/cannot-create-an-instance-of-ole-db-provider-%E2%80%98oraoledb-oracle%E2%80%99-for-linked-server/


Other ref:
http://msdn.microsoft.com/en-us/library/ms190479.aspx

Comments

Popular posts from this blog

Restoring Master, Model and MSDB from Netbackup

Oracle Job Operations