Linux 无法以 root 用户身份启动 Oracle 侦听器
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/10496026/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Unable to start Oracle listener as root user
提问by Anjali
I want to start Oracle Listner as root user. I am able to start listener as oracle user. But its not starting as root user. I am able to stop and check status as root user.
我想以 root 用户身份启动 Oracle Listner。我能够以 oracle 用户身份启动侦听器。但它不是以 root 用户身份启动的。我能够以 root 用户身份停止并检查状态。
When I start listener as root it gives following messages:-
当我以 root 身份启动侦听器时,它会提供以下消息:-
# lsnrctl start
LSNRCTL for Linux: Version 10.2.0.1.0 - Production on 08-MAY-2012 15:08:11
Copyright (c) 1991, 2005, Oracle. All rights reserved.
Starting /opt/oracle/102/bin/tnslsnr: please wait...
/opt/oracle/102/bin/tnslsnr: error while loading shared libraries: libclntsh.so.10.1: cannot open shared object file: No such file or directory
TNS-12547: TNS:lost contact
TNS-12560: TNS:protocol adapter error
TNS-00517: Lost contact
Linux Error: 32: Broken pipe
Please help me to start listener as root user.
请帮助我以 root 用户身份启动侦听器。
回答by ik_zelf
You should not run Oracle as root user, it's a security risk. There is not a single reason to run the rdbms and/or the listener as root user, unless you completely messed up the installation, that also is not even allowed to run as root.
您不应该以 root 用户身份运行 Oracle,这是一个安全风险。没有任何理由以 root 用户身份运行 rdbms 和/或侦听器,除非您完全搞砸了安装,甚至不允许以 root 身份运行。
If you do feel a need to run the listener as root user, make sure that your environment variables are correct. In your case:
如果您确实需要以 root 用户身份运行侦听器,请确保您的环境变量是正确的。在你的情况下:
# export ORACLE_HOME=/opt/oracle/102
# export PATH=$PATH:$ORACLE_HOME/bin
# cd $ORACLE_HOME/bin
# chmod u+s lsnrctl
# lsnrctl start
LSNRCTL for Linux: Version 10.2.0.5.0 - Production on 09-MAY-2012 20:51:07
适用于 Linux 的 LSNRCTL:版本 10.2.0.5.0 - 2012 年 5 月 9 日 20:51:07 生产
Copyright (c) 1991, 2010, Oracle. All rights reserved.
Starting /data/oracle/base/product/se_10205_s/bin/tnslsnr: please wait...
TNSLSNR for Linux: Version 10.2.0.5.0 - Production System parameter file is /data/oracle/base/admin/network/listener.ora Log messages written to /data/oracle/base/product/se_10205_s/network/log/listener.log Listening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=LISTENER)))
Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=LISTENER))) STATUS of the LISTENER ------------------------ Alias LISTENER Version TNSLSNR for Linux: Version 10.2.0.5.0 - Production Start Date
09-MAY-2012 20:51:09 Uptime 0 days 0 hr. 0 min. 0 sec Trace Level off Security ON: Local OS Authentication SNMP OFF Listener Parameter File /data/oracle/base/admin/network/listener.ora Listener Log File /data/oracle/base/product/se_10205_s/network/log/listener.log Listening Endpoints Summary...
(DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=LISTENER))) The listener supports no services The command completed successfully
版权所有 (c) 1991, 2010,甲骨文。版权所有。
正在启动 /data/oracle/base/product/se_10205_s/bin/tnslsnr: 请稍候...
适用于 Linux 的 TNSLSNR:版本 10.2.0.5.0 - 生产系统参数文件为 /data/oracle/base/admin/network/listener.ora 日志消息写入 /data/oracle/base/product/se_10205_s/network/log/listener .log 监听:(DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=LISTENER)))
连接到 (DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=LISTENER))) LISTENER 的 STATUS ------------------------ 别名 LISTENER适用于 Linux 的 TNSLSNR 版本:版本 10.2.0.5.0 - 生产开始日期
09-MAY-2012 20:51:09 正常运行时间 0 天 0 小时。0 分钟 0 秒 Trace Level off Security ON:本地操作系统身份验证 SNMP OFF 监听器参数文件 /data/oracle/base/admin/network/listener.ora 监听器日志文件 /data/oracle/base/product/se_10205_s/network/log/listener. log Listening Endpoints Summary...
(DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=LISTENER))) 监听器不支持任何服务 命令成功完成
# lsnrctl stop
LSNRCTL for Linux: Version 10.2.0.5.0 - Production on 09-MAY-2012 20:52:16
Copyright (c) 1991, 2010, 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
适用于 Linux 的 LSNRCTL:版本 10.2.0.5.0 - 2012 年 5 月 9 日 20:52:16 生产
版权所有 (c) 1991, 2010,甲骨文。版权所有。
连接到 (DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=LISTENER))) TNS-01190:用户无权执行请求的监听器命令
Don't do this; if you do you make a mistake. Pick any other user that is member of the dba group but not root.
不要这样做;如果你这样做,你就犯了一个错误。选择属于 dba 组但不是 root 的任何其他用户。
BTW: after this little demo I had to fix a little issue:
顺便说一句:在这个小演示之后,我不得不解决一个小问题:
Started with pid=5215 Error listening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=LISTENER))) TNS-12555: TNS:permission denied TNS-12560: TNS:protocol adapter error
TNS-00525: Insufficient privilege for operation Linux Error: 1: Operation not permitted
Started with pid=5215 Error listener on: (DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=LISTENER))) TNS-12555: TNS:permission denied TNS-12560: TNS:protocol adapter error
TNS-00525: Insufficient privilege用于操作 Linux 错误:1:不允许操作
problem was - obvious - that /var/tmp/.oracle/sLISTENER was owned by root. A little chown to the correct user took care of that.
问题是 - 很明显 - /var/tmp/.oracle/sLISTENER 归 root 所有。对正确的用户稍加处理就解决了这个问题。