[grid@max1 ~]$ lsnrctl stop
LSNRCTL for Linux: Version 11.2.0.3.0 - Production on 04-NOV-2016 00:20:54
Copyright (c) 1991, 2011, Oracle. All rights reserved.
Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=LISTENER)))
TNS-01190: The user is not authorized to execute the requested listener command
[root@max1 tmp]# srvctl start listener
PRCR-1079 : Failed to start resource ora.LISTENER.lsnr
CRS-5016: Process "/g01/11g/grid/bin/lsnrctl" spawned by agent "/g01/11g/grid/bin/oraagent.bin" for action "start" failed: details at "(:CLSN00010:)" in "/g01/11g/grid/log/max2/agent/crsd/oraagent_grid/oraagent_grid.log"
CRS-5016: Process "/g01/11g/grid/bin/lsnrctl" spawned by agent "/g01/11g/grid/bin/oraagent.bin" for action "start" failed: details at "(:CLSN00010:)" in "/g01/11g/grid/log/max2/agent/crsd/oraagent_grid/oraagent_grid.log"
CRS-2674: Start of 'ora.LISTENER.lsnr' on 'max2' failed
但是過一會lsnrctl status發現監聽起來了。
[root@max2 ~]# srvctl start listener -n max2
PRCR-1013 : Failed to start resource ora.LISTENER.lsnr
PRCR-1064 : Failed to start resource ora.LISTENER.lsnr on node max2
CRS-5016: Process "/g01/11g/grid/bin/lsnrctl" spawned by agent "/g01/11g/grid/bin/oraagent.bin" for action "start" failed: details at "(:CLSN00010:)" in "/g01/11g/grid/log/max2/agent/crsd/oraagent_grid/oraagent_grid.log"
CRS-5016: Process "/g01/11g/grid/bin/lsnrctl" spawned by agent "/g01/11g/grid/bin/oraagent.bin" for action "start" failed: details at "(:CLSN00010:)" in "/g01/11g/grid/log/max2/agent/crsd/oraagent_grid/oraagent_grid.log"
CRS-2674: Start of 'ora.LISTENER.lsnr' on 'max2' failed
[root@max2 ~]# lsnrctl status
LSNRCTL for Linux: Version 11.2.0.3.0 - Production on 04-NOV-2016 00:49:03
Copyright (c) 1991, 2011, Oracle. All rights reserved.
Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=LISTENER)))
TNS-12541: TNS:no listener
TNS-12560: TNS:protocol adapter error
TNS-00511: No listener
Linux Error: 111: Connection refused
查詢資料發現是由於在root用戶使用srvctl命令導致/var/tmp/.oracle或者/tmp/.oracle文件屬主發生變化導致的。
[oracle@max1 .oracle]$ ps -ef|grep 11521
grid 11521 1 0 03:01 ? 00:00:00 /g01/11g/grid/bin/tnslsnr LISTENER -inherit
oracle 13012 12634 0 03:47 pts/1 00:00:00 grep 11521
這些文件均是 socket 文件, 且s#11521.1 中的11521 為進程號,經查證是監聽的進程號
那么這些scoket 是用來干嘛的呢?
ODM find:
The hidden directory '/var/tmp/.oracle' (or /tmp/.oracle on some platforms) or its content was removed while instances & the CRS stack were up and running. Typically this directory contains a number of "special" socket files that are used by local clients to connect via the IPC protocol (sqlnet) to various Oracle processes including the TNS listener, the CSS, CRS & EVM daemons or even database or ASM instances. These files are created when the "listening" process starts.
就是說:這些socket 文被用作本地客戶端使用進程間通信協議(ipc)和不同的oracle的進程通信,而這些進程包括:tns 監聽,css ,crs,evm 守護進程;甚至數據庫和asm 實例。這些socket 由‘主動監聽’的進程創建。在這里oracle tns listener 創建這些socket 文件主要使用用作pmon 和 tnslsnr 通信從報錯信息里就可以看出問題.
chown -R grid:oinstall /var/tmp/.oracle
使用grid用戶srvctl start listener -n max2,正常。
所以平時操作集群建議使用grid用戶,不要使用root用戶。