问题描述
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进行举报,并提供相关证据,一经查实,墨天轮将立刻删除相关内容。