• <ins id="pjuwb"></ins>
    <blockquote id="pjuwb"><pre id="pjuwb"></pre></blockquote>
    <noscript id="pjuwb"></noscript>
          <sup id="pjuwb"><pre id="pjuwb"></pre></sup>
            <dd id="pjuwb"></dd>
            <abbr id="pjuwb"></abbr>

            大龍的博客

            常用鏈接

            統計

            最新評論

            linux配置oracle客戶端,sqlplus、sqlldr、exp、imp --- 轉

            如果有錯,謝謝指出!
            一、配置環境

             需要在安裝有oracle軟件的相同操作系統上獲取部分oracle的系統文件

            二、配置目標

            無需安裝oracle服務器或客戶端軟件,達到能使用以下功能的目標: 

            ? oci、occi、jdbc的支持

            ? tnsping

            ? sqlplus

            ? sqlldr

            ? exp

            ? imp 

            ? tkprof

            三、軟件下載

            http://www.oracle.com/technetwork/cn/database/features/instant-client/index-092699-zhs.html

            instantclient-basic-linux.x64-11.2.0.3.0

            instantclient-jdbc-linux.x64-11.2.0.3.0

            instantclient-sqlplus-linux.x64-11.2.0.3.0

            instantclient-sdk-linux.x64-11.2.0.3.0

            四、配置步驟

            配置各個功能都一樣,關鍵是環境變量的配置,根據自己實際情況配置,這些基本上都是在網上找的,關鍵環境變量做了改動

            1、配置sqlplus

            root用戶登錄,創建目錄:

            # mkdir -p /opt/oracle

            將所有軟件包解壓縮至/opt/oracle/下,所有文件將自動釋放至目錄/opt/oracle/instantclient_10_2/

            創建文件/opt/oracle/instantclient_10_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功能的測試用戶環境變量中,添加如下配置,這里一定要注意,如果你失敗了百分之八十都是這里的問題: 
            export ORACLE_HOME=/opt/oracle
            export NLS_LANG=AMERICAN_AMERICA.ZHS16GBK
            export ORACLE_IC_HOME=/opt/oracle/instantclient_11_2
            export ORACLE_HOME=$ORACLE_IC_HOME
            export TNS_ADMIN=$ORACLE_IC_HOME
            export PATH=$PATH:$HOME/bin:$ORACLE_IC_HOME
            export LD_LIBRARY_PATH=$ORACLE_IC_HOME:/usr/lib
            export ORACLE_SID=czjgbs //
            (
            需要連接的實例名稱)

            生效后,測試sqlplus

            $ sqlplus scott/tiger@ora215

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

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

            連接到:

            Oracle Database 10g Enterprise Edition Release 10.2.0.4.0 - 64bit Production

            With the Partitioning, Real Application Clusters, OLAP, Data Mining

            and Real Application Testing options

            SQL>  

            Oksqlplus工具可以使用了;

            2、配置tnsping

            下面我們在此基礎上增加tnsping工具

            回到root用戶,在其他裝有Oracle的機器上獲取必要的文件:

             

            # cd /opt/oracle/instantclient_10_2/

            # scp root@192.168.21.16:/oracle/orahome/product/10.2.0/bin/tnsping ./          //這是從其他安裝了oracle服務器的機子上拷貝文件過來,不一定非要通過這種方法,

            root@192.168.21.16's password:

            tnsping                                            100%   13KB  13.3KB/s   00:00   

            # mkdir-p network/mesg

            # cd network/mesg

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

            root@192.168.21.16's password:

            tnsus.msb                                      100%   46KB  46.0KB/s   00:00   

            #

             

            下面測試一下tnsping工具

             

            $ tnsping ora16

             

            TNS Ping Utility for Linux: Version 10.2.0.4.0 - Production on 03-8 -2012 11:03:39

             

            Copyright (c) 1997,  2007, Oracle.  All rights reserved.

             

            Used parameter files:

             

             

            Used TNSNAMES adapter to resolve the alias

            Attempting to contact (DESCRIPTION = (ADDRESS_LIST = (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.21.16)(PORT = 1521))) (CONNECT_DATA = (SID = neizxmdb1) (SERVER = DEDICATED)))

            OK (0 msec)

            $

             

            Oktnsping能正確運行了!

            3、配置sqlldr

            Oracleinstanct_client沒有自帶sqlldr工具,也要單獨獲取相關的文件:

             

            root用戶登錄:

            # cd /opt/oracle/instantclient_10_2/

            # scp root@192.168.21.16:/oracle/orahome/product/10.2.0/bin/sqlldr ./

            root@192.168.21.16's password:

            sqlldr                                            100%  717KB 717.5KB/s   00:00   

            # mkdir -p rdbms/mesg/

            # cd rdbms/mesg/

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

            root@192.168.21.16's password:

            ulus.msb                                         100%   37KB  37.0KB/s   00:00   

            #

             

            在測試用戶中運行sqlldr

            $ sqlldr

             

            SQL*Loader: Release 10.2.0.4.0 - Production on 星期五 8 3 11:20:04 2012

             

            Copyright (c) 1982, 2007, Oracle.  All rights reserved.

             

             

            Usage: SQLLDR keyword=value [,keyword=value,...]

             

            Valid Keywords:

            ……

            Sqlldr工具可以運行了

            4、配置impexp

            root用戶登錄:

             

            # cd /opt/Oracle/instantclient_10_2/

            # scp root@192.168.21.16:/oracle/orahome/product/10.2.0/bin/imp ./  

            root@192.168.21.16's password:

            imp                                               100%  348KB 348.3KB/s   00:00   

            # scp root@192.168.21.16:/oracle/orahome/product/10.2.0/bin/exp ./

            root@192.168.21.16's password:

            exp                                               100%  697KB 697.1KB/s   00:00   

            # cd rdbms/mesg/

            # scp root@192.168.21.16:/oracle/orahome/product/10.2.0/rdbms/mesg/impus.msb ./   

            root@192.168.21.16's password:

            impus.msb                                         100%   16KB  15.5KB/s   00:00   

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

            root@192.168.21.16's password:

            expus.msb                                         100%   17KB  16.5KB/s   00:00   

            #

            測試用戶下運行impexp

            $ imp

             

            Import: Release 10.2.0.4.0 - Production on 星期五 8 3 11:31:24 2012

             

            Copyright (c) 1982, 2007, Oracle.  All rights reserved.

             

            Username:

             

            $ exp

             

            Export: Release 10.2.0.4.0 - Production on 星期五 8 3 11:31:13 2012

             

            Copyright (c) 1982, 2007, Oracle.  All rights reserved.

             

             

            Username:

             

            Ok

             

             

            5、配置tkprof

            Tkprof是一個格式化sql trace文件的工具,在簡單客戶端中,我們也可以添加進來:

             

            root用戶登錄:

            # cd /opt/oracle/instantclient_10_2/

            # scp root@192.168.21.16:/oracle/orahome/product/10.2.0/bin/tkprof ./

            root@192.168.21.16's password:

            tkprof                                            100%  135KB 135.1KB/s   00:00   

            # mkdir -p oracore/mesg/

            # cd oracore/mesg/

            # scp root@192.168.21.16:/oracle/orahome/product/10.2.0/oracore/mesg/lrmus.msb ./

            root@192.168.21.16's password:

            lrmus.msb                                        100% 4608     4.5KB/s   00:00   

            #

             

            測試用戶下執行

            $ tkprof

            Usage: tkprof tracefile outputfile [explain= ] [table= ]

                          [print= ] [insert= ] [sys= ] [sort= ]

              table=schema.tablename   Use 'schema.tablename' with 'explain=' option.

              explain=user/password    Connect to ORACLE and issue EXPLAIN PLAN.

              print=integer    List only the first 'integer' SQL statements.

              aggregate=yes|no

              insert=filename  List SQL statements and data inside INSERT statements.

              sys=no           TKPROF does not list SQL statements run as user SYS.

              record=filename  Record non-recursive statements found in the trace file.

              waits=yes|no     Record summary for any wait events found in the trace file.

              sort=option      Set of zero or more of the following sort options:

            prscnt  number of times parse was called

            ……

             

            tkprof可以運行了

            posted on 2013-12-02 16:55 大龍 閱讀(5339) 評論(2)  編輯 收藏 引用

            評論

            # re: linux配置oracle客戶端,sqlplus、sqlldr、exp、imp --- 轉[未登錄] 2014-08-19 17:56 seven

            哪抄來的 上下文都不一致 版本都不統一  回復  更多評論   

            # re: linux配置oracle客戶端,sqlplus、sqlldr、exp、imp --- 轉 2015-07-20 09:23 wangst

            寫的太好了
            我這邊項目需要sqlldr,網上又下不到,可否幫忙傳一份給我
            qq郵箱:514025541@qq.com  回復  更多評論   

            久久精品人人做人人爽97 | 久久99精品久久久久久9蜜桃| 久久久久国产精品麻豆AR影院| 久久中文字幕精品| 97久久精品国产精品青草| 久久夜色精品国产www| 久久综合综合久久综合| 狠狠久久综合| 精品综合久久久久久97超人 | 久久精品国产亚洲av影院| 久久精品国产国产精品四凭 | 久久午夜综合久久| 久久久久人妻一区精品色| 亚州日韩精品专区久久久| 天天爽天天爽天天片a久久网| 久久婷婷五月综合成人D啪| 66精品综合久久久久久久| 无码国内精品久久人妻蜜桃| 中文字幕无码av激情不卡久久| 国产精品久久久天天影视香蕉 | 欧美麻豆久久久久久中文| AV无码久久久久不卡网站下载| 久久人人爽人人爽人人片AV麻烦| 久久精品无码一区二区三区日韩| 国产精品毛片久久久久久久| 亚洲人成网亚洲欧洲无码久久 | 欧美精品久久久久久久自慰| 三级片免费观看久久| 久久免费国产精品| 91久久精品国产91性色也| 久久国产精品成人影院| 少妇高潮惨叫久久久久久| 久久人人爽人人人人片av| 一本色综合久久| 精品国产日韩久久亚洲| 久久99热这里只频精品6| 亚洲国产日韩欧美久久| 狠狠色丁香久久婷婷综合图片| 亚洲美日韩Av中文字幕无码久久久妻妇 | 亚洲va久久久噜噜噜久久天堂| 久久精品国产男包|