Server | Client |
|
操作系统 | RedHat EL5 | Windows10 |
Oracle | Oracle 11g(11.2.0.1.0) | Oracle 11g (11.2.0.1.0) |
一、客户端配置 tnsnames.ora:: # tnsnames.ora Network Configuration File: D:\app\tiany\product\11.2.0\client_1\network\admin\tnsnames.ora
# Generated by Oracle configuration tools.
PROD =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = scan_ip)(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = prod)
)
)
客户端连接报错信息:
C:\Users\tiany>sqlplus scott/tiger@prod
SQL*Plus: Release 11.2.0.1.0 Production on 星期日 11月 6 17:25:26 2016
Copyright (c) 1982, 2010, Oracle. All rights reserved.
ERROR:
ORA-12545: 因目标主机或对象不存在, 连接失败
二、服务端配置
在server端没有配置DNS服务器,scan ip的解析通过/etc/hosts文件解析:
# cat /etc/hosts 127.0.0.1 localhost 192.168.8.11 node1 192.168.8.13 node1-vip 10.10.10.11 node1-priv
192.168.8.12 node2 192.168.8.14 node2-vip 10.10.10.12 node2-priv
192.168.8.15 scan_ip
通过metalink查询获悉,在Oracle 11.2.0.1.0的版本有bug需要做以下修改,才能用客户端通过scan ip访问RAC(11.2.0.2.0,已经被修复)
三、修改Server配置 SQL> alter system set local_listener='(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(HOST=192.168.8.13) (PORT=1521))))' sid='prod1';
System altered.
SQL> alter system set local_listener='(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(HOST=192.168.8.14)(PORT=1521))))' sid='prod2';
System altered.
------ 将local_listener中的node-vip 主机名改为ip地址连接,问题解决。
四、客户端连接
C:\Users\tiany>sqlplus scott/tiger@prod
SQL*Plus: Release 11.2.0.1.0 Production on 星期日 11月 6 17:34:42 2016
Copyright (c) 1982, 2010, Oracle. All rights reserved.
连接到:
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
SQL>
@连接成功 !