iilegend 2017-01-16
安装Oracle服务端后,sqlplus命令以下错误。
oracle@linux:~/opt/oracle/product/11gR2/db/bin> sqlplus / as sysdba sqlplus: error while loading shared libraries: libsqlplus.so: cannot open shared object file: No such file or directory
1. 检查LD_LIBRARY_PATH这个环境变量,还是不行。
oracle@linux:echo $LD_LIBRARY_PATH /lib:/usr/lib 修改为实际的:/opt/oracle/product/11gR2/db/lib:/lib:/usr/lib:/opt/oracle/product/11gR2/db/rdbms/lib
2. 检查用户的组也没问题。
oracle@linux:~> id uid=1048(oracle) gid=120(oinstall) groups=120(oinstall),121(dba)
进入到sqlplus脚本路径下直接执行
oracle@linux:/opt/oracle/product/11gR2/db/bin> ./sqlplus ./sqlplus: error while loading shared libraries: libsqlplus.so: cannot open shared object file: No such file or directory
3.排查依赖的库是否有问题
oracle@linux:/opt/oracle/product/11gR2/db/bin> ldd /opt/oracle/product/11gR2/db/bin/sqlplus linux-gate.so.1 => (0xffffe000) libsqlplus.so => not found libclntsh.so.11.1 => not found libnnz11.so => not found libdl.so.2 => /lib/libdl.so.2 (0x555a8000) libm.so.6 => /lib/libm.so.6 (0x555ae000) libpthread.so.0 => /lib/libpthread.so.0 (0x555d6000) libnsl.so.1 => /lib/libnsl.so.1 (0x555f1000) libc.so.6 => /lib/libc.so.6 (0x5560a000) /lib/ld-linux.so.2 (0x55555000)
可以看到libsqlplus.so => not found
oracle@linux:/opt/oracle/product/11gR2/db/bin> relink all writing relink log to: /opt/oracle/product/11gR2/db/install/relink.log oracle@linux:/opt/oracle/product/11gR2/db/bin> sqlplus SQL*Plus: Release 11.2.0.3.0 Production on Tue Apr 15 04:57:09 2014 Copyright (c) 1982, 2011, Oracle. All rights reserved. Enter user-name: ^C oracle@linux:/opt/oracle/product/11gR2/db/bin> ldd /opt/oracle/product/11gR2/db/bin/sqlplus linux-gate.so.1 => (0xffffe000) libsqlplus.so => /opt/oracle/product/11gR2/db/lib/libsqlplus.so (0x55577000) libclntsh.so.11.1 => /opt/oracle/product/11gR2/db/lib/libclntsh.so.11.1 (0x55627000) libnnz11.so => /opt/oracle/product/11gR2/db/lib/libnnz11.so (0x57648000) libdl.so.2 => /lib/libdl.so.2 (0x578cc000) libm.so.6 => /lib/libm.so.6 (0x578d2000) libpthread.so.0 => /lib/libpthread.so.0 (0x578fa000) libnsl.so.1 => /lib/libnsl.so.1 (0x57915000) libc.so.6 => /lib/libc.so.6 (0x5792e000) libaio.so.1 => /lib/libaio.so.1 (0x57a8f000) /lib/ld-linux.so.2 (0x55555000)
sqlplus 依赖的库文件恢复正常,sqlplus可以使用。