问题描述
RAC通过 SCAN-IP连接数据库,需要在2个节点设置local_listener参数。
RAC IP设置如下:
[root@node2 ~]# cat /etc/hosts # Do not remove the following line, or various programs # that require network functionality will fail. 127.0.0.1 node2 node2.localdomain localhost ::1 localhost6.localdomain6 localhost6 #pulic 192.168.3.111 node1 192.168.3.112 node2 #private 192.168.4.111 node1-pri 192.168.4.112 node2-pri #virtual 192.168.3.211 node1-vip 192.168.3.212 node2-vip #scan 192.168.3.110 ora-scan复制
远程连接报错
stevenMacBook-Pro:instantclient_10_2 steven$ ./sqlplus sys/oracle@192.168.3.110:1521/ORASQL as sysdba SQL*Plus: Release 10.2.0.4.0 - Production on Sat Aug 17 08:02:54 2013 Copyright (c) 1982, 2007, Oracle. All Rights Reserved. ERROR: ORA-12545: Connect failed because target host or object does not exist Enter user-name: ERROR: ORA-12162: TNS:net service name is incorrectly specified复制
专家解答
节点1
SQL> show parameter listener NAME TYPE VALUE ------------------------------------ ----------- ------------------------------ listener_networks string local_listener string (DESCRIPTION=(ADDRESS_LIST=(AD DRESS=(PROTOCOL=TCP)(HOST=node 1-vip)(PORT=1521)))) remote_listener string ora-scan:1521 SQL> !lsnrctl status LSNRCTL for Linux: Version 11.2.0.1.0 - Production on 17-AUG-2013 08:02:13 Copyright (c) 1991, 2009, Oracle. All rights reserved. Connecting to (ADDRESS=(PROTOCOL=tcp)(HOST=)(PORT=1521)) STATUS of the LISTENER ------------------------ Alias LISTENER Version TNSLSNR for Linux: Version 11.2.0.1.0 - Production Start Date 17-AUG-2013 07:32:46 Uptime 0 days 0 hr. 29 min. 27 sec Trace Level off Security ON: Local OS Authentication SNMP OFF Listener Parameter File /oracle/app/grid/network/admin/listener.ora Listener Log File /oracle/app/oracle/diag/tnslsnr/node1/listener/alert/log.xml Listening Endpoints Summary... (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=LISTENER))) (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=127.0.0.1)(PORT=1521))) (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=192.168.3.211)(PORT=1521))) Services Summary... Service "+ASM" has 1 instance(s). Instance "+ASM1", status READY, has 1 handler(s) for this service... Service "ORASQL" has 1 instance(s). Instance "ORASQL1", status READY, has 1 handler(s) for this service... Service "ORASQLXDB" has 1 instance(s). Instance "ORASQL1", status READY, has 1 handler(s) for this service... The command completed successfully SQL> alter system set local_listener='(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(HOST=192.168.3.211)(PORT=1521))))' sid='ORASQL1' scope=both; System altered. SQL> alter system register; System altered. SQL> show parameter listener NAME TYPE VALUE ------------------------------------ ----------- ------------------------------ listener_networks string local_listener string (DESCRIPTION=(ADDRESS_LIST=(AD DRESS=(PROTOCOL=TCP)(HOST=192. 168.3.211)(PORT=1521)))) remote_listener string ora-scan:1521复制
节点2
SQL> alter system set local_listener='(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(HOST=192.168.3.212)(PORT=1521))))' sid='ORASQL2' scope=both; System altered. SQL> alter system register; System altered. SQL> show parameter listener NAME TYPE VALUE ------------------------------------ ----------- ------------------------------ listener_networks string local_listener string (DESCRIPTION=(ADDRESS_LIST=(AD DRESS=(PROTOCOL=TCP)(HOST=192. 168.3.212)(PORT=1521)))) remote_listener string ora-scan:1521 SQL>复制
重新连接
stevenMacBook-Pro:instantclient_10_2 steven$ ./sqlplus sys/oracle@192.168.3.110:1521/ORASQL as sysdba SQL*Plus: Release 10.2.0.4.0 - Production on Sat Aug 17 08:05:35 2013 Copyright (c) 1982, 2007, Oracle. All Rights Reserved. Connected to: Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - 64bit Production With the Partitioning, Real Application Clusters, Automatic Storage Management, OLAP, Data Mining and Real Application Testing options SQL> select instance_name from v$instance; INSTANCE_NAME ---------------- ORASQL1 SQL>复制
「喜欢这篇文章,您的关注和赞赏是给作者最好的鼓励」
关注作者
【版权声明】本文为墨天轮用户原创内容,转载时必须标注文章的来源(墨天轮),文章链接,文章作者等基本信息,否则作者和墨天轮有权追究责任。如果您发现墨天轮中有涉嫌抄袭或者侵权的内容,欢迎发送邮件至:contact@modb.pro进行举报,并提供相关证据,一经查实,墨天轮将立刻删除相关内容。
评论
相关阅读
Oracle RAC 一键安装翻车?手把手教你如何排错!
Lucifer三思而后行
546次阅读
2025-04-15 17:24:06
【纯干货】Oracle 19C RU 19.27 发布,如何快速升级和安装?
Lucifer三思而后行
464次阅读
2025-04-18 14:18:38
Oracle SQL 执行计划分析与优化指南
Digital Observer
443次阅读
2025-04-01 11:08:44
XTTS跨版本迁移升级方案(11g to 19c RAC for Linux)
zwtian
440次阅读
2025-04-08 09:12:48
墨天轮个人数说知识点合集
JiekeXu
439次阅读
2025-04-01 15:56:03
【ORACLE】记录一些ORACLE的merge into语句的BUG
DarkAthena
437次阅读
2025-04-22 00:20:37
【ORACLE】你以为的真的是你以为的么?--ORA-38104: Columns referenced in the ON Clause cannot be updated
DarkAthena
412次阅读
2025-04-22 00:13:51
Oracle数据库一键巡检并生成HTML结果,免费脚本速来下载!
陈举超
407次阅读
2025-04-20 10:07:02
Oracle 19c RAC更换IP实战,运维必看!
szrsu
392次阅读
2025-04-08 23:57:08
【活动】分享你的压箱底干货文档,三篇解锁进阶奖励!
墨天轮编辑部
353次阅读
2025-04-17 17:02:24
TA的专栏
Java中间件
收录0篇内容
热门文章
一次Connection reset by peer的问题排查
2021-12-07 33982浏览
Java8-Stream: no instance(s) of type variable(s) R exist so that void conforms to R
2021-02-19 32359浏览
nginx: [emerg] "user" directive is not allowed here in /etc/nginx/conf.d/nginx.conf:1
2022-02-15 24278浏览
ORA-00904: "POLTYP": invalid identifier
2019-06-19 12933浏览
PageHelper排坑,处理排序失败: net.sf.jsqlparser.JSQLParserException
2022-05-19 12779浏览