Oracle Instanc Client安裝命令工具,oracleinstanc

來源:互聯網
上載者:User

Oracle Instanc Client安裝命令工具,oracleinstanc
前提條件

1.Linux RHEL 6.X X86_64作業系統

2.能從安裝Oracle伺服器的伺服器上擷取Oracle相關的檔案(相同OS)

軟體下載

 從Oracle的網址下載下面的軟體包:

1)  instantclient-basic-linux.x64-11.2.0.4.0.zip (59.282MB)

2)instantclient-sqlplus-linux.x64-11.2.0.4.0.zip(815KB)

3)instantclient-sdk-linux.x64-11.2.0.4.0.zip(629KB)

4)instantclient-jdbc-linux.x64-11.2.0.4.0.zip(1.572MB)

Oracle軟體包的下載網址如下:

http://www.oracle.com/technetwork/topics/linuxx86-64soft-092277.html

配置過程

 配置過程關鍵是環境變數的配置,請根據自己實際情況進行配置。

配置SQLPLUS

1.使用root使用者登入,建立目錄:mkdir -p /opt/oracle

2.將所有的軟體包解壓到/opt/oracle目錄下:

# unzp instantclient-basic-linux.x64-11.2.0.4.0.zip-d /opt/oracle

註:所有檔案將自動解壓到/opt/oracle/instantclient_11_2目錄下。

3.建立設定檔a

#vi /opt/oracle/instantclie_11_2/tnsnames.ora

CZJGBS =

 (DESCRIPTION =

   (ADDRESS = (PROTOCOL = TCP)(HOST = 81.17.1.23)(PORT = 1521)) //需要串連的IP

   (CONNECT_DATA =

     (SERVER = DEDICATED)

     (SERVICE_NAME = czjgbs) //需要串連的執行個體

    )

  )

 

EXTPROC_CONNECTION_DATA =

 (DESCRIPTION =

   (ADDRESS_LIST =

     (ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1))

    )

   (CONNECT_DATA =

     (SID = PLSExtProc)

     (PRESENTATION = RO)

    )

  )

在需要使用Oracle功能的測試使用者環境變數中添加如下配置:

# vi ~/.bashrc

export NLS_LANG=AMERICAN_AMERICA.ZHS16GBK

export ORACLE_HOME=/opt/oracle/instantclient_11_2

export TNS_ADMIN=$ORACLE_HOME

export PATH=$PATH:$HOME/bin:$ORACLE_HOME

export LD_LIBRARY_PATH=$ORACLE_HOME:/usr/lib

export ORACLE_SID=czjgbs           // (需要串連的執行個體名稱)

註:TNS_ADMIN環境變數用於指定tnsnames.ora檔案所在路徑。

       #source ~/.bashrc

測試sqlplus命令:

$ sqlplus scott/tiger@ora215

SQL*Plus: Release 10.2.0.4.0 - Productionon 星期五 8月 3 10:41:44 2012

Copyright (c) 1982, 2007, Oracle.  All Rights Reserved.

 

Oracle Database 10g Enterprise EditionRelease 10.2.0.4.0 - 64bit Production

With the Partitioning, Real ApplicationClusters, OLAP, Data Mining

and Real Application Testing options

SQL>

配置tnsping

       回到root使用者,在其它Oracle機器上擷取必要的檔案。

# cd /opt/oracle/instantclient_11_2/

# scp root@192.168.21.16:/oracle/orahome/product/11.2.0/bin/tnsping./

上面的命令是從其他安裝Oracle伺服器的伺服器上拷貝檔案過來。

# mkdir -p network/mesg

# cd network/mesg

# scp root@192.168.21.16:/oracle/orahome/product/11.2.0/network/mesg/tnsus.msb./

 測試tnsping工具:

       $tnsping ora16

配置SQLLDR

       Oracle的InstantClient內建沒有sqlldr鞏固,也需要從Oracle伺服器上擷取相關檔案。

       使用root使用者登入:

# cd /opt/oracle/instantclient_11_2/

# scproot@192.168.21.16:/oracle/orahome/product/11.2.0/bin/sqlldr ./

# mkdir -p rdbms/mesg/

# cd rdbms/mesg/

# scp root@192.168.21.16:/oracle/orahome/product/11.2.0/rdbms/mesg/ulus.msb./

       測試使用者中運行sqlldr:

       $sqlldr

配置IMP/EXP

       使用root使用者登入,從Oracle伺服器上拷貝相關的檔案過來。

# cd /opt/oracle/instantclient_11_2/

# scp 192.168.21.16:/oracle/orahome/product/11.2.0/bin/imp./

# scp192.168.21.16:/oracle/orahome/product/11.2.0/bin/exp ./

# cd rdbms/mesg/

# scp192.168.21.16:/oracle/orahome/product/11.2.0/rdbms/mesg/impus.msb ./

# scp 192.168.21.16:/oracle/orahome/product/10.2.0/rdbms/mesg/expus.msb./

附錄

在Linux系統中安裝Oracle用戶端InstantClient,但是它缺少SQL*Loader、EXP等工具,本文描述如何安裝這些命令工具。

直接從相同版本的資料庫伺服器的安裝路徑中拷貝sqlldr可執行檔過來,執行sqlldr會報如下錯誤:

Message 2100 notfound; No message file for product=RDBMS, facility=ULMessage 2100 not found; Nomessage file for product=RDBMS, facility=UL[etl@m1 instantclient_10_2]$^C

實際上,Instant Client安裝sqlldr也只能使用拷貝檔案的方式。報上面的錯誤是因為你還需要拷貝下面這些資訊檔過來。

首先,從Oracle資料庫伺服器上找到$ORACLE_HOME/network/mesg下的tnsus.msb檔案,以及$ORACLE_HOME/rdbms/mesg下的ulus.msb檔案。

然後,把它們拷貝到InstantClient的安裝目錄中的相應目錄下。例如:/usr/ocal/instantclient_10_2/[rdbms/mesg和network/mesg]。

現在你可以使用SQL*Loader工具了。

如何配置EXP和imp工具,如果只是拷貝可執行檔到對應的目錄下,會報如下的錯誤:

Message 2100 notfound; No message file for product=RDBMS, facility=ULMessage 2100 not found; Nomessage file for product=RDBMS, facility=UL[etl@m1 instantclient_10_2]

此時,你需要從Oracle資料庫伺服器的安裝目錄中找到rdbms/mesg下的expus.msb和impus.msb,然後拷貝到對應的目錄中檔案即可解決。

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在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.