I want to connect my SQL Server 2012 to Oracle 11g database using Linked server and Oracle client. I have installed SQL Server 2012 in my local machine. Oracle database installed in client machine.
My client has shared me ip address of machine, System ID, Instance number and Oracle database user ID and password.
I have followed below mentioned steps:
- I have installed SQL Server 2012 in my machine
- I have installed Oracle client 11g in my machine
- I have also installed ODT with ODAC _32bit
I have created one linked server with below script steps
exec master.dbo.sp_MSset_oledb_prop 'ORAOLEDB.Oracle', N'AllowInProcess', 1 exec master.dbo.sp_MSset_oledb_prop 'ORAOLEDB.Oracle', N'DynamicParameters', 1 exec sp_addlinkedserver N'MyOracle', 'Oracle', 'ORAOLEDB.Oracle', N'//HOSTNAME/TRQ', N'FetchSize=2000', '' exec master.dbo.sp_serveroption @server=N'MyOracle', @optname=N'rpc out', @optvalue=N'true' exec sp_addlinkedsrvlogin @rmtsrvname='MyOracle', @useself=N'FALSE', @rmtuser=N'ORACLE USERNAME', @rmtpassword='ORACLEPASSWORD'
When I execute below query getting error:
OLE DB provider "ORAOLEDB.Oracle" for linked server "MyOracle" returned message "ORA-12154: TNS:could not resolve the connect identifier specified". Msg 7303, Level 16, State 1, Line 9 Cannot initialize the data source object of OLE DB provider "ORAOLEDB.Oracle" for linked server "MyOracle".
exec ('select 1 a from dual') at MyOracle