日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當(dāng)前位置: 首頁 > 运维知识 > linux >内容正文

linux

linux下安装oracle instant client,linux下安装Oracle instant client

發(fā)布時(shí)間:2023/12/14 linux 29 豆豆
生活随笔 收集整理的這篇文章主要介紹了 linux下安装oracle instant client,linux下安装Oracle instant client 小編覺得挺不錯(cuò)的,現(xiàn)在分享給大家,幫大家做個(gè)參考.

操作系統(tǒng)是Redhat Enterprise Linux 5.2,需連接數(shù)據(jù)庫,oracle安裝程序提供的客戶端太大了,有幾百M(fèi),如果只需要數(shù)據(jù)庫連接功能,可以使用instant client。下載以下3個(gè)包:

instantclient-basic-linux32-10.2.0.3-20061115.zip

instantclient-sdk-linux32-10.2.0.3-20061115.zip

instantclient-sqlplus-linux32-10.2.0.3-20061115.zip

sqlplus是用來檢驗(yàn)是否安裝成功的。依次解壓,得到一個(gè)統(tǒng)一的文件夾,instantclient_10_2。如我前面的文章DBArtisan無法加載OCI,配置好TNS_ADMIN、LD_LIBRARY_PATH等,復(fù)制.bashrc文件部分內(nèi)容如下:

export ORACLE_HOME=/usr/local/oracle

export TNS_ADMIN=$ORACLE_HOME/NETWORK/ADMIN

export LD_LIBRARY_PATH=$ORACLE_HOME

export SQLPATH=$ORACLE_HOME

export NLS_LANG=AMERICAN_AMERICA.ZHS16GBK

PATH=$PATH:$ORACLE_HOME

export PATH

找一個(gè)配置好的tnsnames.ora文件放到TNS_ADMIN變量設(shè)置的位置,也就是/usr/local/oracle/NETWORK/ADMIN目錄下。接下來就可以使用sqlplus驗(yàn)證是否安裝成功。當(dāng)我使用如下命令:sqlplus username/password@測(cè)試時(shí),系統(tǒng)提示段錯(cuò)誤 (segmentation fault)。有提示解決方法如下:

1. cd /usr/bin (as root)

2. mv gcc gcc.script

3. mv g++ g++.script

4. ln -s gcc32 gcc

5. ln -s g++32 g++

6. login as oracle software owner (make sure environment is correct)

7. cd $ORACLE_HOME/bin

8. relink all

首先,這個(gè)是64位系統(tǒng)的解決方法,其次,我在當(dāng)前l(fā)inux系統(tǒng)中找不到relink命令。后來,傳說中的高人又出現(xiàn)了,一頓檢查以后,得出結(jié)論如下,這個(gè)linux的內(nèi)核版本太高了,instant client這個(gè)版本可能還不支持,于是建議安裝instant client 11。

下載如下文件:

instantclient-basic-linux32-11.2.0.1.zip

instantclient-sdk-linux32-11.2.0.1.zip

instantclient-sqlplus-linux32-11.2.0.1.zip

操作步驟與上面一樣,其實(shí)配置已經(jīng)做好了,只需將原來instant client 的文件都刪除,替換成instant client 11的文件就行。再使用sqlplus測(cè)試,連接成功。

以下是討論不設(shè)置環(huán)境變量安裝Oracle instant client的內(nèi)容,先記錄下來,有空再嘗試。

Oracle's instructions specify setting LD_LIBRARY_PATH. This makes my application dependent on random users' configuration and is very troublesome to set up.

How can I avoid having to set any environment variables?

answer:Add the library path to /etc/ld.so.conf, then run /sbin/ldconfig. You don't need to set LD_LIBRARY_PATH for libraries installed in standard locations like /usr/lib because these locations are already configured in /etc/ld.so.conf.

-------------------------------------------------------? 昏哥線? -------------------------------------------------------------------

Oracle's instantclient installation instructions specify that the user set LD_LIBRARY_PATH. This is very troublesome to manage for multiple users.

To use the instantclient without setting any environment variables:

Download the instantclient distribution from oracle.com. For doing non-java software development, you will need (assuming Oracle 10.2): instantclient-basic-linux-x86_64-10.2.0.4.0.zip

instantclient-sdk-linux-x86_64-10.2.0.4.0.zip

instantclient-sqlplus-linux-x86_64-10.2.0.4.0.zip

Unzip the three files. This will give you a directory instantclient_10_2/

Copy the files to /usr, which is one of the default places the dynamic loader searches. sudo cp instantclient_10_2/sdk/include/*.h /usr/include

sudo cp instantclient_10_2/sqlplus ? ? ? ? /usr/bin

sudo cp instantclient_10_2/*.so* ? ? ? ? ? /usr/lib

If you use tnsnames.ora, copy it to /etc, which is the default global place the oracle runtime searches. sudo cp tnsnames.ora /etc

Test with /usr/bin/sqlplus scott/tiger@myoracle

-------------------------------------------------------? 昏哥線? -------------------------------------------------------------------

You could of course rename sqlplus to sqlplus.real and make a wrapper script: #!/bin/sh

if [ "$LD_LIBRARY_PATH" = "" ]

then

LD_LIBRARY_PATH=/what/ever

else

LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/what/ever

fi

export LD_LIBRARY_PATH

exec sqlplus.real ${1+"$@"}

-------------------------------------------------------? 昏哥線? -------------------------------------------------------------------

For anyone playing with Solaris (like me!) coming from a Linux background, I found that @David Phillips solution worked well using the Solaris command crle -u -l /opt/instantclient

總結(jié)

以上是生活随笔為你收集整理的linux下安装oracle instant client,linux下安装Oracle instant client的全部?jī)?nèi)容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網(wǎng)站內(nèi)容還不錯(cuò),歡迎將生活随笔推薦給好友。