阿里云-云小站(无限量代金券发放中)
【腾讯云】云服务器、云数据库、COS、CDN、短信等热卖云产品特惠抢购

案例:使用scan IP无法连接数据库

165次阅读
没有评论

共计 2760 个字符,预计需要花费 7 分钟才能阅读完成。

环境:Oracle RAC(11.2.0.3)
现象:通过 scanIP 连接数据库报错 ORA-12514: ORA-12514: TNS:listener does not currently know of service requested in connect descriptor

1. 查看 scan listener 状态,发现服务没有注册成功:

[grid@rac1 ~]$ lsnrctl status LISTENER_SCAN1

LSNRCTL for IBM/AIX RISC System/6000: Version 11.2.0.3.0 - Production on 10-APR-2017 11:06:34

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

Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=LISTENER_SCAN1)))
STATUS of the LISTENER
------------------------
Alias                     LISTENER_SCAN1
Version                   TNSLSNR for IBM/AIX RISC System/6000: Version 11.2.0.3.0 - Production
Start Date                14-MAR-2017 23:19:53
Uptime                    26 days 11 hr. 46 min. 41 sec
Trace Level               off
Security                  ON: Local OS Authentication
SNMP                      ON
Listener Parameter File   /oracle/app/grid_home/network/admin/listener.ora
Listener Log File         /oracle/app/grid_home/log/diag/tnslsnr/jyrac2/listener_scan1/alert/log.xml
Listening Endpoints Summary...
  (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=LISTENER_SCAN1)))
  (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=192.168.1.80)(PORT=1521)))
The listener supports no services
The command completed successfully

2.Oracle 用户查看 remote_listener 参数配置:

SQL> show parameter remote_listener

NAME                                 TYPE        VALUE
------------------------------------ ----------- ------------------------------
remote_listener                      string      

发现 remote_listener 参数为空,这显然是不正常的。

3. 查看 /etc/hosts 的 scan IP 配置行:
cat /etc/hosts

192.168.1.80 jyrac-scan

4.oracle 用户登录数据库,配置 remote_listener 参数:

SQL> alter system set remote_listener = 'jyrac-scan:1521' sid='*' scope=both;
SQL> alter system register;

5. 再次查看 scan listener 状态,发现服务已经注册成功:

[grid@rac1 ~]$ lsnrctl status LISTENER_SCAN1

LSNRCTL for IBM/AIX RISC System/6000: Version 11.2.0.3.0 - Production on 10-APR-2017 11:13:47

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

Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=LISTENER_SCAN1)))
STATUS of the LISTENER
------------------------
Alias                     LISTENER_SCAN1
Version                   TNSLSNR for IBM/AIX RISC System/6000: Version 11.2.0.3.0 - Production
Start Date                14-MAR-2017 23:19:53
Uptime                    26 days 11 hr. 53 min. 54 sec
Trace Level               off
Security                  ON: Local OS Authentication
SNMP                      ON
Listener Parameter File   /oracle/app/grid_home/network/admin/listener.ora
Listener Log File         /oracle/app/grid_home/log/diag/tnslsnr/jyrac2/listener_scan1/alert/log.xml
Listening Endpoints Summary...
  (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=LISTENER_SCAN1)))
  (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=192.168.1.80)(PORT=1521)))
Services Summary...
Service "SERVICE2" has 1 instance(s).
  Instance "testdb1", status READY, has 1 handler(s) for this service...
Service "testdb" has 2 instance(s).
  Instance "testdb1", status READY, has 1 handler(s) for this service...
  Instance "testdb2", status READY, has 1 handler(s) for this service...
Service "testdb2" has 1 instance(s).
  Instance "testdb2", status READY, has 1 handler(s) for this service...
The command completed successfully

再次测试通过 scanip 连接数据库已经 ok。

更多 Oracle 相关信息见 Oracle 专题页面 http://www.linuxidc.com/topicnews.aspx?tid=12

本文永久更新链接地址 :http://www.linuxidc.com/Linux/2017-04/143142.htm

正文完
星哥玩云-微信公众号
post-qrcode
 0
星锅
版权声明:本站原创文章,由 星锅 于2022-01-22发表,共计2760字。
转载说明:除特殊说明外本站文章皆由CC-4.0协议发布,转载请注明出处。
【腾讯云】推广者专属福利,新客户无门槛领取总价值高达2860元代金券,每种代金券限量500张,先到先得。
阿里云-最新活动爆款每日限量供应
评论(没有评论)
验证码
【腾讯云】云服务器、云数据库、COS、CDN、短信等云产品特惠热卖中