0、zip格式
(0)下载地址:
a、Oracle官网
(1)安装过程:
a、将zip文件分别解压到/software/下,放在同一个目录instandclient_11_2/下
b、在/software/instandclient_11_2/文件夹下,创建network/admin/文件夹;
并在/software/instandclient_11_2/network/admin/目录下创建文件tnsnames.ora
[root@localhost admin]# cat tnsnames.ora zkl = (DESCRIPTION = (ADDRESS_LIST = (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.1.125)(PORT = 1521)) ) (CONNECT_DATA = (SID = orcl ) (SERVER=DEDICATED )
(INSTANCE_NAME = testdb1) )
c、在版本18.3之前,为Instant Client版本创建适当的链接。例如:
[root@localhost software]# cd /software/instantclient_11_2/ [root@localhost instantclient_11_2]# ln -s libclntsh.so.12.1 libclntsh.so [root@localhost instantclient_11_2]# ln -s libocci.so.12.1 libocci.so
d、向.bash_profile文件中添加如下代码:
//修改配置文件,直接在末未添加如下内容 [root@localhost software]# vi ~/.bash_profile export ORACLE_HOME=/software/instandclient_11_2 export PATH=$ORACLE_HOME:$PATH export ORACLE_SID=orcl export TNS_ADMIN=$ORACLE_HOME/network/admin export LD_LIBRARY_PATH=$ORACLE_HOME:$LD_LIBRARY_PATH #export NLS_LANG='simplified chinese_china'.ZHS16GBK export NLS_LANG='simplified chinese_china'.AL32UTF8 //重新加载配置文件生效 [root@localhost software]# source ~/.bash_profile
注:ORACLE_HOME是你自己的安装地址,NLS_LANG是显示的字符编码集格式。
e、如果不想将环境配置写在.bash_profile中,也可以直接在/etc/profile中配置
ORACLE_HOME=/software/instantclient_11_2 ORACLE_SID=orcl TNS_ADMIN=$ORACLE_HOME/network/admin LD_LIBRARY_PATH=$ORACLE_HOME:$LD_LIBRARY_PATH #export NLS_LANG='simplified chinese_china.ZHS16GBK' NLS_LANG='simplified chinese_china.AL32UTF8'
export PATH=$ORACLE_HOME:$ORACLE_SID:$TNS_ADMIN:$LD_LIBRARY_PATH:$NLS_LANG:$PATH
致此,你就可以放心的连接数据库了。
f、连接诶测试
[root@localhost instantclient_11_2]# sqlplus scott/tiger@//192.168.1.125:1521/testdb1 [root@localhost instantclient_11_2]# sqlplus scott/tiger@zkl
如果安装有啥问题,可以看哈这篇文章:https://www.cnblogs.com/zfox2017/p/6625918.html