• Posts tagged "sqlplus"

Blog Archives

ubuntu装sqlplus比win要复杂的多!

首先,Ubuntu 12.04LTS,没有装Oracle的Server

$ uname -a
Linux conan 3.2.0-27-generic-pae
#43-Ubuntu SMP Fri Jul 6 15:06:05 UTC 2012 i686 i686 i386 GNU/Linux

 

下载Oracle Clinet rpm包
https://help.ubuntu.com/community/Oracle%20Instant%20Client

 

  • Download the Oracle Instantclient RPM files fromhttp://www.oracle.com/technetwork/database/features/instant-client/index-097480.html. Everyone needs either “Basic” or “Basic lite”, and most users will want “SQL*Plus” and the “SDK”.
  • Convert these .rpm files into .deb packages and install using “alien” (“sudo apt-get install alien” if you don’t have it):
    alien -i oracle-instantclient-basic*.rpm
    alien -i oracle-instantclient-sqlplus*.rpm
    alien -i oracle-instantclient-devel*.rpm

 

然后,设置 ldconfig

 

sudo vi /etc/ld.so.conf.d/oracle.conf
  • and add the oracle library path as the first line. For example,

 

/usr/lib/oracle/11.1.0.1/client/lib
  • or

 

/usr/lib/oracle/11.2/client/lib/
  • Then run ldconfig:
    sudo ldconfig

这时,执行sqlplus就不报缺少*.o的错误了。

找到client的安装目录,新建一个文件, tnsnames.ora,在这个文件配置相关的访问参数。

 

test=
(DESCRIPTION=
  (ADDRESS=(PROTOCOL=TCP)(HOST=192.168.1.1)(PORT+1521))
  (CONNECT_DATA=(SERVER=DEDICATED)(SERVICE_NAME=tea.tea))
)

然后,再设置环境变量TNS_ADMIN到clinet的安装目录

export TNS_ADMIN=/usr/lib/oracle/11.2/client/lib

 

都设置成功通过sqlplus启动
sqlplus username/password@test