1、安装oracle-instantclient:(默认安装即可)
oracle-instantclient12.1-sqlplus-12.1.0.1.0-1.x86_64.rpm
oracle-instantclient12.1-devel-12.1.0.1.0-1.x86_64.rpm
oracle-instantclient12.1-basic-12.1.0.2.0-1.x86_64.rpm
2、配置环境变量,修改/etc/profile,文件最后加入以下内容:
export ORACLE_HOME=/usr/lib/oracle/12.1/client64
export LD_LIBRARY_PATH=/usr/lib/oracle/12.1/client64/lib
export PATH=$ORACLE_HOME/bin:$PATH
3、配置监听
[root@rusky admin]# pwd
/usr/lib/oracle/12.1/client64/network/admin
[root@rusky admin]# ls----------这两个文件需要手工创建或从服务端拷贝过来,然后修改参数。
listener.ora sqlnet.ora tnsnames.ora //就这三个文件,放到这个目录下
==============================
listener.ora:
LISTENER =
(DESCRIPTION_LIST =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.1.111)(PORT = 1521))
)
)
SID_LIST_LISTENER =
(SID_LIST =
(SID_DESC =
(GLOBAL_DBNAME = orcl)
(ORACLE_HOME = /usr/lib/oracle/12.1/client64)
(SID_NAME = orcl)
)
)
ADR_BASE_LISTENER = /usr/lib/oracle/12.1/client64/network/admin
===================================
tnsnames.ora
orcl =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.1.111)(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = orcl)
)
)
4、连接oracle数据库
[root@rusky admin]# sqlplus /nolog;
SQL*Plus: Release 12.1.0.1.0 Production on Sun Sep 28 15:08:03 2014
Copyright (c) 1982, 2013, Oracle. All rights reserved.
SQL> conn rusky@orcl;
Enter password:
Connected.
SQL>