在RHEL 5.5 x86 系統中安裝Oracle Instant Client具體步驟

來源:互聯網
上載者:User

前言

在學習Oracle的過程中,除了要安裝Oracle資料庫軟體以外,我們經常要在沒有Oracle資料庫環境的主機上安裝Oracle client,以便通過網路訪問Oracle伺服器。現在將在RHEL 5.5 x86 系統中安裝Oracle Instant Client具體步驟示範如下:

安裝環境:

在本文中,RHEL 5.5 x86是安裝在虛擬機器中,用secureCRT進行串連。

一 、下載安裝檔案

安裝檔案在Oracle官網有相應的,地址:http://www.oracle.com/technetwork/topics/linuxsoft-082809.html

找到本文中所對應的系統,進行下載。在本文中,筆者選擇下載一下三個檔案:

1、instantclient-basic-linux-11.2.0.3.0.zip(58,502,865 bytes) (cksum - 2164488682)
2、instantclient-sqlplus-linux-11.2.0.3.0.zip(796,570 bytes) (cksum - 3693267088)
3、nstantclient-sdk-linux-11.2.0.3.0.zip(639,306 bytes) (cksum - 3741058433)

二、將安裝檔案上傳到要安裝Oracle client的虛擬機器中
      在本文中,筆者用secureCRT的SFTP向RHEL 5.5 x86傳輸資料:

      sftp> lcd "~/Desktop/client /"
 
      sftp> lls
 
      instantclient-basic-linux-11.2.0.3.0.zip    instantclient-sdk-linux-11.2.0.3.0.zip
 
      instantclient-sqlplus-linux-11.2.0.3.0.zip  listener.ora
 
      sqlnet.ora            tnsnames.ora
 
      sftp> cd /home/oracle/
 
      sftp> put instantclient-basic-linux-11.2.0.3.0.zip 

      sftp> put instantclient-sdk-linux-11.2.0.3.0.zip
 
      sftp> put instantclient-sqlplus-linux-11.2.0.3.0.zip
      sftp> ls                                           
      instantclient-basic-linux-11.2.0.3.0.zip    instantclient-sdk-linux-11.2.0.3.0.zip
      instantclient-sqlplus-linux-11.2.0.3.0.zip
      至此,安裝檔案上傳完畢。
 
三、建立使用者
        [root@frank ~]# groupadd dba
        [root@frank ~]# groupadd oinstall
        [root@frank ~]# useradd -g oinstall -G dba oracle
        [root@frank ~]# 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@frank ~]# su - oracle
        [oracle@frank ~]$ vi .bash_profile
     
      # .bash_profile
        # Get the aliases and functions
        if [ -f ~/.bashrc ]; then
        . ~/.bashrc
        fi
        # User specific environment and startup programs
        PATH=$PATH:$HOME/bin
        export PATH
        export ORACLE_HOME=/home/oracle/instantclient_11_2
        export TNS_ADMIN=$ORACLE_HOME
        export LD_LIBRARY_PATH=$ORACLE_HOME:/usr/local/lib:${LD_LIBRARY_PATH}
        export SQLPATH=$ORACLE_HOME
        export PATH=$PATH:$ORACLE_HOME:/home/oracle/instantclient_11_2
        [oracle@frank ~]$ source .bash_profile
        至此,環境變數配置完畢。
 
五、解壓安裝檔案
        [oracle@frank ~]$ unzip instantclient-basic-linux-11.2.0.3.0.zip
        [oracle@frank ~]$ unzip instantclient-sdk-linux-11.2.0.3.0.zip
        [oracle@frank ~]$ unzip instantclient-sqlplus-linux-11.2.0.3.0.zip
        [oracle@frank ~]$ ls
        instantclient_11_2                        instantclient-sdk-linux-11.2.0.3.0.zip      oradiag_oracle
        instantclient-basic-linux-11.2.0.3.0.zip  instantclient-sqlplus-linux-11.2.0.3.0.zip
 
六、配置tnsname.ora檔案
      在這一步中,將要串連的資料庫的相關資訊配置在tnsname.ora中:
        [oracle@frank ~]$ cd instantclient_11_2/
        [oracle@frank instantclient_11_2]$ vi tnsnames.ora 

        # tnsnames.ora Network Configuration File:                 
        /u01/app/oracle/product/11.2.0/dbhome_1/network/admin/tnsnames.ora
        # Generated by Oracle configuration tools.
        ENMOEDU =
        (DESCRIPTION =
        (ADDRESS_LIST =
        (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.80.10)(PORT = 1521))
        )
        (CONNECT_DATA =
        (SERVICE_NAME = ENMOEDU)
        )
        )
        DUPL =
        (DESCRIPTION =
        (ADDRESS_LIST =
        (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.80.10)(PORT = 1521))
        )
        (CONNECT_DATA =
        (SERVICE_NAME = DUPL)
        )
        )
        退出儲存。至此,tnsname.ora配置成功。
 
七、測試連接
        [oracle@frank ~]$ sqlplus sys/oracle@ENMOEDU as sysdba
        SQL*Plus: Release 11.2.0.3.0 Production on Wed Mar 5 15:44:48 2014
        Copyright (c) 1982, 2011, Oracle.  All rights reserved.
        Connected to:
        Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - Production
        With the Partitioning, OLAP, Data Mining and Real Application Testing options
 
      SQL>
     
      測試成功。
      至此 Oracle instant client 全部配置成功。

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

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.