简体   繁体   English

sqlplus:加载共享库时出错:libsqlplus.so:无法打开共享对象文件:没有这样的文件或目录

[英]sqlplus: error while loading shared libraries: libsqlplus.so: cannot open shared object file: No such file or directory

Please suggest a solution for solving this issue??请提出解决此问题的解决方案? While giving the command:在发出命令时:

sqlplus /nolog

the error that occurred:发生的错误:

 sqlplus: error while loading shared libraries:
 libsqlplus.so: cannot open shared object file: No such file or directory

The minimum configuration to properly run sqlplus from the shell is to set ORACLE_HOME and LD_LIBRARY_PATH .从 shell 正确运行sqlplus的最低配置是设置ORACLE_HOMELD_LIBRARY_PATH For ease of use, you might want to set the PATH accordingly too.为了便于使用,您可能还想相应地设置PATH

Assuming you have unzipped the required archives in /opt/oracle/instantclient_11_1 :假设您已经在/opt/oracle/instantclient_11_1解压了所需的档案:

$ export ORACLE_HOME=/opt/oracle/instantclient_11_1
$ export LD_LIBRARY_PATH="$ORACLE_HOME"
$ export PATH="$ORACLE_HOME:$PATH"

$ sqlplus

SQL*Plus: Release 11.1.0.7.0 - Production on Wed Dec 31 14:06:06 2014
...
sudo sh -c "echo /usr/lib/oracle/12.2/client64/lib > /etc/ld.so.conf.d/oracle-instantclient.conf";sudo ldconfig

来自https://help.ubuntu.com/community/Oracle%20Instant%20Client

I did solve this error by setting我确实通过设置解决了这个错误

export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$ORACLE_HOME/lib:$ORACLE_HOME

yes, not only $ORACLE_HOME/lib but $ORACLE_HOME too.是的,不仅是 $ORACLE_HOME/lib,还有 $ORACLE_HOME。

You should already have all needed variables in /etc/profile.d/oracle.sh .您应该已经在/etc/profile.d/oracle.sh拥有所有需要的变量。 Make sure you source it:确保你的来源:

$ source /etc/profile.d/oracle.sh

The file's content looks like:该文件的内容如下所示:

ORACLE_HOME=/usr/lib/oracle/11.2/client64
PATH=$ORACLE_HOME/bin:$PATH
LD_LIBRARY_PATH=$ORACLE_HOME/lib
export ORACLE_HOME
export LD_LIBRARY_PATH
export PATH

If you don't have it, create it and source it.如果您没有它,请创建它并获取它。

PERMISSIONS: I want to stress the importance of permissions for "sqlplus".权限:我想强调“sqlplus”权限的重要性。

  1. For any "Other" UNIX user other than the Owner/Group to be able to run sqlplus and access an ORACLE database , read/execute permissions are required (rx) for these 4 directories :对于所有者/组以外的任何“其他”UNIX 用户能够运行 sqlplus 并访问 ORACLE 数据库,这 4 个目录需要读取/执行权限 (rx):

    $ORACLE_HOME/bin , $ORACLE_HOME/lib, $ORACLE_HOME/oracore, $ORACLE_HOME/sqlplus $ORACLE_HOME/bin、$ORACLE_HOME/lib、$ORACLE_HOME/oracore、$ORACLE_HOME/sqlplus

  2. Environment.环境。 Set those properly:正确设置这些:

    A. ORACLE_HOME (example: ORACLE_HOME=/u01/app/oranpgm/product/12.1.0/PRMNRDEV/ ) A. ORACLE_HOME(例如: ORACLE_HOME=/u01/app/oranpgm/product/12.1.0/PRMNRDEV/

    B. LD_LIBRARY_PATH (example: ORACLE_HOME=/u01/app/oranpgm/product/12.1.0/PRMNRDEV/lib ) B. LD_LIBRARY_PATH(例如: ORACLE_HOME=/u01/app/oranpgm/product/12.1.0/PRMNRDEV/lib

    C. ORACLE_SID C. ORACLE_SID

    D. PATH D. 路径

     export PATH="$ORACLE_HOME/bin:$PATH"

I know it's an old thread, but I got into this once again with Oracle 12c and LD_LIBRARY_PATH has been set correctly.我知道这是一个旧线程,但是我再次使用 Oracle 12c 进行了讨论,并且 LD_LIBRARY_PATH 已正确设置。 I have used strace to see what exactly it was looking for and why it failed:我已经使用strace来查看它到底在寻找什么以及它失败的原因:

 strace sqlplus /nolog

sqlplus tries to load this lib from different dirs, some didn't exist in my install. sqlplus 尝试从不同的目录加载这个库,有些在我的安装中不存在。 Then it tried the one I already had on my LD_LIBRARY_PATH:然后它尝试了我在 LD_LIBRARY_PATH 上已有的那个:

open("/oracle/product/12.1.0/db_1/lib/libsqlplus.so", O_RDONLY) = -1 EACCES (Permission denied) open("/oracle/product/12.1.0/db_1/lib/libsqlplus.so", O_RDONLY) = -1 EACCES(权限被拒绝)

So in my case the lib had 740 permissions, and since my user wasn't an owner or didn't have oracle group assigned I couldn't read it.所以在我的例子中,lib 有 740 个权限,由于我的用户不是所有者或没有分配 oracle 组,我无法读取它。 So simple chmod +r helped.如此简单的chmod +r帮助了。

You can try usage:您可以尝试使用:

# echo "/usr/lib/oracle/12.2/client64/lib" > /etc/ld.so.conf.d/oracle.conf
# ldconfig

This problem are because oracleinstant client not configure shared library.这个问题是因为oracleinstant 客户端没有配置共享库。

您能否检查一下 LD_LIBRARY_PATH 是否指向 oracle 库

On Ubuntu Server 20.04 and using instant client version 19.10.0.0, I used alien to install the rpm package.在 Ubuntu Server 20.04 和使用即时客户端版本 19.10.0.0 上,我使用了 Alien 来安装 rpm 包。 I got this error when I just used the -i option.刚使用 -i 选项时出现此错误。 However when, I added -c I did not have this issue.但是,当我添加 -c 时,我没有这个问题。 from the man page for alien:从外星人的手册页:

-c, --scripts -c, --scripts
Try to convert the scripts that are meant to be run when the package is installed and removed.尝试转换要在安装和删除包时运行的脚本。 Use this with caution, because these scripts might be designed to work on a system unlike your own, and could cause problems.请谨慎使用,因为这些脚本可能被设计为在与您自己不同的系统上工作,并且可能会导致问题。 It is recommended that you examine the scripts by hand and check to see what they do before using this option.建议您在使用此选项之前手动检查脚本并检查它们的作用。

So it seems the correct configuration (in 19c) or the environment variables (in earlier versions) are set in these scripts which are not generated unless you run alien like this.因此,这些脚本中似乎设置了正确的配置(在 19c 中)或环境变量(在早期版本中),除非您像这样运行外星人,否则不会生成这些脚本。 (Thanks @Christopher Jones for correcting me on this) (感谢@Christopher Jones 在这方面纠正我)

sudo alien -i -c BasicPackage.rpm
sudo alien -i -c SqlPlus.rpm

It means you didn't set ORACLE_HOME and ORACLE_SID variables.这意味着您没有设置 ORACLE_HOME 和 ORACLE_SID 变量。 Kindly set proper working $ORACLE_HOME and $ORACLE_SID and after that execute sqlplus /nolog command.请设置正常工作的 $ORACLE_HOME 和 $ORACLE_SID,然后执行 sqlplus /nolog 命令。 It will be working.它将起作用。

Don't forget不要忘记

apt-get install libaio1 libaio-dev

or或者

yum install libaio

On Oracle's own Linux (Version 7.7, PRETTY_NAME="Oracle Linux Server 7.7" in /etc/os-release ), if you installed the 18.3 client libraries with在 Oracle 自己的 Linux(版本 7.7, PRETTY_NAME="Oracle Linux Server 7.7" in /etc/os-release )上,如果您安装了 18.3 客户端库

sudo yum install oracle-instantclient18.3-basic.x86_64
sudo yum install oracle-instantclient18.3-sqlplus.x86_64

then you need to put the following in your .bash_profile :那么你需要在你的.bash_profile加入以下内容:

export ORACLE_HOME=/usr/lib/oracle/18.3/client64
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$ORACLE_HOME/lib:$ORACLE_HOME

in order to be able to invoke the SQLPlus client, which, incidentally, is called sqlplus64 on this platform.为了能够调用 SQLPlus 客户端,顺便sqlplus64 ,它在此平台上称为sqlplus64

@laryx-decidua: I think you are only seeing the 18.x instant client releases that are in the ol7_oci_included repo. @ laryx-蜕膜:我想你只看到那些在该18.x即时客户端版本ol7_oci_included回购。 The 19.x instant client RPMs, at the moment, are only in the ol7_oracle_instantclient repo.目前,19.x 即时客户端 RPM 仅位于ol7_oracle_instantclient库中。 Easiest way to access that repo is:访问该存储库的最简单方法是:

yum install oracle-release-el7

这对我sudo dnf install libnslsudo dnf install libnsl

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 加载共享库时出错:libsqlplus.so:无法打开共享对象文件:没有这样的文件或目录 - Error while loading shared libraries: libsqlplus.so: cannot open shared object file: No such file or directory 加载共享库时出错:libreadline.so.7:无法打开共享对象文件:没有这样的文件或目录 - error while loading shared libraries: libreadline.so.7: cannot open shared object file: No such file or directory ctags:加载共享库时出错:libgpm.so.1:无法打开共享库文件:没有这样的文件或目录 - ctags: error while loading shared libraries: libgpm.so.1: cannot open shared object file: No such file or directory 加载共享库时出错:libiomp5.so:无法打开共享库文件:没有这样的文件或目录 - error while loading shared libraries: libiomp5.so: cannot open shared object file: No such file or directory 节点:加载共享库时出错:libstdc++.so.6:无法打开共享对象文件:没有这样的文件或目录 - node: error while loading shared libraries: libstdc++.so.6: cannot open shared object file: No such file or directory 加载共享库时出错:libgfortran.so.3:无法打开共享对象文件:没有这样的文件或目录 - error while loading shared libraries: libgfortran.so.3: cannot open shared object file: No such file or directory unrar:加载共享库时出错:libstdc ++。so.6:无法打开共享库文件:没有这样的文件或目录 - unrar: error while loading shared libraries: libstdc++.so.6: cannot open shared object file: No such file or directory Linux:加载共享库时出错:libQtSvg.so.4:无法打开共享对象文件:没有这样的文件或目录 - Linux: error while loading shared libraries: libQtSvg.so.4: cannot open shared object file: No such file or directory 加载共享库时出错:libPocoNet.so.60:无法打开共享对象文件:没有这样的文件或目录 - error while loading shared libraries: libPocoNet.so.60: cannot open shared object file: No such file or directory 加载共享库时出错:libgtk-3.so.0:无法打开共享库文件:没有这样的文件或目录 - error while loading shared libraries: libgtk-3.so.0: cannot open shared object file: No such file or directory
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM