重庆思庄Oracle、Redhat认证学习论坛

 找回密码
 注册

QQ登录

只需一步,快速开始

搜索
查看: 1306|回复: 0
打印 上一主题 下一主题

[Oracle] TNS-12541: TNS:no listener

[复制链接]
跳转到指定楼层
楼主
发表于 2023-12-13 11:32:13 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 lins 于 2023-12-13 11:33 编辑

## Question

```shell
TNS-12541: TNS:no listener
TNS-12560: TNS:protocol adapter error
  TNS-00511: No listener
   Linux Error: 111: Connection refused
```



## Resolve

- 切换用户  

  ```shell
  [root@dbserver ~]# su - oracle
  [oracle@dbserver ~]$

  ```



- 切换环境变量  `

  ```shell
  [oracle@dbserver ~]$ . oraenv
  ORACLE_SID = [orcl] ? orcl
  The Oracle base remains unchanged with value /u01/app/oracle

  ```



- 登录数据库   

  ```shell
  [oracle@dbserver ~]$ sqlplus / as sysdba                  
  SQL*Plus: Release 19.0.0.0.0 - Production on Wed Dec
  Version 19.21.0.0.0

  Copyright (c) 1982, 2022, Oracle.  All rights reserved.


  Connected to:
  Oracle Database 19c Standard Edition 2 Release 19.0.0.0.0 - Production
  Version 19.21.0.0.0

  ```



- 显示服务名  

  ```shell
  SYS@orcl >show parameter service_names;

  NAME                                 TYPE        VALUE
  ------------------------------------ ----------- ------------------------------
  service_names                        string      orcl

  ```



- 强制注册服务

  ```shell
  SYS@orcl >alter system register;

  System altered.

  ```



- 查看监听状态

  ```shell
  [oracle@dbserver ~]$ lsnrctl status listener

  LSNRCTL for Linux: Version 19.0.0.0.0 - Production on

  Copyright (c) 1991, 2023, Oracle.  All rights reserved.

  Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=dbserver)(PORT=1521)))
  STATUS of the LISTENER
  ------------------------
  Alias                     LISTENER
  Version                   TNSLSNR for Linux: Version 19.0.0.0.0 - Production
  Start Date               
  Uptime                    0 days 0 hr. 50 min. 42 sec
  Trace Level               off
  Security                  ON: Local OS Authentication
  SNMP                      OFF
  Listener Parameter File   /u01/app/oracle/product/19.21/db_1/network/admin/listener.ora
  Listener Log File         /u01/app/oracle/diag/tnslsnr/dbserver/listener/alert/log.xml
  Listening Endpoints Summary...
    (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=dbserver)(PORT=1521)))
    (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC1521)))
  Services Summary...
  Service "0c4b59438c6b17f3e0637885a8c04522" has 1 instance(s).
    Instance "orcl", status READY, has 1 handler(s) for this service...
  Service "86b637b62fdf7a65e053f706e80a27ca" has 1 instance(s).
    Instance "orcl", status READY, has 1 handler(s) for this service...
  Service "orcl" has 1 instance(s).
    Instance "orcl", status READY, has 1 handler(s) for this service...
  Service "orclXDB" has 1 instance(s).
    Instance "orcl", status READY, has 1 handler(s) for this service...
  Service "pdb" has 1 instance(s).
    Instance "orcl", status READY, has 1 handler(s) for this service...
  The command completed successfully

  ```


http://bbs.cqsztech.com/forum.php?mod=attachment&aid=NDU0NnwxZmMyM2I2M2VkOWY2ODhlM2Q4YmJjOTZlYzI1NzkyMHwxNzMwNDIwMTcz&request=yes&_f=.pdf

分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 支持支持 反对反对
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 注册

本版积分规则

QQ|手机版|小黑屋|重庆思庄Oracle、Redhat认证学习论坛 ( 渝ICP备12004239号-4 )

GMT+8, 2024-11-1 08:16 , Processed in 0.109676 second(s), 28 queries .

重庆思庄学习中心论坛-重庆思庄科技有限公司论坛

© 2001-2020

快速回复 返回顶部 返回列表