• <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>

            大龍的博客

            常用鏈接

            統(tǒng)計

            最新評論

            linux配置oracle客戶端,sqlplus、sqlldr、exp、imp --- 轉(zhuǎn)

            如果有錯,謝謝指出!
            一、配置環(huán)境

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

            二、配置目標

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

            ? 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

            四、配置步驟

            配置各個功能都一樣,關(guān)鍵是環(huán)境變量的配置,根據(jù)自己實際情況配置,這些基本上都是在網(wǎng)上找的,關(guān)鍵環(huán)境變量做了改動

            1、配置sqlplus

            root用戶登錄,創(chuàng)建目錄:

            # mkdir -p /opt/oracle

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

            創(chuàng)建文件/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功能的測試用戶環(huán)境變量中,添加如下配置,這里一定要注意,如果你失敗了百分之八十都是這里的問題: 
            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

            下面我們在此基礎(chǔ)上增加tnsping工具

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

             

            # cd /opt/oracle/instantclient_10_2/

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

            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工具,也要單獨獲取相關(guān)的文件:

             

            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   

            #

             

            測試用戶下執(zhí)行

            $ 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 大龍 閱讀(5345) 評論(2)  編輯 收藏 引用

            評論

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

            哪抄來的 上下文都不一致 版本都不統(tǒng)一  回復(fù)  更多評論   

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

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


            只有注冊用戶登錄后才能發(fā)表評論。
            網(wǎng)站導(dǎo)航: 博客園   IT新聞   BlogJava   博問   Chat2DB   管理


            国产成人精品综合久久久| 久久久久人妻精品一区三寸蜜桃| 久久国产三级无码一区二区| 久久精品一区二区| 色综合久久久久综合体桃花网 | 伊人久久无码精品中文字幕| 久久精品国产亚洲AV高清热 | 99久久精品费精品国产| 久久午夜福利无码1000合集| 中文字幕一区二区三区久久网站| 国产激情久久久久影院老熟女免费| 亚洲综合精品香蕉久久网| 精品无码久久久久久午夜| 亚洲AV日韩AV天堂久久| 国产一区二区精品久久岳| 精品久久久久久国产| 免费精品久久久久久中文字幕| 999久久久免费国产精品播放| 一本久久a久久精品综合香蕉| 久久久精品人妻一区二区三区四| 久久97久久97精品免视看秋霞| 日产精品久久久一区二区| 久久久亚洲欧洲日产国码aⅴ| 久久精品一区二区影院 | 久久久久一区二区三区| 99久久精品日本一区二区免费| 亚洲欧美日韩精品久久亚洲区 | 午夜精品久久久久9999高清| 精品久久久久久无码免费| 性做久久久久久久| 久久精品亚洲AV久久久无码| 精品久久人妻av中文字幕| 久久国语露脸国产精品电影| 一个色综合久久| 久久婷婷五月综合色高清| 国产偷久久久精品专区| 久久午夜夜伦鲁鲁片免费无码影视| 日本国产精品久久| 欧美久久一区二区三区| 日批日出水久久亚洲精品tv| 日日狠狠久久偷偷色综合免费|