Linux sqlplus远程访问Oracle

2.安装OCI和OCI的SDK
在 ;http://www.oracle.com/technetwork/to<wbr>pics/linuxx8<wbr>6-64soft-092<;wbr>277.html</a>
需要下载:
oracle-instantclient11.2-basic-11.2.0.3.0-1.x86_64.rpm
oracle-instantclient11.2-basiclite-11.2.0.3.0-1.x86_64.rpm

oracle-instantclient11.2-devel-11.2.0.3.0-1.x86_64.rpm

;<span>oracle-instantclient11.2-sqlplus-11.2.0.3.0-1.x86_64.rpm

依次安装完成:

然后安装:aio

sudo apt-get install libaio-dev

配置环境变量

export ORACLE_HOME=/usr/lib/oracle/11.2/client64/bin
export LD_LIBRARY_PATH=/usr/lib/oracle/11.2/client64/lib
export PATH=$PATH:$ORACLE_HOME
export TNS_ADMIN=$ORACLE_HOME
export NLS_LANG=american_america.AL32UTF8   //设置语言

在 TNS_ADMIN环境变量的目录下建立 tnsnames.ora文件

内容:

# tnsnames.ora Network Configuration File: /home/oracle/oracle/product/10.2.0/db_1/network/admin/tnsnames.ora
TEST =  登陆的SID
(DESCRIPTION =
    (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.21.163)(PORT = 1521))  IP地址和端口号
    (CONNECT_DATA =
      (SERVER = DEDICATED)
      (SERVICE_NAME = orcl)  要链接数据库名
    )
)

EXTPROC_CONNECTION_DATA =
(DESCRIPTION =
    (ADDRESS_LIST =
      (ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1))
    )
    (CONNECT_DATA =
      (SID = PLSExtProc)
      (PRESENTATION = RO)
    )
)

登陆:

sqlplus userShangLian1/shangLian@TEST



你可能感兴趣的:(Linux sqlplus远程访问Oracle)