---
title: "转：Ubuntu安装Oracle客户端"
author: "androider"
date: "2010-11-26T10:10:33Z"
tags: []
categories: ["数据库"]
slug: "ubuntu-oracle"
draft: false
lastmod: "2011-07-02T11:57:13Z"
id: 825190
url: "https://androider.iteye.com/blog/825190"
---

[http://329937021.iteye.com/blog/671182](http://329937021.iteye.com/blog/671182)

 

Ubuntu下安装oracle客户端 oracle-ex-client， 目的是为那些在ubuntu下使用sqlplus 

**1.环境**   
Ubuntu10.04   
**2.安装软件**   
  sudo apt-get install oracle-xe-client   
  若没有wget http://download.oracle.com/otn/linux/oracle10g/xe/10201/oracle-xe-client\_10.2.0.1-1.0\_i386.deb   
  sudo dpkg -i oracle-xe-client\_10.2.0.1-1.0\_i386.deb   
**3.配置环境**   
  在~/.bash\_profile中添加(bash shell)   
export ORACLE\_HOME=/usr/lib/oracle/xe/app/oracle/product/10.2.0/client   
export LD\_LIBRARY\_PATH=$ORACLE\_HOME/lib:$LD\_LIBRARY\_PATH   
export TNS\_ADMIN=/usr/lib/oracle   
export PATH=$PATH:$ORACLE\_HOME:$ORACLE\_HOME/bin   
**4.配置TNS**   
sudo vi /usr/lib/oracle/tnsnames.ora添加连接内容，例如   
UTFCE =   
  (DESCRIPTION =   
    (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.42.199)(PORT = 1521))   
    (CONNECT\_DATA =   
      (SERVER = DEDICATED)   
      (SERVICE\_NAME = utfce)   
    )   
  )   
**5.运行sqlplus测试**   
  boisheng@boisheng-laptop:~$ sqlplus /nolog   
测试出错，说需要libclntsh.so.11.1文件，到oracle 官方下载instantclient-basiclite-linux32-11.2.0.1.zip 解压后就有这个文件 然后把次文件拷贝到/usr/lib/oracle/xe/app/oracle/product/10.2.0/client/lib目录下 

这时候还会出现以下错误   
   SP2-1503: Unable to initialize Oracle call interface 

  SP2-0152: ORACLE may not be functioning properly。   
这是因为我们之安装了oracle 客户端，安装客户端默认的用户名和组为oracel / dba，而当前登录用户对安装路径下的某个文件没有读或者写权限（在这里我找不到是哪个文件，在安装oracle 服务器中是db\_1\\oracore\\zoneinfo\\timezone.dat）, 安装客户端我找不到哪个文件，我就直接修改了/usr/lib/下oracle文件夹对其他组用户的读写权限 chmod -R 777 oracle (或者chmod -R o+rw oracle)然后再启动sqlplus就不会出错了. 

**6.ubuntu下sqlplus上下光标键乱码解决方法** 

文章分类:数据库   
遇到如题所述的问题时，可以这样解决该问题： 

1 、安装插件： sudo apt-get install rlwrap 

2、在oracle用户下设置一个命令别名： alias sqlplus='rlwrap sqlplus' 

3、重新键入sqlplus命令即可尽情享用上下左右光标键了 

**7.oracle-xe-client 中文乱码的解决方案**   
在家目录下的.bashrc下面加上 export NLS\_LANG="Simplified Chinese\_china".UTF8

 

 

 

附：安装Sql Developer 在Ubuntu

 

For those who using UBUNTU as OS..here the step to install SQL Developer into your PC.

1\. Download free SQL developer from  oracle website..

[http://download.oracle.com/otn/java/sqldeveloper/sqldeveloper-1.5.4.59.4...](http://download.oracle.com/otn/java/sqldeveloper/sqldeveloper-1.5.4.59.40-1.noarch.rpm "http://download.oracle.com/otn/java/sqldeveloper/sqldeveloper-1.5.4.59.40-1.noarch.rpm")

you need to register your  oracle account here [https://profile.oracle.com/jsp/reg/createUser.jsp?src=135736&act=74](https://profile.oracle.com/jsp/reg/createUser.jsp?src=135736&act=74 "https://profile.oracle.com/jsp/reg/createUser.jsp?src=135736&act=74")

2.Install java JDK

2.1 Make sure your package is up to date, to do that run this command at terminal 

sudo apt-get update

2.2 sudo apt-get install sun-java6-jdk

3\. Change oracle rpm file to deb file

3.1 Install alien (if you dont have it) sudo apt-get install alien

3.2 change rpm file to deb file : sudo alien (your rpm file)

4.Install you deb file ..either double click on that file or in terminal type sudo dpkg - i (deb file)

5\. Setting your java path 

5.1 At terminal ..go to /opt/sqldeveloper/sqldeveloper/bin

5.2 sudo gedit  sqldeveloper.conf

5.3 add this line  " SetJavaHome /usr/lib/jvm/java-6-sun-1.6.0.13 " into sqldeveloper.conf,save and close

\** your java version might not same as sample here

6\. to run your sqldeveloper, open your terminal and type sqldeveloper

7.Enjoy your sql developer in UBUNTU .. :)