Linux下Oracle client(sqlplus)安裝和配置



分類專欄: Linux 數據庫 文章標簽: Linux Oracle Client sqlplus 方向鍵
版權
1、下載rpm包

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

[root@node1 ~]# ls
oracle-instantclient11.2-basic-11.2.0.4.0-1.x86_64.rpm  
oracle-instantclient11.2-devel-11.2.0.4.0-1.x86_64.rpm    
oracle-instantclient11.2-sqlplus-11.2.0.4.0-1.x86_64.rpm  
...

    1
    2
    3
    4
    5

2、安裝

[root@node1 ~]# rpm -ivh oracle-instantclient11.2-basic-11.2.0.4.0-1.x86_64.rpm
Preparing...                          ################################# [100%]
Updating / installing...
   1:oracle-instantclient11.2-basic-11################################# [100%]
[root@node1 ~]# rpm -ivh oracle-instantclient11.2-sqlplus-11.2.0.4.0-1.x86_64.rpm
Preparing...                          ################################# [100%]
Updating / installing...
   1:oracle-instantclient11.2-sqlplus-################################# [100%]
[root@node1 ~]# rpm -ivh oracle-instantclient11.2-devel-11.2.0.4.0-1.x86_64.rpm
Preparing...                          ################################# [100%]
Updating / installing...
   1:oracle-instantclient11.2-devel-11################################# [100%]
[root@node1 ~]#

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13

3、配置

[root@node1 ~]# mkdir -p /usr/lib/oracle/11.2/client64/network/admin

    1

[root@node1 ~]# vim /usr/lib/oracle/11.2/client64/network/admin/tnsnames.ora

    1

[root@node1 ~]# cat /usr/lib/oracle/11.2/client64/network/admin/tnsnames.ora
TPADCTEST =
  (DESCRIPTION =
    (ADDRESS_LIST =
      (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.1.81)(PORT = 1521))
    )
    (CONNECT_DATA =
      (SERVICE_NAME = TPADC)
    )
  )
[root@node1 ~]#

   

[root@node1 ~]# vi ~/.bashrc

    1

增加幾行

export  ORACLE_HOME=/usr/lib/oracle/11.2/client64
export  TNS_ADMIN=$ORACLE_HOME/network/admin
export  LD_LIBRARY_PATH=$ORACLE_HOME/lib
export  PATH=$ORACLE_HOME/bin:$PATH
export  NLS_LANG=AMERICAN_AMERICA.ZHS16GBK

    1
    2
    3
    4
    5

[root@node1 ~]# source ~/.bashrc

    1

4、運行SQLPlus

[root@node1 ~]# sqlplus

SQL*Plus: Release 11.2.0.4.0 Production on Tue May 22 14:45:50 2018

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

Enter user-name:

    1
    2
    3
    4
    5
    6
    7

[root@node1 ~]# sqlplus test/test@//192.168.1.81:1521/TPADC

SQL*Plus: Release 11.2.0.4.0 Production on Tue May 22 14:46:21 2018

Copyright (c) 1982, 2013, 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 options

SQL>

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12

5、Linux環境下Oracle SqlPlus中方向鍵問題的解決方法

(1)問題

SQL> ^[[A^[[A^[[B

    1

(2)安裝readline-devel

[root@node1 ~]# yum install readline-devel

    1

(3)下載rlwrap
http://rpm.pbone.net/index.php3/stat/4/idpl/30448081/dir/centos_7/com/rlwrap-0.42-1.1.x86_64.rpm.html

[root@node1 ~]# rpm -ivh rlwrap-0.42-1.1.x86_64.rpm
warning: rlwrap-0.42-1.1.x86_64.rpm: Header V3 RSA/SHA1 Signature, key ID 93680782: NOKEY
Preparing...                          ################################# [100%]
Updating / installing...
   1:rlwrap-0.42-1.1                  ################################# [100%]
[root@node1 ~]#

    1
    2
    3
    4
    5
    6

(4)運行sqlplus

[root@node1 ~]# rlwrap sqlplus test/test@//192.168.1.81:1521/TPADC

SQL*Plus: Release 11.2.0.4.0 Production on Tue May 22 15:00:18 2018

Copyright (c) 1982, 2013, 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 options

SQL>

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12

(5)別名

alias sqlplus=’rlwrap sqlplus’
alias rman=’rlwrap rman


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM