Oracle 12.2简易客户端安装配置

简介:

安装Oracle客户端挺费时间的,而且大部分功能都用不到,Oracle官方给出了简易客户端,直接解压就可以使用,下载地址:http://www.oracle.com/technetwork/topics/linuxx86-64soft-092277.html

下面来看安装步骤:

1、下载安装包,我这里把所有的都下载下来了

instantclient-basic-linux.x64-12.2.0.1.0.zip

instantclient-basiclite-linux.x64-12.2.0.1.0.zip

instantclient-jdbc-linux.x64-12.2.0.1.0.zip

instantclient-odbc-linux.x64-12.2.0.1.0-2.zip

instantclient-sdk-linux.x64-12.2.0.1.0.zip

instantclient-sqlplus-linux.x64-12.2.0.1.0.zip

instantclient-tools-linux.x64-12.2.0.1.0.zip

2、unzip解压

解压出来一个目录instantclient_12_2

3、配置环境变量

export ORACLE_HOME=/home/tst1/instantclient_12_2

export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$ORACLE_HOME

export PATH=$ORACLE_HOME:$PATH

4、配置tns

1
2
3
4
5
6
7
8
9
10
11
[tst1@rhel7 instantclient_12_2]$  mkdir  -p network /admin
[tst1@rhel7 instantclient_12_2]$  cd  network /admin/
[tst1@rhel7 admin]$  cat  tnsnames.ora 
ora11g =
   (DESCRIPTION = 
     (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.56.22)(PORT = 1521))
     (CONNECT_DATA =
       (SERVER = DEDICATED)
       (SERVICE_NAME = ora11g)
     )
   )

5、测试sqlplus,成功

1
2
3
4
5
6
7
8
9
10
11
12
[tst1@rhel7 admin]$ sqlplus zx /zx @ora11g
 
SQL*Plus: Release 12.2.0.1.0 Production on Thu Nov 16 12:48:33 2017
 
Copyright (c) 1982, 2016, Oracle.  All rights reserved.
 
 
Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
 
SQL>

6、安装sqlldr,我安装的这个版本的简易客户端中有sqlldr,如果没有的话需要从其他客户端或服务端中拷贝,但是我测试执行sqlldr报错:

1
2
[tst1@rhel7 instantclient_12_2]$ sqlldr
Message 2100 not found; No message  file  for  product=RDBMS, facility=ULMessage 2100 not found; No message  file  for  product=RDBMS, facility=UL[tst1@rhel7 instantclient_12_2]$

因为缺少mesg文件,从服务端把rdbms/mesg下的文件全部拷贝

1
2
[tst1@rhel7 instantclient_12_2]$  mkdir  -p rdbms /mesg
[tst1@rhel7 instantclient_12_2]$  cp  /u01/app/oracle/product/12 .2 /db_home1/rdbms/mesg/ * rdbms /mesg/

再次执行sqlldr成功

7、安装oerr,简易客户端中没有oerr命令,需要从服务端拷贝

1
2
3
[tst1@rhel7 instantclient_12_2]$  cp  /u01/app/oracle/product/12 .2 /db_home1/bin/oerr  ./
[tst1@rhel7 instantclient_12_2]$ oerr
/home/tst1/instantclient_12_2/oerr : line 29:  /home/tst1/instantclient_12_2/perl/bin/perl : No such  file  or directory

执行报错,说明缺少文件,从服务端拷贝

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
[tst1@rhel7 instantclient_12_2]$  cp  -r  /u01/app/oracle/product/12 .2 /db_home1/perl/ * ./
[tst1@rhel7 instantclient_12_2]$  cp  -r  /u01/app/oracle/product/12 .2 /db_home1/perl/ * . /perl/
[tst1@rhel7 instantclient_12_2]$ oerr ora 1
Can't  open  perl script  "/home/tst1/instantclient_12_2/bin/oerr.pl" : (null)
[tst1@rhel7 instantclient_12_2]$  mkdir  bin
[tst1@rhel7 instantclient_12_2]$  scp  /u01/app/oracle/product/12 .2 /db_home1/bin/oerr .pl . /bin/
[tst1@rhel7 instantclient_12_2]$ oerr ora 1
Could not  open  facilities list  file /home/tst1/instantclient_12_2/lib/facility .lis
2
[tst1@rhel7 instantclient_12_2]$  mkdir  lib
[tst1@rhel7 instantclient_12_2]$  cp  /u01/app/oracle/product/12 .2 /db_home1/lib/facility .lis . /lib/
[tst1@rhel7 instantclient_12_2]$ oerr ora 1
00001, 00000,  "unique constraint (%s.%s) violated"
//  *Cause: An UPDATE or INSERT statement attempted to insert a duplicate key.
//          For Trusted Oracle configured  in  DBMS MAC mode, you may see
//          this message  if  a duplicate entry exists at a different level.
//  *Action: Either remove the unique restriction or  do  not insert the key.

注意:oerr也使用到了rdbms/mesg目录下的文件,只不过第6步把整个目录都拷贝过来了,这里就省事了。

8、安装tnsping,简易安装包里也没有这个工具,需要从服务端拷贝

1
2
3
4
5
6
7
8
[tst1@rhel7 instantclient_12_2]$  cp  /u01/app/oracle/product/12 .2 /db_home1/bin/tnsping  ./
[tst1@rhel7 instantclient_12_2]$ tnsping
 
TNS Ping Utility  for  Linux: Version 12.2.0.1.0 - Production on 16-NOV-2017 13:09:12
 
Copyright (c) 1997, 2016, Oracle.  All rights reserved.
 
TNS-03502: Message 3502 not found; No message  file  for  product=network, facility=TNS

执行报错,因为缺少mesg文件

1
2
3
4
5
6
7
8
9
10
11
12
[tst1@rhel7 instantclient_12_2]$  cp  -r  /u01/app/oracle/product/12 .2 /db_home1/network/mesg/  . /network/
[tst1@rhel7 instantclient_12_2]$ tnsping 192.168.56.22:1521 /ora11g
 
TNS Ping Utility  for  Linux: Version 12.2.0.1.0 - Production on 16-NOV-2017 13:11:04
 
Copyright (c) 1997, 2016, Oracle.  All rights reserved.
 
Used parameter files:
 
Used HOSTNAME adapter to resolve the  alias
Attempting to contact (DESCRIPTION=(CONNECT_DATA=(SERVICE_NAME=ora11g))(ADDRESS=(PROTOCOL=TCP)(HOST=192.168.56.22)(PORT=1521)))
OK (10 msec)

安装成功。

9、安装exp、imp、expdp、impdp,安装包中没有,直接从服务端拷贝

1
2
3
4
[tst1@rhel7 instantclient_12_2]$  cp  /u01/app/oracle/product/12 .2 /db_home1/bin/imp  ./
[tst1@rhel7 instantclient_12_2]$  cp  /u01/app/oracle/product/12 .2 /db_home1/bin/exp  ./
[tst1@rhel7 instantclient_12_2]$  cp  /u01/app/oracle/product/12 .2 /db_home1/bin/impdp  ./
[tst1@rhel7 instantclient_12_2]$  cp  /u01/app/oracle/product/12 .2 /db_home1/bin/expdp  ./

imp和exp测试没有问题,但expdp和impdp报错:

1
2
3
4
5
6
[tst1@rhel7 instantclient_12_2]$ expdp
 
Segmentation fault
[tst1@rhel7 instantclient_12_2]$ impdp
 
Segmentation fault

查询MOS找到解决方法,在环境变量中添加export NLS_LANG=American_America.ZHS16GBK

问题解决。

至此,简单客户端安装完成,可以把整个目录打个包,给其他机器安装时直接解压,配置环境变量就可以使用了。比安装客户端方便的多。

备注:

如果在使用某个工具报缺少库文件时可以使用ldd命令查看该命令缺少哪个库文件,如下所示:

1
2
3
4
5
6
7
8
9
10
[root@host77 instantclient_11_2] # ldd sqlldr
     linux-vdso.so.1 =>  (0x00007fffe63fe000)
     libclntsh.so.11.1 => not found
     libnnz11.so => not found
     libpthread.so.0 =>  /lib64/libpthread .so.0 (0x00007f014b85c000)
     libdl.so.2 =>  /lib64/libdl .so.2 (0x00007f014b658000)
     libm.so.6 =>  /lib64/libm .so.6 (0x00007f014b355000)
     libnsl.so.1 =>  /lib64/libnsl .so.1 (0x00007f014b13c000)
     libc.so.6 =>  /lib64/libc .so.6 (0x00007f014ad7b000)
     /lib64/ld-linux-x86-64 .so.2 (0x00007f014ba8b000)

从上面的输出可以看出缺少libclntsh.so.11.1和libnnz11.so这两个文件,从服务端拷贝即可。


参考:http://hanqunfeng.iteye.com/blog/1955277



      本文转自hbxztc 51CTO博客,原文链接http://blog.51cto.com/hbxztc/1982318:,如需转载请自行联系原作者




相关文章
|
2月前
|
Oracle 关系型数据库 数据库
使用docker安装配置oracle 11g
使用docker安装配置oracle 11g
|
8月前
|
SQL Oracle 关系型数据库
本机不安装Oracle客户端,使用PL/SQL Developer连接远程数据库
本机不安装Oracle客户端,使用PL/SQL Developer连接远程数据库
174 0
|
11月前
|
SQL 人工智能 Oracle
NineData支持全版本的企业级Oracle客户端,现已发布!
Oracle数据库是一款全球领先的关系型数据库管理系统,NineData发布对Oracle数据库的SQL开发支持。开发者可以使用NineData便捷查询云端、本地、多个版本的Oracle数据库。NineData在近期的迭代中提供了对Oracle数据库的支持。具有可视化工具、AI智能优化、SQL智能提示、企业协同等多种强大能力,并且无需安装,登录即可使用,同时在安全性上也为您提供了相当可靠的保障。
374 0
NineData支持全版本的企业级Oracle客户端,现已发布!
|
SQL Oracle 关系型数据库
Oracle19C客户端部署及远程访问
Oracle19C客户端部署及远程访问
1928 0
Oracle19C客户端部署及远程访问
|
8月前
|
SQL Oracle 关系型数据库
Oracle21C + PLSQL Developer 15 + Oracle客户端21安装配置完整图文版
Oracle21C + PLSQL Developer 15 + Oracle客户端21安装配置完整图文版
271 0
|
9月前
|
Oracle 关系型数据库 数据库连接
Windows系统安装配置Oracle数据库连接工具PLSQL
Windows系统安装配置Oracle数据库连接工具PLSQL
|
9月前
|
Oracle 关系型数据库 Java
分享一个 Oracle RAC 模式下客户端建立JDBC初始连接时因ONS造成应用启动时卡顿30秒问题的排查分析案例
分享一个 Oracle RAC 模式下客户端建立JDBC初始连接时因ONS造成应用启动时卡顿30秒问题的排查分析案例
|
11月前
|
SQL Oracle 关系型数据库
WSL 配置 Oracle 19c 客户端
作者介绍:金桔
164 0
|
Oracle 关系型数据库 数据库连接
Oracle 11g安装配置完美教程 - Windows(下)
Oracle 11g安装配置完美教程 - Windows(下)
229 0
|
SQL Oracle 安全
Oracle 11g安装配置完美教程 - Windows(上)
Oracle 11g安装配置完美教程 - Windows
1635 0

推荐镜像

更多