linux安裝oracle用戶端,linuxoracle用戶端

來源:互聯網
上載者:User

linux安裝oracle用戶端,linuxoracle用戶端

1、準備好所需要的安裝包,http://www.oracle.com/technetwork/database/features/instant-client/index-097480.html這個網址有各種作業系統的用戶端

oracle-instantclient-basic-10.2.0.5-1.i386.rpm
oracle-instantclient-devel-10.2.0.5-1.i386.rpm
oracle-instantclient-jdbc-10.2.0.5-1.i386.rpm
oracle-instantclient-sqlplus-10.2.0.5-1.i386.rpm

先安裝oracle-instantclient-basic-10.2.0.5-1.i386.rpm,其他依次安裝

2、建立使用者、組和目錄

[root@wxcs-2 oracle]# groupadd oinstall
[root@wxcs-2 oracle]# groupadd dba
[root@wxcs-2 oracle]# useradd -g oinstall -G dba oracle    
[root@wxcs-2 oracle]# passwd oracle
Changing password for user oracle.
New UNIX password:
BAD PASSWORD: it is based on a dictionary word
Retype new UNIX password:
passwd: all authentication tokens updated successfully.
[root@wxcs-2 oracle]# mkdir -p /home/oracle/network/admin
[root@wxcs-2 oracle]# chown -R oracle:oinstall /home/oracle
[root@wxcs-2 oracle]# chmod -R 755 /home/oracle

3、將oracle伺服器上面的tnsnames.ora拷貝出來,放到/home/oracle/network/admin目錄下面。
4、修改環境變數

[oracle@wxcs-2 ~]$ vi .bash_profile

export ORACLE_HOME=/home/oracle
export SQLPATH=/home/oracle/network/admin
export TNS_ADMIN=/home/oracle/network/admin
export NLS_LANG="SIMPLIFIED CHINESE_CHINA.ZHS16GBK"
export LD_LIBRARY_PATH=/usr/lib/oracle/10.2.0.5/client/lib/:/usr/lib/oracle/10.2.0.5/client/lib:$LD_LIBRARY_PA
TH
export PATH=$PATH:$ORACLE_HOME:$LD_LIBRARY_PATH

[oracle@wxcs-2 ~]$ source .bash_profile 環境變數立即生效

5、可以正常串連oracle伺服器了

[oracle@wxcs-2 ~]$ sqlplus zhgy/zhgy@192.168.4.36/orcl

 


linux下安裝oracle伺服器後還可以安裝用戶端

你安裝伺服器時預設已經安裝了相應的用戶端工具了,不過再安裝用戶端也是可以的
 
怎在linux下安裝Oracle 用戶端

以root使用者安裝
rpm -ivh oracle-instantclient-basic-11.1.0.1-1.x86_64.rpm
rpm -ivh oracle-instantclient-sqlplus-11.1.0.1-1.x86_64.rpm配置
vim /etc/profile 添加
export ORACLE_HOME=/usr/lib/oracle/11.1.0.1/client64
export ORACLE_BASE=/usr/lib/oracle/11.1.0.1
export LD_LIBRARY_PATH=$ORACLE_HOME/lib:$LD_LIBRARY_PATH
export NLS_LANG=AMERICAN_AMERICA.AL32UTF8
設定好環境變數需要重啟機器!
建立設定檔
在ORACLE_HOME目錄下建立以下目錄network/admin,並建立檔案tnsnames.ora,內容如下:
vim /usr/lib/oracle/11.1.0.1/client64/network/admin/tnsnames.ora
# tnsnames.ora Network Configuration File: /opt/oracle10g/u01/network/admin/tnsnames.ora
# Generated by Oracle configuration tools.111 =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.15.111)(PORT = 1521)))
(CONNECT_DATA =
(SERVICE_NAME = dmsdb)))測試
到ORACLE_HOME/bin目錄下,執行命令:
[yleesun@centos bin]$ ./sqlplus zxd/zxd@111
Copyright (c) 1982, 2011, Oracle. All rights reserved.
Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing optionsSQL測試成功!註:
如果出現以下錯誤:
說明環境變數沒有生效!
 

相關文章

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.