问题
After installing the oracle packages
oracle-instantclient12.2-basiclite-12.2.0.1.0-1.x86_64.rpm
and
oracle-instantclient12.2-tools-12.2.0.1.0-1.x86_64.rpm
with alien -i
I want to run the exp
utility, but I got an error
root@localhost:/usr/lib/oracle/12.2/client64/bin# ./exp
./exp: error while loading shared libraries: libclntsh.so.12.1: cannot open shared object file: No such file or directory
root@localhost:/usr/lib/oracle/12.2/client64/bin# export
declare -x DERBY_HOME="/usr/lib/jvm/java-8-oracle/db"
declare -x HOME="/root"
declare -x J2REDIR="/usr/lib/jvm/java-8-oracle/jre"
declare -x J2SDKDIR="/usr/lib/jvm/java-8-oracle"
declare -x JAVA_HOME="/usr/lib/jvm/java-8-oracle"
declare -x LANG="en_US.UTF-8"
declare -x LD_LIBRARY_PATH=":/usr/lib/oracle/12.2/client64/lib/libclntsh.so.12.1"
declare -x LESSCLOSE="/usr/bin/lesspipe %s %s"
declare -x LESSOPEN="| /usr/bin/lesspipe %s"
declare -x LOGNAME="root"
declare -x LS_COLORS="rs=0:di=01;34:ln=01;36:mh=00:pi=40;33:so=01;35:do=01;35:bd=40;33;01:cd=40;33;01:or=40;31;01:su=37;41:sg=30;43:ca=30;41:tw=30;42:ow=34;42:st=37;44:ex=01;32:*.tar=01;31:*.tgz=01;31:*.arj=01;31:*.taz=01;31:*.lzh=01;31:*.lzma=01;31:*.tlz=01;31:*.txz=01;31:*.zip=01;31:*.z=01;31:*.Z=01;31:*.dz=01;31:*.gz=01;31:*.lz=01;31:*.xz=01;31:*.bz2=01;31:*.bz=01;31:*.tbz=01;31:*.tbz2=01;31:*.tz=01;31:*.deb=01;31:*.rpm=01;31:*.jar=01;31:*.war=01;31:*.ear=01;31:*.sar=01;31:*.rar=01;31:*.ace=01;31:*.zoo=01;31:*.cpio=01;31:*.7z=01;31:*.rz=01;31:*.jpg=01;35:*.jpeg=01;35:*.gif=01;35:*.bmp=01;35:*.pbm=01;35:*.pgm=01;35:*.ppm=01;35:*.tga=01;35:*.xbm=01;35:*.xpm=01;35:*.tif=01;35:*.tiff=01;35:*.png=01;35:*.svg=01;35:*.svgz=01;35:*.mng=01;35:*.pcx=01;35:*.mov=01;35:*.mpg=01;35:*.mpeg=01;35:*.m2v=01;35:*.mkv=01;35:*.webm=01;35:*.ogm=01;35:*.mp4=01;35:*.m4v=01;35:*.mp4v=01;35:*.vob=01;35:*.qt=01;35:*.nuv=01;35:*.wmv=01;35:*.asf=01;35:*.rm=01;35:*.rmvb=01;35:*.flc=01;35:*.avi=01;35:*.fli=01;35:*.flv=01;35:*.gl=01;35:*.dl=01;35:*.xcf=01;35:*.xwd=01;35:*.yuv=01;35:*.cgm=01;35:*.emf=01;35:*.axv=01;35:*.anx=01;35:*.ogv=01;35:*.ogx=01;35:*.aac=00;36:*.au=00;36:*.flac=00;36:*.mid=00;36:*.midi=00;36:*.mka=00;36:*.mp3=00;36:*.mpc=00;36:*.ogg=00;36:*.ra=00;36:*.wav=00;36:*.axa=00;36:*.oga=00;36:*.spx=00;36:*.xspf=00;36:"
declare -x MAIL="/var/mail/root"
declare -x OLDPWD="/root"
declare -x PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/usr/lib/jvm/java-8-oracle/bin:/usr/lib/jvm/java-8-oracle/db/bin:/usr/lib/jvm/java-8-oracle/jre/bin"
declare -x PWD="/usr/lib/oracle/12.2/client64/bin"
declare -x SHELL="/bin/bash"
declare -x SHLVL="1"
declare -x SSH_CLIENT="212.166.58.203 58642 22"
declare -x SSH_CONNECTION="212.166.58.203 58642 139.162.221.107 22"
declare -x SSH_TTY="/dev/pts/0"
declare -x TERM="xterm-256color"
declare -x USER="root"
declare -x XDG_RUNTIME_DIR="/run/user/0"
declare -x XDG_SESSION_ID="10"
root@localhost:/usr/lib/oracle/12.2/client64/bin# find -L /usr/lib/oracle -name libclntsh.so.12.1
/usr/lib/oracle/12.2/client64/lib/libclntsh.so.12.1
root@localhost:/usr/lib/oracle/12.2/client64/bin#
回答1:
This is normally caused by your LD_LIBRARY_PATH
environment variable missing the Oracle libraries. You need to find the folder in which libclntsh.so.12.1
sits and set this environment variable.
Hopefully it's in your Oracle install directory, in which case you can do this:
find -L /usr/lib/oracle -name libclntsh.so.12.1
The -L switch of find follows symlinks. This is not the default behaviour, however, it's possible that libclntsh.so.12.1
is actually a symlink to libclntsh.so
.
If you can't find the file then you'll have to traverse your entire directory structure. It might be worth ditching the -L
switch for the first time...
find -L / -name libclntsh.so.12.1
Once you've found the file you need to set your LD_LIBRARY_PATH
. As just a one off you can use:
export LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:/usr/lib/oracle/lib
Where /usr/lib/oracle/lib
is replaced with the directory.
If you want to make this change permanent then the normal way on Ubuntu is to add a custom .conf
file to /etc/ld.so.conf
, see the question "Use shared libraries in /usr/local/lib" on Unix & Linux.
来源:https://stackoverflow.com/questions/47197810/running-oracle-imp-exp-in-ubuntu-14-04-3