Rac grid用户启停监听报错无权限

时间:2023-03-08 20:41:13

[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文件属主发生变化导致的。

Rac grid用户启停监听报错无权限

[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用户。