tnsping通但sqlplus连接不上的处理

遇到监听问题需要检查下列几项:

1.防火墙,selinux是否关闭

2.ping。是否网络是通的,

3.tnsping。目标库是否有服务,端口是否正确

4.listener。监听是否正常,service_name是否正确

5.session是否达到上限


这是我在检查监听的时候要检查的项目,但是今天的案例中,以上都是正确的,可sqlplus就是连不上2节点,1节点确实正常的。

dbmonitor:/home/oracle>sqlplus system/[email protected]:1521/ngjkdb1



SQL*Plus: Release 11.2.0.4.0 Production on Tue Feb 6 10:33:02 2018


Copyright (c) 1982, 2013, Oracle.  All rights reserved.


ERROR:
ORA-12537: TNS:connection closed


sqlplus连接失败
检查连接数


SQL> set lines 200 pages 200                          
 SQL> select *                                        
  from gv$resource_limit                         
 where resource_name in ('processes', 'sessions')
 order by resource_name, inst_id;                 
  2    3    4  
   INST_ID RESOURCE_NAME                  CURRENT_UTILIZATION MAX_UTILIZATION INITIAL_ALLOCATION   LIMIT_VALUE
---------- ------------------------------ ------------------- --------------- -------------------- --------------------
         1 processes                                       52              98       6000                 6000
         2 processes                                       49              54       6000                 6000
         1 sessions                                        62             106       9024                 9024
         2 sessions                                        58              66       9024                 9024

session未达到上限



检查监听
[grid@xsdbd32 ~]$ lsnrctl status LISTENER


LSNRCTL for Linux: Version 11.2.0.4.0 - Production on 06-FEB-2018 09:28:07


Copyright (c) 1991, 2013, Oracle.  All rights reserved.


Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=LISTENER)))
STATUS of the LISTENER
------------------------
Alias                     LISTENER
Version                   TNSLSNR for Linux: Version 11.2.0.4.0 - Production
Start Date                05-FEB-2018 22:21:54
Uptime                    0 days 11 hr. 6 min. 13 sec
Trace Level               off
Security                  ON: Local OS Authentication
SNMP                      OFF
Listener Parameter File   /grid/app/11.2.0/grid/network/admin/listener.ora
Listener Log File         /grid/app/grid/diag/tnslsnr/xsdbd32/listener/alert/log.xml
Listening Endpoints Summary...
  (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=LISTENER)))
  (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=10.174.80.11)(PORT=1521)))
  (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=10.174.80.159)(PORT=1521)))
Services Summary...
Service "+ASM" has 1 instance(s).
  Instance "+ASM2", status READY, has 1 handler(s) for this service...
Service "ngjkdb1" has 1 instance(s).
  Instance "ngjkdb12", status READY, has 1 handler(s) for this service...
Service "ngjkdb1XDB" has 1 instance(s).
  Instance "ngjkdb12", status READY, has 1 handler(s) for this service...
The command completed successfully
监听正常,service_name=ngjkdb1, 与我之前sqlplus连接写的service_name是一致的。

然后检查了防火墙和selinux,都处于关闭状态


目前还没找到原因,查看监听日志

[grid@xsdbd32 ~]$ less /grid/app/grid/diag/tnslsnr/xsdbd32/listener/trace/listener.log
19-JAN-2018 13:57:56 * service_update * +ASM2 * 0
19-JAN-2018 13:58:00 * * 12537
TNS-12537: TNS:connection closed
 TNS-12560: TNS:protocol adapter error

 查询了mos,这是连接请求故意断开导致,跟我们这里的监听没有关系。

那到底是什么原因呢?


最后我检查了$ORACLE_HOME/bin/oracle这个文件,这个文件的权限必须是6751

查询并对比了1节点的oracle权限,不对,使用chmod更改,结果如下

 [grid@xsdbd32 bin]$ ll oracle

-rwsr-s--x. 1 grid oinstall 210174664 Jan 26 11:28 oracle

之前的权限是751不是6751,权限显示为rwsr-x--x,需要在所属组加s权限

s 在文件执行时把进程的属主或组ID置为该文件的文件属主

再次sqlplus就可以连接上了

dbmonitor:/home/oracle/enmo/lzl>sqlplus system/[email protected]/ngjkdb1


SQL*Plus: Release 11.2.0.4.0 Production on Tue Feb 6 21:31:15 2018


Copyright (c) 1982, 2013, Oracle.  All rights reserved.


Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production
With the Partitioning, Real Application Clusters, Automatic Storage Management, OLAP,
Data Mining and Real Application Testing options


SQL> 


下次检查到类似的监听问题,需要检查oracle文件的权限

另外,很多情况都要检查oracle文件的权限,比如在打补丁后有集群起不来的情况,oracle的权限可能会更改,需要像上面那样赋权6751

下面是mos上的资料

Oracle Database Fails to Start with Error ORA-12547 (文档 ID 1307075.1)
ls -l$GRID_HOME/bin/oracle
-rwsr-s--x 1 gridoinstall 203974257 May 11 09:30 oracle
ls -l$ORACLE_HOME/bin/oracle
-rwsr-s--x 1oracle asmadmin 232399431 May 14 13:47 oracle





你可能感兴趣的:(ORACLE,LISTENER)