目录
sqlplus报错ORA-12547: TNS:lost contact解决
Oracle 19c RAC for Linux二节点sqlplus登录数据库报错ORA-12547: TNS:lost contact
1. 报错
[oracle@rac02 ~]$ sqlplus / as sysdba SQL*Plus: Release 19.0.0.0.0 - Production on Sun Jul 31 22:27:49 2022 Version 19.3.0.0.0 Copyright (c) 1982, 2019, Oracle. All rights reserved. ERROR: ORA-12547: TNS:lost contact Enter user-name: ERROR: ORA-12547: TNS:lost contact Enter user-name: ERROR: ORA-12547: TNS:lost contact SP2-0157: unable to CONNECT to ORACLE after 3 attempts, exiting SQL*Plus
复制
2. strace定位
[oracle@rac02 ~]$ strace -T -f sqlplus / as sysdba execve("/u01/app/oracle/product/19.0.0/dbhome_1/bin/sqlplus", ["sqlplus", "/", "as", "sysdba"], 0x7fffabe7fc98 /* 21 vars */) = 0 <0.000209> brk(NULL) = 0x81c000 <0.000013> mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7f5895224000 <0.000069> access("/etc/ld.so.preload", R_OK) = -1 ENOENT (No such file or directory) <0.000127> ...省略部分 [pid 7656] close(5) = 0 <0.000022> [pid 7656] stat("/u01/app/oracle/product/19.0.0/dbhome_1/rdbms/log", {st_mode=S_IFDIR|0755, st_size=8192, ...}) = 0 <0.000005> [pid 7656] stat("/u01/app/oracle/product/19.0.0/dbhome_1/rdbms/log/honor2_ora_7656.trc", 0x7ffc3952ff20) = -1 ENOENT (No such file or directory) <0.000033> [pid 7656] open("/u01/app/oracle/product/19.0.0/dbhome_1/rdbms/log/honor2_ora_7656.trc", O_WRONLY|O_CREAT|O_EXCL, 0660) = 5 <0.000082> [pid 7656] lstat("/u01/app/oracle/product/19.0.0/dbhome_1/rdbms/log/honor2_ora_7656.trc", {st_mode=S_IFREG|0640, st_size=0, ...}) = 0 <0.000053> ...省略部分 [pid 7656] write(5, "ORA-12753: The Oracle home user "..., 131) = 131 <0.000003> [pid 7656] write(5, "\n", 1) = 1 <0.000002> [pid 7656] write(5, "ORA-27300: OS system dependent o"..., 91) = 91 <0.000004> [pid 7656] write(5, "\n", 1) = 1 <0.000004> [pid 7656] write(5, "ORA-27301: OS failure message: E"..., 38) = 38 <0.000002> [pid 7656] write(5, "\n", 1) = 1 <0.000002> [pid 7656] write(5, "ORA-27302: failure occurred at: "..., 39) = 39 <0.000003> [pid 7656] write(5, "\n", 1) = 1 <0.000025> [pid 7656] write(5, "ORA-27303: additional informatio"..., 96) = 96 <0.000003> ...省略部分 write(1, "ORA-12547: TNS:lost contact\n", 28ORA-12547: TNS:lost contact ) = 28 <0.000004> ...省略部分
复制
从上面strace输出可以看出:
- 生成了trc文件
[oracle@rac02 ~]$ cat /u01/app/oracle/product/19.0.0/dbhome_1/rdbms/log/honor2_ora_7656.trc Dump file /u01/app/oracle/product/19.0.0/dbhome_1/rdbms/log/honor2_ora_7656.trc Build label: RDBMS_19.3.0.0.0DBRU_LINUX.X64_190417Oracle Database 19c Enterprise Edition Release 19.0.0.0.0 - Production Version 19.3.0.0.0 Build label: RDBMS_19.3.0.0.0DBRU_LINUX.X64_190417 ORACLE_HOME: /u01/app/oracle/product/19.0.0/dbhome_1 System name: Linux Node name: rac02 Release: 5.4.17-2102.201.3.el7uek.x86_64 Version: #2 SMP Fri Apr 23 09:05:55 PDT 2021 Machine: x86_64 Storage: ? Instance name: honor2 Redo thread mounted by this instance: 0 <none> Oracle process number: 0 Unix process pid: 7656, image: *** 2022-07-31T22:14:54.619409+08:00 ORA-12753: The Oracle home user ID does not match the effective user ID of the local client which connected to the Oracle instance. ORA-27300: OS system dependent operation:check $ORACLE_HOME ownership failed with status: 0 ORA-27301: OS failure message: Error 0 ORA-27302: failure occurred at: spstp:4 ORA-27303: additional information: ORACLE_HOME uid does not match euid. uid: 54322 euid: 54321
复制
- 报错ORA-12753、ORA-27300、ORA-27301、ORA-27302、ORA-27303
[oracle@rac02 ~]$ oerr ora 12753 12753,00000, "The Oracle home user ID does not match the effective user ID of the local client which connected to the Oracle instance." // *Document: YES // *Cause: The user ID that is the owner of the Oracle home directory was not // the same as the effective user ID of the local client that connected // to the Oracle instance. // *Action: Run the local client that connects to Oracle instance with the same // user ID as the owner of the Oracle home.
复制
3. 解决
- 从上面报错已经可以看出原因,由于ORACLE_HOME目录属主与客户端有效用户ID不同,我们去检查一下
[oracle@rac02 ~]$ cd $ORACLE_HOME [oracle@rac02 dbhome_1]$ ls -ld ../dbhome_1/ drwxrwxr-x. 69 grid oinstall 4096 Jul 24 01:11 ../dbhome_1/
复制
- 找到原因,解决就很简单了,修改属主即可
[root@rac02 log]# cd /u01/app/oracle/product/19.0.0/
[root@rac02 19.0.0]# chown oracle:oinstall dbhome_1/
[root@rac02 19.0.0]# su - oracle
Last login: Sun Jul 31 22:42:02 CST 2022 on pts/4
[oracle@rac02 ~]$ sqlplus / as sysdba
SQL*Plus: Release 19.0.0.0.0 - Production on Sun Jul 31 22:43:35 2022
Version 19.3.0.0.0
Copyright (c) 1982, 2019, Oracle. All rights reserved.
Connected to an idle instance.
SQL>
复制
最后修改时间:2022-08-04 15:18:53
「喜欢这篇文章,您的关注和赞赏是给作者最好的鼓励」
关注作者
【版权声明】本文为墨天轮用户原创内容,转载时必须标注文章的来源(墨天轮),文章链接,文章作者等基本信息,否则作者和墨天轮有权追究责任。如果您发现墨天轮中有涉嫌抄袭或者侵权的内容,欢迎发送邮件至:contact@modb.pro进行举报,并提供相关证据,一经查实,墨天轮将立刻删除相关内容。
评论
目录