Chinaunix首页 | 论坛 | 博客
  • 博客访问: 1021647
  • 博文数量: 584
  • 博客积分: 2293
  • 博客等级: 大尉
  • 技术积分: 3045
  • 用 户 组: 普通用户
  • 注册时间: 2006-03-28 11:15
文章分类

全部博文(584)

文章存档

2012年(532)

2011年(47)

2009年(5)

我的朋友

分类:

2012-06-13 22:15:46

问题描述:

在建好oracle11gR2的rac集群后,想在客户端通过scan IP连接数据库,结果在配置好tns后,连接报错:

C:\>sqlplus system/Xinao332014@zhealth

SQL*Plus: Release 11.1.0.6.0 - Production on 星期五 7月 8 15:24:31 2011

Copyright (c) 1982, 2007, Oracle. All rights reserved.

ERROR:

ORA-12545: 因目标主机或对象不存在, 连接失败

登录到服务器上连接却没有问题:

节点一:

[oracle@hracone:~]# sqlplus system/Xinao332014@health

SQL*Plus: Release 11.2.0.1.0 Production on Fri Jul 8 23:48:16 2011

Copyright (c) 1982, 2009, 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>

节点二:

[oracle@hractwo:~]# sqlplus system/Xinao332014@health

SQL*Plus: Release 11.2.0.1.0 Production on Fri Jul 8 23:48:59 2011

Copyright (c) 1982, 2009, 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>

查看监听都很正常:

tcp 0 0 10.1.112.196:1521 0.0.0.0:* LISTEN

tcp 0 0 10.1.112.194:1521 0.0.0.0:* LISTEN

LSNRCTL> status

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 07-JUL-2011 23:53:04

Uptime 0 days 23 hr. 58 min. 35 sec

Trace Level off

Security ON: Local OS Authentication

SNMP OFF

Listener Parameter File /u01/app/11.2.0/grid/network/admin/listener.ora

Listener Log File /u01/app/grid/diag/tnslsnr/hractwo/listener/alert/log.xml

Listening Endpoints Summary...

(DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=LISTENER)))

(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=10.1.112.194)(PORT=1521)))

(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=10.1.112.196)(PORT=1521)))

Services Summary...

Service "+ASM" has 1 instance(s).

Instance "+ASM2", status READY, has 1 handler(s) for this service...

Service "health" has 1 instance(s).

Instance "health2", status READY, has 1 handler(s) for this service...

Service "healthXDB" has 1 instance(s).

Instance "health2", status READY, has 1 handler(s) for this service...

The command completed successfully

查看db参数local_listener

SQL> show parameter local

NAME TYPE VALUE

------------------------------------ ----------- ------------------------------

local_listener string (DESCRIPTION=(ADDRESS_LIST=(AD

DRESS=(PROTOCOL=TCP)(HOST=hrac

one-vip)(PORT=1521))))

发现其注册监听的名字是hracone-vip,这个是在配置vip时用的,且配置在/etc/hosts里面,而注册scan里面,远程客户端肯定无法解析,这也是为什么在服务器上面通过tns连接成功,而远程却失败的原因。

下一步更新local_listener参数,做进一步测试:

SQL> conn / as sysdba

Connected.

SQL> alter system set local_listener='(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(HOST=10.1.112.195)(PORT=1521))))' scope=both sid='health1';

System altered.

SQL> alter system register;

System altered.

使用远程客户端连接测试一下:

C:\>sqlplus system/Xinao332014@zhealth

SQL*Plus: Release 11.1.0.6.0 - Production on 星期五 7月 8 17:21:41 2011

Copyright (c) 1982, 2007, Oracle. All rights reserved.

连接到:

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>

到此问题解决,这个问题要特别注意,在11gR2的版本中DB建好之后最好更新一下参数local_listener,各节点依次执行一遍,但要注意每个节点的vip IP不同。

SQL> alter system set local_listener='(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(HOST=10.1.112.196)(PORT=1521))))' scope=both sid='health2';

System altered.

SQL> alter system register;

System altered.

阅读(1209) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~