Oracle11GR2 RAC使用scan IP无法连接到数据库,报错 ORA-12545: 因目标主机或对象不存在, 连接失败
现象:
在windows客户端sqlplus工具使用scan的IP无法连接,报错如下:
C:Windowssystem32> sqlplus song/[email protected]:11521/orcl
SQL*Plus: Release 11.2.0.1.0 Production on Thu May 17 12:35:28 2012
Copyright (c) 1982, 2010, Oracle. All rights reserved.
ERROR:
ORA-12545: 因目标主机或对象不存在, 连接失败
1、检查各组件状态:
切换到grid用户,执行命令crs_stat -t,查看个状态
2、检查监听器状态:
切换到grid用户,执行命令lsnrctl status,查看单个实例的监听状态
执行lsnrctl status listener_scan1,查看scan监听状态
如果发现上面的都正常,那么我们将在metalink上找到答案
原因:
metalink说明:Client is able to resolve all Fully Qualified Domain Name (FQDN) SCAN and VIP name but not short ones(without domain name) as its in different domain;
even though FQDN names were specified during Grid Infrastructure setup, due to bug 9150053 by default DBCA set database parameter local_listener to short node VIP name while database is created.
因此只要把数据库实例参数local_listener内的host改为vip的IP地址即可
切换到oracle用户,执行sqlplus ‘/ as sysdba’打开数据库
代码如下 | 复制代码 |
#查看本机的local_listener参数 SQL> show parameter local_listener; NAME TYPE VALUE #修改所有节点上的local_listener取值,这里我的scanIP在hosts里设置的域名为rac-cluster,地址为10.10.23.3,port为11521 System altered. #手工强制将数据库实例注册到监听 SQL> alter system register; System altered. |
随后使用windows客户端连接成功:
C:UsersWJW>sqlplus system/[email protected]:1521/orcl
SQL*Plus: Release 11.2.0.1.0 Production on Thu May 17 13:14:39 2012
Copyright (c) 1982, 2010, Oracle. All rights reserved.
Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - Production
With the Partitioning, Real Application Clusters, Automatic Storage Management, OLAP,
Data Mining and Real Application Testing options