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

时间:2015-08-05 13:16:13

标签: linux oracle amazon-web-services amazon-ec2 sqlplus

过去几天我遇到了一个奇怪的问题。以下是详细信息。

我正在尝试在EC2(类似redhat)实例上安装oracle xe客户端。我使用aws提供的cloudformation进行此操作,它基本上首先启动实例,然后运行我们以root用户身份提供的所有脚本。安装时会打印以下错误消息:

案例1)当我尝试使用完整路径运行它时

/opt/oracle/product/11.2.0/xe/bin/sqlplus: error while loading shared libraries: libsqlplus.so: cannot open shared object file: No such file or directory

案例2)当我仅使用sqlplus关键字运行

sqlplus: command not found

Cloudformation将在启动后首先配置实例,然后只能,我可以登录到实例。现在,当我登录到实例时,sqlplus命令工作完美,没有任何问题。

当我回应环境变量等时,我得到了正确的输出。我也把所有东西都放在适当的地方。虽然配置我创建了多个用户,但他们也可以毫无问题地访问sqlplus。

以下是我尝试安装oracle xe的方式,因为我有类似的要求。

a)在$ HOME

中下载适用于Linux 64的Oracle 11.2 XE

b)解压缩你获得的zip文件

c)解压rpm文件的内容而不安装它(我们不需要在服务器上运行Oracle RDBMS)然后

        mkdir ~/Oracle11XE-binaries
        cd ~/Oracle11XE-binaries

        # extract all the binaries from the RPM (rather than installing the RPM)
        rpm2cpio ../Disk1/oracle-xe-11.2.0-1.0.x86_64.rpm  | cpio -idmv

        sudo mkdir /opt/oracle
        sudo mv u01/app/oracle/product /opt/oracle

        # clean up downloaded and extracted files (they are BIG)
        cd
        rm -rf Disk1 oracle-xe-11.2.0-1.0.x86_64.rpm.zip

        echo 'export ORACLE_HOME=/opt/oracle/product/11.2.0/xe
        export PATH=$PATH:$ORACLE_HOME/bin
        export LD_LIBRARY_PATH=$ORACLE_HOME/lib
        export TNS_ADMIN=$ORACLE_HOME/network/admin' | sudo tee /etc/profile.d/oracle.sh

        # source it so it takes effect in the current session
        . /etc/profile.d/oracle.sh
        ldconfig

我知道这个问题很常见,但我找不到任何方法。

下面是ldconfig -p的输出(如果需要,但它不包含libsqlplus.so)

 libz.so.1 (libc6,x86-64) => /lib64/libz.so.1
        libyaml-0.so.2 (libc6,x86-64) => /usr/lib64/libyaml-0.so.2
        libxtables.so.10 (libc6,x86-64) => /lib64/libxtables.so.10
        libxslt.so.1 (libc6,x86-64) => /usr/lib64/libxslt.so.1
        libxml2.so.2 (libc6,x86-64) => /usr/lib64/libxml2.so.2
        libxcb.so.1 (libc6,x86-64) => /usr/lib64/libxcb.so.1
        libxcb-xvmc.so.0 (libc6,x86-64) => /usr/lib64/libxcb-xvmc.so.0
        libxcb-xv.so.0 (libc6,x86-64) => /usr/lib64/libxcb-xv.so.0
        libxcb-xtest.so.0 (libc6,x86-64) => /usr/lib64/libxcb-xtest.so.0
        libxcb-xselinux.so.0 (libc6,x86-64) => /usr/lib64/libxcb-xselinux.so.0
        libxcb-xinerama.so.0 (libc6,x86-64) => /usr/lib64/libxcb-xinerama.so.0
        libxcb-xf86dri.so.0 (libc6,x86-64) => /usr/lib64/libxcb-xf86dri.so.0
        libxcb-xfixes.so.0 (libc6,x86-64) => /usr/lib64/libxcb-xfixes.so.0
        libxcb-xevie.so.0 (libc6,x86-64) => /usr/lib64/libxcb-xevie.so.0
        libxcb-sync.so.0 (libc6,x86-64) => /usr/lib64/libxcb-sync.so.0
        libxcb-shm.so.0 (libc6,x86-64) => /usr/lib64/libxcb-shm.so.0
        libxcb-shape.so.0 (libc6,x86-64) => /usr/lib64/libxcb-shape.so.0
        libxcb-screensaver.so.0 (libc6,x86-64) => /usr/lib64/libxcb-screensaver.so.0
        libxcb-res.so.0 (libc6,x86-64) => /usr/lib64/libxcb-res.so.0
        libxcb-render.so.0 (libc6,x86-64) => /usr/lib64/libxcb-render.so.0
        libxcb-record.so.0 (libc6,x86-64) => /usr/lib64/libxcb-record.so.0
        libxcb-randr.so.0 (libc6,x86-64) => /usr/lib64/libxcb-randr.so.0
        libxcb-glx.so.0 (libc6,x86-64) => /usr/lib64/libxcb-glx.so.0
        libxcb-dri2.so.0 (libc6,x86-64) => /usr/lib64/libxcb-dri2.so.0
        libxcb-dpms.so.0 (libc6,x86-64) => /usr/lib64/libxcb-dpms.so.0
        libxcb-damage.so.0 (libc6,x86-64) => /usr/lib64/libxcb-damage.so.0
        libxcb-composite.so.0 (libc6,x86-64) => /usr/lib64/libxcb-composite.so.0
        libwrap.so.0 (libc6,x86-64) => /lib64/libwrap.so.0
        libverto.so.0 (libc6,x86-64) => /usr/lib64/libverto.so.0
        libverto.so (libc6,x86-64) => /usr/lib64/libverto.so
        libverto-k5ev.so.0 (libc6,x86-64) => /usr/lib64/libverto-k5ev.so.0
        libverto-k5ev.so (libc6,x86-64) => /usr/lib64/libverto-k5ev.so
        libuuid.so.1 (libc6,x86-64) => /lib64/libuuid.so.1
        libutil.so.1 (libc6,x86-64, OS ABI: Linux 2.6.35) => /lib64/libutil.so.1
        libutempter.so.0 (libc6,x86-64) => /usr/lib64/libutempter.so.0
        libuser.so.1 (libc6,x86-64) => /usr/lib64/libuser.so.1
        libungif.so.4 (libc6,x86-64) => /usr/lib64/libungif.so.4
        libudev.so.0 (libc6,x86-64) => /lib64/libudev.so.0
        libtinfo.so.5 (libc6,x86-64) => /lib64/libtinfo.so.5
        libtic.so.5 (libc6,x86-64) => /usr/lib64/libtic.so.5
        libthread_db.so.1 (libc6,x86-64, OS ABI: Linux 2.6.35) => /lib64/libthread_db.so.1
        libtasn1.so.3 (libc6,x86-64) => /usr/lib64/libtasn1.so.3
        libsysfs.so.2 (libc6,x86-64) => /usr/lib64/libsysfs.so.2
        libstdc++.so.6 (libc6,x86-64) => /usr/lib64/libstdc++.so.6
        libssl3.so (libc6,x86-64) => /usr/lib64/libssl3.so
        libssl.so.10 (libc6,x86-64) => /usr/lib64/libssl.so.10
        libssh2.so.1 (libc6,x86-64) => /usr/lib64/libssh2.so.1
        libss.so.2 (libc6,x86-64) => /usr/lib64/libss.so.2
        libsqlite3.so.0 (libc6,x86-64) => /usr/lib64/libsqlite3.so.0
        libsoftokn3.so (libc6,x86-64) => /usr/lib64/libsoftokn3.so
        libsmime3.so (libc6,x86-64) => /usr/lib64/libsmime3.so
        libslang.so.2 (libc6,x86-64) => /usr/lib64/libslang.so.2
        libsepol.so.1 (libc6,x86-64) => /lib64/libsepol.so.1
        libselinux.so.1 (libc6,x86-64) => /usr/lib64/libselinux.so.1
        libsasl2.so.2 (libc6,x86-64) => /usr/lib64/libsasl2.so.2
        libruby.so.2.0 (libc6,x86-64) => /usr/lib64/libruby.so.2.0
        librt.so.1 (libc6,x86-64, OS ABI: Linux 2.6.35) => /lib64/librt.so.1
        librpmsign.so.1 (libc6,x86-64) => /usr/lib64/librpmsign.so.1
        librpmio.so.3 (libc6,x86-64) => /usr/lib64/librpmio.so.3
        librpmbuild.so.3 (libc6,x86-64) => /usr/lib64/librpmbuild.so.3
        librpm.so.3 (libc6,x86-64) => /usr/lib64/librpm.so.3
        libresolv.so.2 (libc6,x86-64, OS ABI: Linux 2.6.35) => /lib64/libresolv.so.2
        libreadline.so.6 (libc6,x86-64) => /lib64/libreadline.so.6
        libp11-kit.so.0 (libc6,x86-64) => /usr/lib64/libp11-kit.so.0
        libpython2.7.so.1.0 (libc6,x86-64) => /usr/lib64/libpython2.7.so.1.0
        libpython2.7.so (libc6,x86-64) => /usr/lib64/libpython2.7.so
        libpwquality.so.1 (libc6,x86-64) => /lib64/libpwquality.so.1
        libpthread.so.0 (libc6,x86-64, OS ABI: Linux 2.6.35) => /lib64/libpthread.so.0
        libpth.so.20 (libc6,x86-64) => /usr/lib64/libpth.so.20
        libpsl.so.0 (libc6,x86-64) => /usr/lib64/libpsl.so.0
        libproc-3.2.8.so (libc6,x86-64) => /lib64/libproc-3.2.8.so
        libpopt.so.0 (libc6,x86-64) => /lib64/libpopt.so.0
        libpng12.so.0 (libc6,x86-64) => /usr/lib64/libpng12.so.0
        libpng.so.3 (libc6,x86-64) => /usr/lib64/libpng.so.3
        libplds4.so (libc6,x86-64) => /lib64/libplds4.so
        libplc4.so (libc6,x86-64) => /lib64/libplc4.so
        libpipeline.so.1 (libc6,x86-64) => /usr/lib64/libpipeline.so.1
        libpcreposix.so.0 (libc6,x86-64) => /usr/lib64/libpcreposix.so.0
        libpcrecpp.so.0 (libc6,x86-64) => /usr/lib64/libpcrecpp.so.0
        libpcre.so.0 (libc6,x86-64) => /lib64/libpcre.so.0
        libpcprofile.so (libc6,x86-64, OS ABI: Linux 2.6.35) => /usr/lib64/libpcprofile.so
        libpci.so.3 (libc6,x86-64) => /lib64/libpci.so.3
        libparted-2.1.so.0 (libc6,x86-64) => /lib64/libparted-2.1.so.0
        libpanelw.so.5 (libc6,x86-64) => /usr/lib64/libpanelw.so.5
        libpanel.so.5 (libc6,x86-64) => /usr/lib64/libpanel.so.5
        libpamc.so.0 (libc6,x86-64) => /lib64/libpamc.so.0
        libpam_misc.so.0 (libc6,x86-64) => /lib64/libpam_misc.so.0
        libpam.so.0 (libc6,x86-64) => /lib64/libpam.so.0
        libopts.so.25 (libc6,x86-64) => /usr/lib64/libopts.so.25
        libopcodes-2.23.52.0.1-16.47.amzn1.so (libc6,x86-64) => /usr/lib64/libopcodes-2.23.52.0.1-16.47.amzn1.so
        libnuma.so.1 (libc6,x86-64) => /usr/lib64/libnuma.so.1
        libnss3.so (libc6,x86-64) => /usr/lib64/libnss3.so
        libnssutil3.so (libc6,x86-64) => /usr/lib64/libnssutil3.so
        libnsssysinit.so (libc6,x86-64) => /usr/lib64/libnsssysinit.so
        libnsspem.so (libc6,x86-64) => /usr/lib64/libnsspem.so
        libnssdbm3.so (libc6,x86-64) => /usr/lib64/libnssdbm3.so
        libnssckbi.so (libc6,x86-64) => /usr/lib64/libnssckbi.so
        libnss_nisplus.so.2 (libc6,x86-64, OS ABI: Linux 2.6.35) => /lib64/libnss_nisplus.so.2
        libnss_nis.so.2 (libc6,x86-64, OS ABI: Linux 2.6.35) => /lib64/libnss_nis.so.2
        libnss_hesiod.so.2 (libc6,x86-64, OS ABI: Linux 2.6.35) => /lib64/libnss_hesiod.so.2
        libnss_files.so.2 (libc6,x86-64, OS ABI: Linux 2.6.35) => /lib64/libnss_files.so.2
        libnss_dns.so.2 (libc6,x86-64, OS ABI: Linux 2.6.35) => /lib64/libnss_dns.so.2
        libnss_db.so.2 (libc6,x86-64, OS ABI: Linux 2.6.35) => /lib64/libnss_db.so.2
        libnss_compat.so.2 (libc6,x86-64, OS ABI: Linux 2.6.35) => /lib64/libnss_compat.so.2
        libnspr4.so (libc6,x86-64) => /lib64/libnspr4.so
        libnsl.so.1 (libc6,x86-64, OS ABI: Linux 2.6.35) => /lib64/libnsl.so.1
        libnih.so.1 (libc6,x86-64) => /lib64/libnih.so.1
        libnih-dbus.so.1 (libc6,x86-64) => /lib64/libnih-dbus.so.1
        libnewt.so.0.52 (libc6,x86-64) => /usr/lib64/libnewt.so.0.52
        libncursesw.so.5 (libc6,x86-64) => /lib64/libncursesw.so.5
        libncurses.so.5 (libc6,x86-64) => /lib64/libncurses.so.5
        libmp.so.3 (libc6,x86-64) => /usr/lib64/libmp.so.3
        libmount.so.1 (libc6,x86-64) => /lib64/libmount.so.1
        libmenuw.so.5 (libc6,x86-64) => /usr/lib64/libmenuw.so.5
        libmenu.so.5 (libc6,x86-64) => /usr/lib64/libmenu.so.5
        libmemusage.so (libc6,x86-64, OS ABI: Linux 2.6.35) => /usr/lib64/libmemusage.so
        libmagic.so.1 (libc6,x86-64) => /usr/lib64/libmagic.so.1
        libm.so.6 (libc6,x86-64, OS ABI: Linux 2.6.35) => /lib64/libm.so.6
        liblzma.so.5 (libc6,x86-64) => /usr/lib64/liblzma.so.5
        liblwres.so.80 (libc6,x86-64) => /usr/lib64/liblwres.so.80
        liblvm2cmd.so.2.02 (libc6,x86-64) => /lib64/liblvm2cmd.so.2.02
        liblvm2app.so.2.2 (libc6,x86-64) => /lib64/liblvm2app.so.2.2
        liblua-5.1.so (libc6,x86-64) => /usr/lib64/liblua-5.1.so
        libldif-2.4.so.2 (libc6,x86-64) => /lib64/libldif-2.4.so.2
        libldap_r-2.4.so.2 (libc6,x86-64) => /lib64/libldap_r-2.4.so.2
        libldap-2.4.so.2 (libc6,x86-64) => /lib64/libldap-2.4.so.2
        liblcms2.so.2 (libc6,x86-64) => /usr/lib64/liblcms2.so.2
        liblber-2.4.so.2 (libc6,x86-64) => /lib64/liblber-2.4.so.2
        libk5crypto.so.3 (libc6,x86-64) => /lib64/libk5crypto.so.3
        libkrb5support.so.0 (libc6,x86-64) => /lib64/libkrb5support.so.0
        libkrb5.so.3 (libc6,x86-64) => /lib64/libkrb5.so.3
        libkmod.so.2 (libc6,x86-64) => /usr/lib64/libkmod.so.2
        libkeyutils.so.1 (libc6,x86-64) => /lib64/libkeyutils.so.1
        libkdb5.so.6 (libc6,x86-64) => /usr/lib64/libkdb5.so.6
        libkadm5srv_mit.so.8 (libc6,x86-64) => /usr/lib64/libkadm5srv_mit.so.8
        libkadm5clnt_mit.so.8 (libc6,x86-64) => /usr/lib64/libkadm5clnt_mit.so.8
        libjpeg.so.62 (libc6,x86-64) => /usr/lib64/libjpeg.so.62
        libisccfg.so.82 (libc6,x86-64) => /usr/lib64/libisccfg.so.82
        libisccc.so.80 (libc6,x86-64) => /usr/lib64/libisccc.so.80
        libisc.so.83 (libc6,x86-64) => /usr/lib64/libisc.so.83
        libip6tc.so.0 (libc6,x86-64) => /lib64/libip6tc.so.0
        libip4tc.so.0 (libc6,x86-64) => /lib64/libip4tc.so.0
        libiptc.so.0 (libc6,x86-64) => /lib64/libiptc.so.0
        libidn.so.11 (libc6,x86-64) => /lib64/libidn.so.11
        libicuuc.so.50 (libc6,x86-64) => /usr/lib64/libicuuc.so.50
        libicutu.so.50 (libc6,x86-64) => /usr/lib64/libicutu.so.50
        libicutest.so.50 (libc6,x86-64) => /usr/lib64/libicutest.so.50
        libiculx.so.50 (libc6,x86-64) => /usr/lib64/libiculx.so.50
        libicule.so.50 (libc6,x86-64) => /usr/lib64/libicule.so.50
        libicui18n.so.50 (libc6,x86-64) => /usr/lib64/libicui18n.so.50
        libicuio.so.50 (libc6,x86-64) => /usr/lib64/libicuio.so.50
        libicudata.so.50 (libc6,x86-64) => /usr/lib64/libicudata.so.50
        libhistory.so.6 (libc6,x86-64) => /usr/lib64/libhistory.so.6
        libhesiod.so.0 (libc6,x86-64) => /usr/lib64/libhesiod.so.0
        libgthread-2.0.so.0 (libc6,x86-64) => /usr/lib64/libgthread-2.0.so.0
        libgssrpc.so.4 (libc6,x86-64) => /lib64/libgssrpc.so.4
        libgssapi_krb5.so.2 (libc6,x86-64) => /lib64/libgssapi_krb5.so.2
        libgpm.so.2 (libc6,x86-64) => /usr/lib64/libgpm.so.2
        libgpgme.so.11 (libc6,x86-64) => /usr/lib64/libgpgme.so.11
        libgpgme-pthread.so.11 (libc6,x86-64) => /usr/lib64/libgpgme-pthread.so.11
        libgpg-error.so.0 (libc6,x86-64) => /lib64/libgpg-error.so.0
        libgobject-2.0.so.0 (libc6,x86-64) => /usr/lib64/libgobject-2.0.so.0
        libgmpxx.so.4 (libc6,x86-64) => /usr/lib64/libgmpxx.so.4
        libgmp.so.3 (libc6,x86-64) => /usr/lib64/libgmp.so.3
        libgmodule-2.0.so.0 (libc6,x86-64) => /usr/lib64/libgmodule-2.0.so.0
        libglib-2.0.so.0 (libc6,x86-64) => /usr/lib64/libglib-2.0.so.0
        libgio-2.0.so.0 (libc6,x86-64) => /usr/lib64/libgio-2.0.so.0
        libgif.so.4 (libc6,x86-64) => /usr/lib64/libgif.so.4
        libgdbm.so.2 (libc6,x86-64) => /usr/lib64/libgdbm.so.2
        libgcrypt.so.11 (libc6,x86-64) => /usr/lib64/libgcrypt.so.11
        libgcc_s.so.1 (libc6,x86-64) => /lib64/libgcc_s.so.1
        libfreetype.so.6 (libc6,x86-64) => /usr/lib64/libfreetype.so.6
        libfreebl3.so (libc6,x86-64) => /lib64/libfreebl3.so
        libfreebl3.so (libc6,x86-64) => /usr/lib64/libfreebl3.so
        libformw.so.5 (libc6,x86-64) => /usr/lib64/libformw.so.5
        libform.so.5 (libc6,x86-64) => /usr/lib64/libform.so.5
        libfontenc.so.1 (libc6,x86-64) => /usr/lib64/libfontenc.so.1
        libfontconfig.so.1 (libc6,x86-64) => /usr/lib64/libfontconfig.so.1
        libfipscheck.so.1 (libc6,x86-64) => /usr/lib64/libfipscheck.so.1
        libffi.so.6 (libc6,x86-64) => /usr/lib64/libffi.so.6
        libe2p.so.2 (libc6,x86-64) => /usr/lib64/libe2p.so.2
        libext2fs.so.2 (libc6,x86-64) => /usr/lib64/libext2fs.so.2
        libexslt.so.0 (libc6,x86-64) => /usr/lib64/libexslt.so.0
        libexpat.so.1 (libc6,x86-64) => /lib64/libexpat.so.1
        libelf.so.1 (libc6,x86-64) => /usr/lib64/libelf.so.1
        libedit.so.0 (libc6,x86-64) => /usr/lib64/libedit.so.0
        libdns.so.81 (libc6,x86-64) => /usr/lib64/libdns.so.81
        libdmraid.so.1 (libc6,x86-64) => /lib64/libdmraid.so.1
        libdmraid.so (libc6,x86-64) => /lib64/libdmraid.so
        libdmraid-events-isw.so.1 (libc6,x86-64) => /lib64/libdmraid-events-isw.so.1
        libdmraid-events-isw.so (libc6,x86-64) => /lib64/libdmraid-events-isw.so
        libdl.so.2 (libc6,x86-64, OS ABI: Linux 2.6.35) => /lib64/libdl.so.2
        libdevmapper.so.1.02 (libc6,x86-64) => /lib64/libdevmapper.so.1.02
        libdevmapper-event.so.1.02 (libc6,x86-64) => /lib64/libdevmapper-event.so.1.02
        libdevmapper-event-lvm2thin.so (libc6,x86-64) => /lib64/libdevmapper-event-lvm2thin.so
        libdevmapper-event-lvm2snapshot.so (libc6,x86-64) => /lib64/libdevmapper-event-lvm2snapshot.so
        libdevmapper-event-lvm2raid.so (libc6,x86-64) => /lib64/libdevmapper-event-lvm2raid.so
        libdevmapper-event-lvm2mirror.so (libc6,x86-64) => /lib64/libdevmapper-event-lvm2mirror.so
        libdevmapper-event-lvm2.so.2.02 (libc6,x86-64) => /lib64/libdevmapper-event-lvm2.so.2.02
        libdbus-1.so.3 (libc6,x86-64) => /lib64/libdbus-1.so.3
        libdb-4.7.so (libc6,x86-64) => /lib64/libdb-4.7.so
        libdb-4.7.so (libc6,x86-64) => /usr/lib64/libdb-4.7.so
        libcurl.so.4 (libc6,x86-64) => /usr/lib64/libcurl.so.4
        libcryptsetup.so.4 (libc6,x86-64) => /lib64/libcryptsetup.so.4
        libcrypto.so.10 (libc6,x86-64) => /lib64/libcrypto.so.10
        libcrypt.so.1 (libc6,x86-64, OS ABI: Linux 2.6.35) => /lib64/libcrypt.so.1
        libcrack.so.2 (libc6,x86-64) => /usr/lib64/libcrack.so.2
        libcpupower.so.0 (libc6,x86-64) => /usr/lib64/libcpupower.so.0
        libcom_err.so.2 (libc6,x86-64) => /usr/lib64/libcom_err.so.2
        libcidn.so.1 (libc6,x86-64, OS ABI: Linux 2.6.35) => /lib64/libcidn.so.1
        libcap.so.2 (libc6,x86-64) => /lib64/libcap.so.2
        libcap-ng.so.0 (libc6,x86-64) => /lib64/libcap-ng.so.0
        libc.so.6 (libc6,x86-64, OS ABI: Linux 2.6.35) => /lib64/libc.so.6
        libbz2.so.1 (libc6,x86-64) => /lib64/libbz2.so.1
        libblkid.so.1 (libc6,x86-64) => /lib64/libblkid.so.1
        libbind9.so.80 (libc6,x86-64) => /usr/lib64/libbind9.so.80
        libbfd-2.23.52.0.1-16.47.amzn1.so (libc6,x86-64) => /usr/lib64/libbfd-2.23.52.0.1-16.47.amzn1.so
        libauparse.so.0 (libc6,x86-64) => /lib64/libauparse.so.0
        libaudit.so.1 (libc6,x86-64) => /lib64/libaudit.so.1
        libattr.so.1 (libc6,x86-64) => /lib64/libattr.so.1
        libassuan.so.0 (libc6,x86-64) => /usr/lib64/libassuan.so.0
        libasound.so.2 (libc6,x86-64) => /lib64/libasound.so.2
        libanl.so.1 (libc6,x86-64, OS ABI: Linux 2.6.35) => /lib64/libanl.so.1
        libaio.so.1.0.0 (libc6,x86-64) => /lib64/libaio.so.1.0.0
        libaio.so.1 (libc6,x86-64) => /lib64/libaio.so.1
        libacl.so.1 (libc6,x86-64) => /lib64/libacl.so.1
        libX11.so.6 (libc6,x86-64) => /usr/lib64/libX11.so.6
        libX11-xcb.so.1 (libc6,x86-64) => /usr/lib64/libX11-xcb.so.1
        libXtst.so.6 (libc6,x86-64) => /usr/lib64/libXtst.so.6
        libXrender.so.1 (libc6,x86-64) => /usr/lib64/libXrender.so.1
        libXi.so.6 (libc6,x86-64) => /usr/lib64/libXi.so.6
        libXfont.so.1 (libc6,x86-64) => /usr/lib64/libXfont.so.1
        libXext.so.6 (libc6,x86-64) => /usr/lib64/libXext.so.6
        libXau.so.6 (libc6,x86-64) => /usr/lib64/libXau.so.6
        libSegFault.so (libc6,x86-64, OS ABI: Linux 2.6.35) => /lib64/libSegFault.so
        libSM.so.6 (libc6,x86-64) => /usr/lib64/libSM.so.6
        libICE.so.6 (libc6,x86-64) => /usr/lib64/libICE.so.6
        libBrokenLocale.so.1 (libc6,x86-64, OS ABI: Linux 2.6.35) => /lib64/libBrokenLocale.so.1
        ld-linux-x86-64.so.2 (libc6,x86-64) => /lib64/ld-linux-x86-64.so.2

1 个答案:

答案 0 :(得分:2)

如果您的父脚本调用(但未提供)两个子脚本,则第一个子脚本所做的任何环境更改都不会影响父项或其他子项。

作为一个简单的例子,我们假设你有一个install.sh脚本,其中包含:

#!/bin/bash
install_oraclexe.sh
create_schema.sh

其中install_oraclexe.sh包含您在步骤c中显示的命令,包括使用. /etc/profile.d/oracle.sh获取环境脚本;并且create_schema.sh执行SQL * Plus。

install_oraclexe.sh内,环境被修改,PATH,LD_LIBRARY_PATH等可用,并且具有允许您稍后在同一子脚本中运行SQL * Plus的值。但是那些环境更改仅对该脚本可见。当它退出并且控制权传递回父脚本时,环境未被触及,并且它不知道孩子已经做了什么。然后,当它执行create_schema.sh脚本时,它仍然没有Oracle特定的环境设置,因此第二个子脚本也没有。

您可以将环境更改的源命令移动(或复制)到父脚本:

#!/bin/bash
install_oraclexe.sh
. /etc/profile.d/oracle.sh
create_schema.sh

或者更整齐地将其添加到create_schema.sh脚本中:

#!/bin/bash
. /etc/profile.d/oracle.sh
sqlplus ...

大概是因为您只是在安装客户端,而是连接到远程数据库并且已经使用了合适的连接字符串,因此您不需要export ORACLE_SID=...

不太相关,但从XE客户端安装程序中提取文件似乎有点奇怪;我会考虑使用更容易安装的Oracle Instant Client。这似乎只是它为其设计的那种分发方案。