How to configure Oracle ODBC drivers on RHEL 6 / Linux

I need to configure Oracle ODBC drivers on RHEL 6 to connect to an Oracle data source located on a remote Windows machine.

I have taken the following steps:
[1] Installed oracle-instanceclient-basic
[2] Set environment variables: ORACLE_HOME and LD path
[3] Created /etc/oracle/TNSnames.ora and configured, but it did not install it correctly

First I got an error, "Connect failed because target or object does not exist"

Then I set: ORACLE_SID = DB_NAME in the TNSnames.ora file.

But this did not fix the problem, now I got a new error message: "TNS: net service name is incorrectly specified"

+4
source share
2 answers
 yum install unixODBC rpm -ivh oracle-instantclient-basic-10.2.0.3-1.i386.rpm #downloaded on http://www.oracle.com/technology/software/tech/oci/instantclient/htdocs/linuxsoft.html unzip instantclient-odbc-linux32-10.2.0.3-20061115.zip #downloaded on http://www.oracle.com/technology/software/tech/oci/instantclient/htdocs/linuxsoft.html cp ./instantclient_10_2/libsqora.so.10.1 /usr/lib/oracle/10.2.0.3/client/lib/ export ORACLE_HOME=/usr/lib/oracle/10.2.0.3/client export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$ORACLE_HOME/lib 

You also need to set $TWO_TASK (the default location where Oracle wants to pick up the server) to indicate where the Oracle server is running on Windows - do not forget to add a listener at the end after port number:

 export TWO_TASK=//213.123.23.19:1521/listener 

To find out the name of the listener, enter the following commands at the Windows prompt on which the Oracle server is running:

 lsnrctl status 

It will attract listeners and their condition (READY or UNKNOWN). Connect to a listener that is in a ready state: Instance "zelistener", status READY

mkdir / etc / oracle

vi / etc / oracle / tnsnames.ora

 MY_SID = ( DESCRIPTION = (ADDRESS_LIST = (ADDRESS = (PROTOCOL = TCP) (Host = 127.0.0.1) (Port = 1521) ) ) (CONNECT_DATA = (SID = MY_SID) ) ) 

TNS_ADMIN export = / etc / oracle

vi / etc / odbcinst.ini

 [OracleODBC-10g] Description = Oracle ODBC driver for Oracle 10g Driver = /usr/lib/oracle/10.2.0.3/client/lib/libsqora.so.10.1 FileUsage = 1 Driver Logging = 7 

vi / etc / odbc.ini

 [simple] Driver = OracleODBC-10g DSN = OracleODBC-10g ServerName = MY_SID UserID = USER Password = PASSWORD 

isql -v simple

 +---------------------------------------+ | Connected! | | | | sql-statement | | help [tablename] | | quit | | | +---------------------------------------+ 
+8
source

I think we should assign a unixODBC version. if to connect oracle12c, we should use unixODBC-2.3.1

+1
source

All Articles