在自己的虚拟机的做实验,突然发现使用pl/sql developer无法连接到数据库,报错ora-12514,说是监听没有启动。
先介绍虚拟机一下环境:redhat7.2+gi 12.2.0.1+oracle 12.2.0.1,为了测试12.2的asm特性安装了gi。平时监听程序默认是开启启动的。但是今天不知道为什么没有启动。使用crsctl查看资源状态:发现监听的状态确实是offline状态
[root@rhel7 .oracle]# crsstat -------------------------------------------------------------------------------- name target state server state details -------------------------------------------------------------------------------- local resources -------------------------------------------------------------------------------- ora.data.dg online online rhel7 stable ora.listener.lsnr online offline rhel7 stable ora.asm online online rhel7 started,stable ora.ons offline offline rhel7 stable -------------------------------------------------------------------------------- cluster resources -------------------------------------------------------------------------------- ora.cssd 1 online online rhel7 stable ora.diskmon 1 offline offline stable ora.driver.afd 1 online online rhel7 stable ora.evmd 1 online online rhel7 stable ora.ora12c.db 1 online online rhel7 open,home=/u01/app/o racle/product/12.2/d b_home1,stable --------------------------------------------------------------------------------
尝试手动启动监听,依然报错:
[grid@rhel7 ~]$ srvctl start listener prcr-1079 : failed to start resource ora.listener.lsnr crs-5016: process "/u01/app/grid/bin/lsnrctl" spawned by agent "oraagent" for action "start" failed: details at "(:clsn00010:)" in "/u01/app/12.2/grid/diag/crs/rhel7/crs/trace/ohasd_oraagent_grid.trc" crs-5016: process "/u01/app/grid/bin/lsnrctl" spawned by agent "oraagent" for action "start" failed: details at "(:clsn00010:)" in "/u01/app/12.2/grid/diag/crs/rhel7/crs/trace/ohasd_oraagent_grid.trc" crs-2674: start of 'ora.listener.lsnr' on 'rhel7' failed
根据提示查看trc文件,看到如下报错:
lsnrctl for linux: version 12.2.0.1.0 - production on 15-nov-2017 20:03:28 copyright (c) 1991, 2016, oracle. all rights reserved. starting /u01/app/grid/bin/tnslsnr: please wait... tnslsnr for linux: version 12.2.0.1.0 - production system parameter file is /u01/app/grid/network/admin/listener.ora log messages written to /u01/app/12.2/grid/diag/tnslsnr/rhel7/listener/alert/log.xml listening on: (description=(address=(protocol=tcp)(host=rhel7)(port=1521))) error listening on: (description=(address=(protocol=ipc)(key=extproc1521))) tns-12555: tns:permission denied tns-12560: tns:protocol adapter error tns-00525: insufficient privilege for operation linux error: 1: operation not permitted listener failed to start. see the error message(s) above...
看到insufficient privilege for operation这个字样觉得很纳闷,怎么会权限不足呢,于是尝试用root直接启动监听,依然报错:
[root@rhel7 .oracle]# lsnrctl start lsnrctl for linux: version 12.2.0.1.0 - production on 15-nov-2017 20:22:30 copyright (c) 1991, 2016, oracle. all rights reserved. starting /u01/app/grid/bin/tnslsnr: please wait... tns-12546: tns:permission denied tns-12560: tns:protocol adapter error tns-00516: permission denied linux error: 13: permission denied
于是各种百度,下面把百度到内容列出来,可能会对看此文的同学有用,但是对我这种情况没有用:
主要是说 /var/tmp/.oracle、/tmp/.oracle 这两个目录的权限访问问题。 进入 一看,我的/var/tmp/.oracle权限 没问题,而/tmp/.oracle压根就没有这个文件。
于是直接查mos,看有没有相关的文档,找到两篇文档:
starting the listener fails with: tns-12557 or tns-12555: tns:permission denied (文档 id 343253.1)
listener fails to start with ipc permission errors (tns-12546 tns-12555 tns-00516 tns-00525) (文档 id 434062.1)
对比了文档中列出的问题,跟我的情况也不一相,看到最后发现这样一句话:
4. if you find that there are no adapters linked or they have errors (such as “permission denied”) then issue a “relink all”
reference:
doc id 1467060.1
于是只有用这种方法来试试了,由于crs使用的是grid home下的监听命令所以对grid home做relink all操作。可是又出现报错:
[grid@rhel7 bin]$ relink all the oracle home in which you are running this relinking tool does not have proper write permissions. please run this relink script as the same user who owns the oracle home and ensure that the oracle home has the permissions from the original installation. if this is a grid infrastructure home, please refer to the documentation for the proper steps to relink and apply oneoff patches.
意思是说权限不足,使用root执行,又报错说不能用root执行
[root@rhel7 bin]# relink all the relink script cannot be run as root.
又查看grid home目录权限
[root@rhel7 app]# ls -ld grid total 8 drwxr-x--- 84 root oinstall 4096 jul 18 20:26 grid
原来owner是root,怪不得第一次执行不成功,修改owner(应该直接chmod也可以,这里没有做测试),重新执行relink all
[root@rhel7 app]# chown grid grid [grid@rhel7 ~]$ relink all writing relink log to: /u01/app/grid/install/relink.log
成功后再次启动监听,启动成功。
[grid@rhel7 ~]$ lsnrctl start lsnrctl for linux: version 12.2.0.1.0 - production on 15-nov-2017 20:50:59 copyright (c) 1991, 2016, oracle. all rights reserved. starting /u01/app/grid/bin/tnslsnr: please wait... tnslsnr for linux: version 12.2.0.1.0 - production system parameter file is /u01/app/grid/network/admin/listener.ora log messages written to /u01/app/12.2/grid/diag/tnslsnr/rhel7/listener/alert/log.xml listening on: (description=(address=(protocol=tcp)(host=rhel7)(port=1521))) listening on: (description=(address=(protocol=ipc)(key=extproc1521))) connecting to (description=(address=(protocol=tcp)(host=rhel7)(port=1521))) status of the listener ------------------------ alias listener version tnslsnr for linux: version 12.2.0.1.0 - production start date 15-nov-2017 20:51:00 uptime 0 days 0 hr. 0 min. 0 sec trace level off security on: local os authentication snmp off listener parameter file /u01/app/grid/network/admin/listener.ora listener log file /u01/app/12.2/grid/diag/tnslsnr/rhel7/listener/alert/log.xml listening endpoints summary... (description=(address=(protocol=tcp)(host=rhel7)(port=1521))) (description=(address=(protocol=ipc)(key=extproc1521))) the listener supports no services the command completed successfully
至次问题解决。
总结
以上所述是www.887551.com给大家介绍的oracle 12.2监听无法启动解决方法,希望对大家有所帮助