解决sqlplus的segmentation fault或hang问题
生活随笔
收集整理的這篇文章主要介紹了
解决sqlplus的segmentation fault或hang问题
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
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
《新程序員》:云原生和全面數字化實踐50位技術專家共同創作,文字、視頻、音頻交互閱讀總結
以上是生活随笔為你收集整理的解决sqlplus的segmentation fault或hang问题的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: Spring3.1+SpringMVC3
- 下一篇: Does GATHER_STATS_JO