出现ORA-12541:TNS:无监听程序解决方案

曾经终败给现在 2022-03-18 06:35 3615阅读 0赞

这个问题一般是oracle服务的监听挂掉了:查询oracle监听的状态,如果挂掉了,重启即可。也有可能是数据库也挂掉了,那样的话需要重启数据库。

1.首先进入oralce用户:

  1. su - oracle

2.查询当前数据库的状态

  1. ps -ef|grep ora_smon*

如果发现当前没有oracle进程,则是oracle数据库挂了。

如果数据库没有挂,应该显示信息如下所示:

  1. oracle 5382 1 0 17:02 ? 00:00:00 ora_smon_testdb
  2. oracle 8450 4593 0 17:25 pts/0 00:00:00 grep ora_smon*

3.如果数据库挂了,需要重启数据库,首先进入数据库

  1. sqlplus "cmbcnetuser/Cmbc,1234. as sysdba"

进入oracle命令行:

  1. SQL*Plus: Release 11.2.0.4.0 Production on Tue Feb 19 17:02:35 2019
  2. Copyright (c) 1982, 2013, Oracle. All rights reserved.
  3. Connected to an idle instance.
  4. SQL>

4.然后重启即可

  1. SQL> startup

结果显示:

  1. ORACLE instance started.
  2. Total System Global Area 2505338880 bytes
  3. Fixed Size 2255832 bytes
  4. Variable Size 620758056 bytes
  5. Database Buffers 1862270976 bytes
  6. Redo Buffers 20054016 bytes
  7. Database mounted.
  8. Database opened.

5.然后输入exit退出

  1. SQL> exit

6.然后看看数据库还是显示有刚刚那个“ORA-12541:TNS:无监听程序”的问题,就先

查看oracle监听程序的状态:

//查询oracle监听状态

  1. [oracle@V_wangshenweb01 ~]$ lsnrctl status

结果:

  1. LSNRCTL for Linux: Version 11.2.0.4.0 - Production on 19-FEB-2019 17:05:21
  2. Copyright (c) 1991, 2013, Oracle. All rights reserved.
  3. Connecting to (ADDRESS=(PROTOCOL=tcp)(HOST=)(PORT=1521))
  4. TNS-12541: TNS:no listener
  5. TNS-12560: TNS:protocol adapter error
  6. TNS-00511: No listener
  7. Linux Error: 111: Connection refused

7.说明oracle监听挂掉了,重启监听

  1. [oracle@V_wangshenweb01 ~]$ lsnrctl start

8.再次查看oracle监听状态

  1. [oracle@V_wangshenweb01 ~]$ lsnrctl status

结果:

  1. LSNRCTL for Linux: Version 11.2.0.4.0 - Production on 19-FEB-2019 17:12:54
  2. Copyright (c) 1991, 2013, Oracle. All rights reserved.
  3. Connecting to (ADDRESS=(PROTOCOL=tcp)(HOST=)(PORT=1521))
  4. STATUS of the LISTENER
  5. ------------------------
  6. Alias LISTENER
  7. Version TNSLSNR for Linux: Version 11.2.0.4.0 - Production
  8. Start Date 19-FEB-2019 17:09:19
  9. Uptime 0 days 0 hr. 3 min. 34 sec
  10. Trace Level off
  11. Security ON: Local OS Authentication
  12. SNMP OFF
  13. Listener Parameter File /home/db/oracle/product/11.2.0/network/admin/listener.ora
  14. Listener Log File /home/db/oracle/diag/tnslsnr/V_wangshenweb01/listener/alert/log.xml
  15. Listening Endpoints Summary...
  16. (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=V_wangshenweb01)(PORT=1521)))
  17. Services Summary...
  18. Service "testdb" has 1 instance(s).
  19. Instance "testdb", status READY, has 1 handler(s) for this service...
  20. Service "testdbXDB" has 1 instance(s).
  21. Instance "testdb", status READY, has 1 handler(s) for this service...
  22. The command completed successfully

6.45服务器的数据库密码:Root@1234

lsnrctl start:开启监听

lsnrctl stop:关闭监听

lsnrctl status:监听状态

发表评论

表情:
评论列表 (有 0 条评论,3615人围观)

还没有评论,来说两句吧...

相关阅读