sqlplus应当是DBA 1.0时代使用最为频繁的管理工具,经常有经验丰富的老DBA会提到自己敲过几万次的sqlplus:),但有的时候这个吃饭家伙也会不好用,偶尔还会出现Segmentation fault错误,亦或者彻底hang住。在这里我介绍几种应对sqlplus无法正常使用的应对方法: 1.出现Segmentation fault,这种情况下一般是sqlplus 2进制文件被损坏了,可以通过重新build一个sqlplus来解决问题

[oracle@rh2 bin]$ sqlplus
Segmentation fault/* 使用$ORACLE_HOME/sqlplus/lib目录下的make文件,编译一个新的sqlplus */[oracle@rh2 ~]$ make -f $ORACLE_HOME/sqlplus/lib/ins_sqlplus.mk  newsqlplusLinking /s01/oracle/product/11.2.0/dbhome_1/sqlplus/bin/sqlplus
rm -f /s01/oracle/product/11.2.0/dbhome_1/sqlplus/bin/sqlplus
gcc -o /s01/oracle/product/11.2.0/dbhome_1/sqlplus/bin/sqlplus -m64
-L/s01/oracle/product/11.2.0/dbhome_1/sqlplus/lib/ -L/s01/oracle/product/11.2.0/dbhome_1/lib/
-L/s01/oracle/product/11.2.0/dbhome_1/lib/stubs/  /s01/oracle/product/11.2.0/dbhome_1/sqlplus/lib/s0afimai.o
-lsqlplus -lclntsh  `cat /s01/oracle/product/11.2.0/dbhome_1/lib/ldflags`    -lncrypt11 -lnsgr11 -lnzjs11
-ln11 -lnl11 -lnro11 `cat /s01/oracle/product/11.2.0/dbhome_1/lib/ldflags`    -lncrypt11 -lnsgr11 -lnzjs11
-ln11 -lnl11 -lnnz11 -lzt11 -lztkg11 -lztkg11 -lclient11 -lnnetd11  -lvsn11 -lcommon11 -lgeneric11 -lmm
-lsnls11 -lnls11  -lcore11 -lsnls11 -lnls11 -lcore11 -lsnls11 -lnls11 -lxml11 -lcore11 -lunls11 -lsnls11 -lnls11
-lcore11 -lnls11 `cat /s01/oracle/product/11.2.0/dbhome_1/lib/ldflags`    -lncrypt11 -lnsgr11 -lnzjs11 -ln11
-lnl11 -lnro11 `cat /s01/oracle/product/11.2.0/dbhome_1/lib/ldflags`    -lncrypt11 -lnsgr11 -lnzjs11 -ln11 -lnl11
-lclient11 -lnnetd11  -lvsn11 -lcommon11 -lgeneric11   -lsnls11 -lnls11  -lcore11 -lsnls11 -lnls11 -lcore11 -lsnls11
-lnls11 -lxml11 -lcore11 -lunls11 -lsnls11 -lnls11 -lcore11 -lnls11 -lclient11 -lnnetd11  -lvsn11
-lcommon11 -lgeneric11 -lsnls11 -lnls11  -lcore11 -lsnls11 -lnls11 -lcore11 -lsnls11 -lnls11 -lxml11
-lcore11 -lunls11 -lsnls11 -lnls11 -lcore11 -lnls11   `cat /s01/oracle/product/11.2.0/dbhome_1/lib/sysliblist`
-Wl,-rpath,/s01/oracle/product/11.2.0/dbhome_1/lib -lm -lpthread   `cat /s01/oracle/product/11.2.0/dbhome_1/lib/sysliblist`
-ldl -lm -lpthread  -L/s01/oracle/product/11.2.0/dbhome_1/lib
/bin/chmod 755 /s01/oracle/product/11.2.0/dbhome_1/sqlplus/bin/sqlplus
rm -f /s01/oracle/product/11.2.0/dbhome_1/bin/sqlplus
mv -f /s01/oracle/product/11.2.0/dbhome_1/sqlplus/bin/sqlplus /s01/oracle/product/11.2.0/dbhome_1/bin/sqlplus
/bin/chmod 751 /s01/oracle/product/11.2.0/dbhome_1/bin/sqlplus
rm -f /s01/oracle/product/11.2.0/dbhome_1/sqlplus/lib/libsqlplus.so
rm -rf /s01/oracle/product/11.2.0/dbhome_1/sqlplus/bin/sqlplus[oracle@rh2 ~]$ sqlplus  / as sysdbaSQL*Plus: Release 11.2.0.2.0 Production on Wed May 11 21:38:21 2011Copyright (c) 1982, 2010, Oracle.  All rights reserved.Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.2.0 - 64bit Production
With the Partitioning, Real Application Clusters, Automatic Storage Management, OLAP,
Data Mining and Real Application Testing options

2.出现sqlplus之后hang住的现象,hang的原因存在多种可能: 1)instance hanging数据库实例hang住,这种情况下sqlplus无法正常登陆到正hang的实例,而登陆到其他实例是可以的;若在10g以后版本中可以使用-prelim选项登陆实例,使用该选项登陆后无法执行普通的SQL语句,但可以使用oradebug内部调试工具,通过oradebug收集必要的hanganalyze信息后,可以进一步判断hang住的原因并决定下一步的操作。

[oracle@rh2 ~]$ sqlplus  / as sysdba
.............................we suspend here!!![oracle@rh2 ~]$ sqlplus  -prelim / as sysdbaSQL*Plus: Release 11.2.0.2.0 Production on Wed May 11 21:46:27 2011Copyright (c) 1982, 2010, Oracle.  All rights reserved.SQL> oradebug setmypid;
Statement processed.SQL> oradebug dump hanganalyze 4;
Statement processed.SQL> oradebug dump systemstate 266;
Statement processed.SQL> oradebug tracefile_name/s01/orabase/diag/rdbms/prod/PROD1/trace/PROD1_ora_23436.trc   -- where dump resides

将以上trc文件提交给Oracle Support或者资深的Oracle技术人员,以便他们分析出实例hang住的原因,通过调整参数或者修复bug可以避免再次出现类似的状况。 2)一执行sqlplus就出现挂起现象,甚至没有登陆任何数据库。一般这种情况是在读取sqlplus 2进制文件或其相关的共享库文件(.so文件)时遇到了问题,或者是在实际system call系统调用execve("sqlplus")时遇到了错误,一般我们可以使用系统跟踪工具strace(Linux)或truss(Unix)工具来分析这种挂起现象:

/* Unix */truss -o sqlplus_hang.log sqlplus/* Linux */strace -o sqlplus_hang.log sqlplushead -10 sqlplus_hang.logexecve("/s01/db_1/bin/sqlplus", ["sqlplus"], [/* 28 vars */]) = -1 ENOEXEC (Exec format error)

可以看到以上strace记录中发现了调用execve函数(execve() executes the program pointed to by filename)运行sqlplus程序时出现了ENOEXEC错误,该ENOEXEC错误代码说明我们正在执行一个格式无效的可执行文件,具体的解释如下:

This error indicates that a request has been made to execute a file which, although it has the
appropriate permissions, does not start with a valid magic number. A magic number is the first two
bytes in a file, used to determine what type of file it is.You tried to execute a file that is not in a valid executable format. The most common format for
binary programs under linux is called ELF. Note that your shell will run ascii files that have the
executable bit set as a shell script (ie run it as shell commands).You can reproduce this by doing$ dd if=/dev/random of=myfile bs=1k count=1 $ chmod +x myfile $ ./myfile zsh: exec format error: ./myfileNote that there is a very slight possibility that you could create a valid program that does
something bad to your system!!
Note, you can have user defined ways of running programs using Linux's binfmt_misc. See/usr/src/linux/Documentation/binfmt_misc.txt

to be continued ............

转载于:https://www.cnblogs.com/macleanoracle/archive/2013/03/19/2967767.html

解决sqlplus的segmentation fault或hang问题相关推荐

  1. yum 出错,提示Segmentation Fault (core Dumped) 的解决办法

    CentOS5.5部署Zlib导致yum使用不了,报错Yum Segmentation Fault (core Dumped) . 在一台CentOS.5.5的机器上使用Yum时突然报错,提示Yum ...

  2. TQ2440实现触摸屏和qt图形 解决segmentation fault

    使用触摸屏,首先安装触摸屏矫正程序. 下载并解压tslib-1.4,进入主文件夹,运行: 1 [root@localhost ~]#./autogen.sh 2 [root@localhost ~]# ...

  3. Segmentation fault (core dumped)分析解决

    Segmentation fault (core dumped)分段错误(核心转储) 出错原因 1.内存访问越界 (1)数组访问越界,因为下标超出了范围. (2)搜索字符串的时候,通过字符串的结尾符号 ...

  4. NVIDIA Jetson TK1 rosrun rviz segmentation fault的解决方法

    NVIDIA Jetson TK1 rosrun rviz segmentation fault的解决方法 在NVIDIA Jetson TK1开发版上运行rosrun rviz rviz出现segm ...

  5. 解决Program received signal SIGSEGV, Segmentation fault.的辛酸

    最近写一个算法很简单,涉及到链表的归并,在追求速度的时候,尽最大程度上使用了指针,然而却带来了异常灾难. 编译通过,在debug的时候,我看见了这个.....Program received sign ...

  6. Pycharm出现Segmentation fault...(interrupted by signal 11: SIGSEGV)的解决方法

    众所周知,用pycharm远程服务器debug代码已经成为学习深度学习相关代码的有力工具,但是最近创建了一个虚拟环境,进行debug的时候,莫名会出现下面这个错误,看的我都抽风了 bash: line ...

  7. C语言中用stop,C语言中It stop with signal SIGSEGV ,segmentation fault.解决方法

    C语言中It stop with signal SIGSEGV ,segmentation fault. 题目: 我的代码: #include #include typedef struct LNod ...

  8. Segmentation fault段错误出现原因分析及解决方法笔记

    Segmentation fault段错误出现原因分析及解决方法 1.局部变量的大小过大,超过栈分配的空间导致段错误,如double a[500][500], 解决方法:大数据不要放在栈区中,可以考虑 ...

  9. 【QA】Python代码调试之解决Segmentation fault (core dumped)问题

    Python代码调试之解决Segmentation fault 问题 问题描述 排查过程 1. 定位错误, 2. 解决办法 参考资料 问题描述 Python3执行某一个程序时,报Segmentatio ...

最新文章

  1. 计算机开不开机是什么原因是什么原因,电脑开不了机的原因,详细教您电脑开不了机怎么办...
  2. XHProf报告字段含义
  3. 在ubuntu下各种格式软件安装及常用命令
  4. @data注解不生效_你说啥什么?注解你还不会?
  5. 论文解读丨文档结构分析
  6. unity怎么bake地形上的植被_“烧烤”是quot;barbecuequot;,那“烤串”的英语怎么说?一定要看看!...
  7. 廖雪峰的python学习网址
  8. 令人赞叹的 MySQL
  9. C++ 返回值优化(RVO,Return Value Optimization)
  10. 晶体管开关电路的设计以及如何提高其开关速度
  11. Excel表格中如何换行
  12. ArcGIS地图制图教程——超详细
  13. Python_Dataframe_去除重复数据
  14. 后台推送消息给app_小米加入统一推送联盟!避免多种APP后台运行,国产手机春天来了...
  15. python文本txt词频统计_python实例:三国演义TXT文本词频分析
  16. 计算机主机故障有哪些,电脑主机电源常见的问题与解决方法_电脑故障
  17. 将mysql语句转换为sql_数据库-转换sql语句
  18. VS2019 C语言,在一个项目中添加多个包含main函数的源文件并分别调试运行
  19. 深度学习框架(如:Pytorch、Tensorflow、Caffe...)
  20. realplayer java_Realplayer控制参数

热门文章

  1. Swift中的一致性哈希算法(补充)
  2. 点分十进制IP转换为十进制数以及逆变换,JavaScript
  3. SpringCloud(一):深入理解Eureka
  4. .net通过获取客户端IP地址反查出用户的计算机名
  5. lvs+keepalived 集群
  6. 《C和C++代码精粹》——1.8 标准流
  7. JDK1.8源码阅读系列之二:LinkedList
  8. 修改RHEL7/centos7网卡为eth0
  9. C# WebBrowser document.execCommand()解析
  10. 《深入浅出设计模式-中文版》读书笔记-工厂模式(五)