2012-12-17 84 views
4

我需要在RHEL 6上設置Oracle ODBC驅動程序以連接駐留在遠程Windows計算機上的Oracle數據源。如何在RHEL 6/Linux上設置Oracle ODBC驅動程序

我已採取下列步驟:
[1]安裝了Oracle-instanceclient鹼性
[2]設置環境變量:ORACLE_HOME和LD路徑
[3]建立/etc/oracle/TNSnames.ora和配置但它並沒有設置正確

起初,我得到了錯誤,"Connect failed because target or object does not exist"

然後,我設置:在tnsnames.ora文件ORACLE_SID = DB_NAME

但是,這並沒有解決這個問題,我現在有一個新的錯誤消息:"TNS: net service name is incorrectly specified"

+0

那麼有什麼不適合你? –

回答

8
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 

還需要設置爲$TWO_TASK(其中甲骨文正在尋求皮卡服務器的默認位置),以點Oracle服務器運行在Windows上哪裏 - - 不要忘記在最後的端口號後添加監聽器:

export TWO_TASK=//213.123.23.19:1521/listener 

爲了再檢查一下爲偵聽器的名稱,在窗戶上鍵入以下命令提示用戶正在運行Oracle Se rver:

lsnrctl 
status 

它將招募監聽者及其狀態(READY或UNKNOWN)。連接到處於就緒狀態監聽器:Instance "zelistener", status READY

的mkdir /等/ ORACLE

六/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 =的/ etc/ORACLE

六/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 

六/etc/odbc.ini

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

的isql -v簡單

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

我想更新驅動程序下載的鏈接是http://www.oracle.com/technetwork/topics/linuxx86-64soft-092277.html – Alok

1

我認爲,我們應該分配的unixODBC的版本。 如果要連接oracle12c,我們應該使用unixODBC-2.3.1

+0

正如你所說,似乎由RH提供的unixODBC 2.2.14不兼容10.x之上的Oracle驅動程序需要升級。 –

相關問題