1. 程式人生 > 其它 >Sqlplus報錯ORA-12547

Sqlplus報錯ORA-12547

一、問題現象

Linux Oracle Db11.2.0.4 OGG19.1

作業系統使用OGG使用者,啟動程序提示無法連線DB,OGG SQLPLUS報錯ORA 12547! Oracle使用者本地SQLPLUS正常!

二、問題處理

2.1 跟蹤日誌

https://www.cnblogs.com/historynote/p/13394557.html

$strace -f -o /tmp/trace.1.log $ORACLE_HOME/bin/sqlplus / as sysdba

$ tail -500 /tmp/trace.1.log

13021 times({tms_utime=10, tms_stime=4, tms_cutime=0, tms_cstime=0}) = 430640604
13021 close(3) = 0
13021 close(4) = 0

······

13018 open("/u01/app/oracle/product/11.2.0/dbhome_1//rdbms/mesg/oraus.msb", O_RDONLY) = 10
13018 fcntl(10, F_SETFD, FD_CLOEXEC) = 0
13018 lseek(10, 0, SEEK_SET) = 0
13018 read(10, "\25\23\"\1\23\3\t\t\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"..., 256) = 256
13018 lseek(10, 512, SEEK_SET) = 512
13018 read(10, "f\31\2603gJ>h\265z\342\207C\226]\310m\374\0\0\0\0\0\0\0\0\0\0\0\0\0\0"..., 512) = 512
13018 lseek(10, 1536, SEEK_SET) = 1536
13018 read(10, "q\31|\31\210\31\222\31\234\31\245\31\256\31\302\31\313\31\327\31/\32B\32X\32d\32s\32\207\32"..., 512) = 512
13018 lseek(10, 244736, SEEK_SET) = 244736
13018 read(10, "\r\0\3710\0\0V\0\3720\0\0k\0\3730\0\0\207\0\3740\0\0\245\0\3750\0\0\314\0"..., 512) = 512
13018 close(10) = 0
13018 write(1, "ERROR:\n", 7) = 7
13018 write(1, "ORA-12547: TNS:lost contact\n", 28) = 28
13018 write(1, "\n", 1) = 1
13018 write(1, "\n", 1) = 1

說實話這裡的日誌參考意義不大,沒有看出什麼毛病

排除了sqlnet.ora; 環境變數; 檔案許可權等呼叫,lib包等問題

2.2 MOS552979.1

SYMPTOMS
Oracle 10.2 has been installed in a new Oracle_Home
Preparing to perform post-upgrade steps
SQLPLUS command fails with following error ...
$ sqlplus /nolog
SQL*Plus: Release 10.2.0.1.0 - Production on Tue Feb 5 10:04
:01 2008 Copyright (c) 1982, 2005, Oracle. All rights reserved. ERROR: ORA-12547: TNS:lost contact Enter user-name: CHANGES CAUSE The make log shows a problem with config.o ... Linking OSM Discovery utility (kfod) ld +s -G -b -o libsrvm10.sl { LINK OPTIONS } /<$ORACLE_HOME>/rdbms/lib/config.o { LINK OPTIONS } ld: I/O error, file "/<$ORACLE_HOME>/rdbms /lib/config.o": Invalid argument Fatal error. *** Error exit code 1 Stop. On further diagnosis, it found that OH/bin/oracle binary is of zero file size ... $ ls -ld bin/ora* -rwsr-s--x 1 oracle dba 0 Aug 15 2005 bin/oracle -rwxr-xr-x 1 oracle dba 0 Jun 22 2005 bin/oracleO ... and the <$ORACLE_HOME>/rdbms/lib/config.o object file is zero filesize as well ... $ cd $ORACLE_HOME/rdbms/lib $ ls -l config* -rw-r----- 1 oracle dba 255 Jan 18 11:43 config.c -rw-r----- 1 oracle dba 0 Jan 18 11:53 config.o SOLUTION config.o was not generated during the installation, and it will not be re-compiled if it already exists. Remove the zero-length config.o
and then re-compile oracle as mentioned below $ cd $ORACLE_HOME/rdbms/lib $ rm config.o $ make -f ins_rdbms.mk config.o ioracle $ ls -l config* -rw-r----- 1 oracle dba 255 Jan 18 11:43 config.c -rw-r--r-- 1 oracle dba 1448 Feb 6 14:56 config.o $ cd $ORACLE HOME/bin $ ls -l oracle* -rwsr-s--x 1 oracle dba 112842648 Feb 6 14:57 oracle -rwsr-s--x 1 oracle dba 0 Aug 15 2005 oracleO Now, the problem should be solved and SQLPLUS should work.

實際環境與MOS並不是完全一致的!MOS有兩個檔案都為0,編譯後config.o檔案不為0;
實際情況,config.o檔案是非零值, oracle0為0,編譯後oracle0檔案非0
因為是測試環境,因此嘗試編譯後有效!但是生產環境建議甚至考慮! 又遇到相同trace跟蹤報錯的可以考慮進行嘗試,另外一個現象是這個測試庫使用-R mysql:mysql /修改許可權恢復導致本次的問題
and the <$ORACLE_HOME>/rdbms/lib/config.o object file is zero filesize as well

[oracle@t2 bin]$ ls -lrt oracle*
-rwxr-x---. 1 oracle oinstall 0 Aug 24 2013 oracleO
-rwxr-x--x. 1 oracle oinstall 239501456 Mar 27 2020 oracle

-rwxr-x--x. 1 oracle oinstall 239501456 Mar 27 2020 oracleO
-rwsr-s--x. 1 oracle oinstall 239501456 Jun 12 13:52 oracle


本次編譯過程中,測試庫單例項正在執行,DB alert存在告警!建議還是關庫執行!

Sat Jun 12 14:01:57 2021
WARNING: Oracle executable binary mismatch detected.
Binary of new process does not match binary which started instance
issue alter system set "_disable_image_check" = true to disable these messages