sqlplus执行错误的问题探究
时间:2022-07-22
本文章向大家介绍sqlplus执行错误的问题探究,主要内容包括其使用实例、应用技巧、基本知识点总结和需要注意事项,具有一定的参考价值,需要的朋友可以参考一下。
今天碰到个很诡异的问题,在装了Oracle Clinet的机器,不同路径下执行指令sqlplus,回显不同。
Oracle Client路径是/opt/app/oracle/instantclient_11_2,包含如下内容,
bash_profile相关配置,
export ORACLE_HOME=/opt/app/oracle/instantclient_11_2
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$ORACLE_HOME
export TNS_ADMIN=$ORACLE_HOME
export CLASSPATH=$ORACLE_HOME/ojdbc6.jar:./
export NLS_LANG="AMERICAN_AMERICA.ZHS16GBK"
export PATH=$PATH:$HOME/.local/bin:$HOME/bin:$SELF_ORACLE_HOME
如果在$ORACLE_HOME,执行sqlplus,提示错误,再次执行,会出core,
[test@localhost instantclient_11_2]$ cd /opt/app/oracle/instantclient_11_2
[test@localhost instantclient_11_2]$ sqlplus
Error 6 initializing SQL*Plus
SP2-0667: Message file sp1<lang>.msb not found
SP2-0750: You may need to set ORACLE_HOME to your Oracle software directory
如果在其他路径(非$ORACLE_HOME),执行sqlplus,回显正常,
[test@localhost instantclient_11_2]$ sqlplus
SQL*Plus: Release 11.2.0.4.0 Production on Wed Jul 22 17:48:07 2020
Copyright (c) 1982, 2013, Oracle. All rights reserved.
Enter user-name:
这是为什么?
通过strace发现了其中一些区别,sqlplus执行异常的strace片段,
[test@localhost instantclient_11_2]$ strace sqlplus
execve("/opt/app/oracle/instantclient_11_2/sqlplus", ["sqlplus"], [/* 29 vars */]) = 0
brk(NULL) = 0x1b20000
mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7f9cb847c000
access("/etc/ld.so.preload", R_OK) = -1 ENOENT (No such file or directory)
open("tls/x86_64/libsqlplus.so", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
open("tls/libsqlplus.so", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
open("x86_64/libsqlplus.so", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
open("libsqlplus.so", O_RDONLY|O_CLOEXEC) = 3
read(3, "177ELF211 3 >