问题的环境:
centos7.9 上安装在2个独立linux用户下的 oracle 11.2.0.4
2个独立linux用户分别是 oracle(oracle组)、oracle11g(oracle11g组)
现在,只在oracle用户下启动监听,可以发现2个用户下的实例都可以成功注册到监听中
but
属于oracle11g的service_names,根本无法从远程访问!!!
问题(故障现象):
E:\instantclient_11_2_0_4_0_x64>sqlplus sys/sys@192.168.75.157:1521/test as sysdba
SQL*Plus: Release 11.2.0.4.0 Production on Tue Jan 25 16:24:43 2022
Copyright (c) 1982, 2013, Oracle. All rights reserved.
ERROR:
ORA-12537: TNS:connection closed
Enter user-name:
ERROR:
ORA-12560: TNS:protocol adapter error
Enter user-name:
ERROR:
ORA-12560: TNS:protocol adapter error
SP2-0157: unable to CONNECT to ORACLE after 3 attempts, exiting SQL*Plus
##########################
[oracle11g@localhost admin]$ oerr ora 12516
12516, 00000, "TNS:listener could not find available handler with matching protocol stack"
// *Cause: None of the known and available service handlers for the given
// SERVICE_NAME support the client's protocol stack: transport, session,
// and presentation protocols.
// *Action: Check to make sure that the service handlers (e.g. dispatchers)
// for the given SERVICE_NAME are registered with the listener, are accepting
// connections, and that they are properly configured to support the desired
// protocols.
[oracle11g@localhost admin]$
分析过程:
从Oracle自己的文档内只是大概知道是tns协议、端口、甚至oracle服务器的会话数可能出问题了。
网上的资料也都是这几方面的内容。
但对于我的环境来说仍然无法解决问题。
最后,无奈,通过strace分析比较各自报错,并逐一分析关键文件的权限,终于发现问题
解决:
${ORACLE_HOME}/bin/oracle的权限 应该是【-rwsr-sr--x】,而有问题的oracle11g用户下的该文件权限是【-rwxr-xr--x】、或【-rwsr-x--x】
一个“s”之差!!!
修改为正确的权限,问题解决。
更进一步的结论:
linux下,不同oracle实例既可以使用同一个os的用户、也可以使用不同的os用户,甚至不同的os用户可以使用不同的os组。
你只要保证,启动listener的os用户可以访问到其他os用户的oracle安装实例的二进制文件“bin/oracle”的权限设置正确:即,合理设置了s权限。
linux的s权限知识: