Chinaunix首页 | 论坛 | 博客
  • 博客访问: 231183
  • 博文数量: 36
  • 博客积分: 1137
  • 博客等级: 少尉
  • 技术积分: 305
  • 用 户 组: 普通用户
  • 注册时间: 2007-12-06 09:58
文章分类

全部博文(36)

文章存档

2012年(1)

2011年(31)

2010年(3)

2007年(1)

分类: Oracle

2011-11-16 20:47:11


$ lsnrctl status

LSNRCTL for Linux: Version 9.2.0.8.0 - Production on 22-SEP-2011 07:53:29

Copyright (c) 1991, 2006, Oracle Corporation.  All rights reserved.

Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=herac1)(PORT=1521)))
STATUS of the LISTENER
------------------------
Alias                     LISTENER
Version                   TNSLSNR for Linux: Version 9.2.0.8.0 - Production
Start Date                22-SEP-2011 07:43:39
Uptime                    0 days 0 hr. 9 min. 50 sec
Trace Level               off
Security                  OFF
SNMP                      OFF
Listener Parameter File   /u01/oracle/product/9.2.0.4/network/admin/listener.ora
Listener Log File         /u01/oracle/product/9.2.0.4/network/log/listener.log
Listening Endpoints Summary...
  (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=herac1)(PORT=1521)))
Services Summary...
Service "PL***tProc" has 1 instance(s).
  Instance "PL***tProc", status UNKNOWN, has 1 handler(s) for this service...
Service "herac" has 2 instance(s).
  Instance "herac", status READY, has 2 handler(s) for this service...        
  Instance "herac2", status READY, has 1 handler(s) for this service...
Service "herac1" has 1 instance(s).
  Instance "herac1", status UNKNOWN, has 1 handler(s) for this service...
The command completed successfully


問題:
Service "herac" has 2 instance(s).
  Instance "herac", status READY, has 2 handler(s) for this service...        
  Instance "herac2", status READY, has 1 handler(s) for this service...

下麵應該是兩個實例的 herac1和herac2

解決:
herac1上:
SQL> show parameter instance_name

NAME                                 TYPE
------------------------------------ ---------------------------------
VALUE
------------------------------
instance_name                        string
herac

執行
SQL> alter system set instance_name='herac1' scope=spfile sid='herac1';

System altered.

關閉節點一實例
$ srvctl stop instance -d herac -i herac1

啟動節點一實例
$ srvctl start instance -d herac -i herac1  


$ lsnrctl status

LSNRCTL for Linux: Version 9.2.0.8.0 - Production on 22-SEP-2011 07:59:27

Copyright (c) 1991, 2006, Oracle Corporation.  All rights reserved.

Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=herac1)(PORT=1521)))
STATUS of the LISTENER
------------------------
Alias                     LISTENER
Version                   TNSLSNR for Linux: Version 9.2.0.8.0 - Production
Start Date                22-SEP-2011 07:43:39
Uptime                    0 days 0 hr. 15 min. 47 sec
Trace Level               off
Security                  OFF
SNMP                      OFF
Listener Parameter File   /u01/oracle/product/9.2.0.4/network/admin/listener.ora
Listener Log File         /u01/oracle/product/9.2.0.4/network/log/listener.log
Listening Endpoints Summary...
  (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=herac1)(PORT=1521)))
Services Summary...
Service "PL***tProc" has 1 instance(s).
  Instance "PL***tProc", status UNKNOWN, has 1 handler(s) for this service...
Service "herac" has 2 instance(s).
  Instance "herac1", status READY, has 2 handler(s) for this service...
  Instance "herac2", status READY, has 1 handler(s) for this service...
Service "herac1" has 1 instance(s).
  Instance "herac1", status UNKNOWN, has 1 handler(s) for this service...
The command completed successfully





  当客户端发出连接请求给Server端listener的时候,通过local_listener注册的服务接收这个连接请求,然后由master instance来决定这个连接请求应该由哪个目标instance发出server process响应这个连接请求。如果启用负载均衡,那么主节点会选择cpu负载最小的那个instance,此时:

      如果master分配的目标instance是local listener machine,那么直接通过local server listener,开启后台的server process,处理发出conn的客户端,建立连接,处理会话;

     如果master分配的目标instance不是local listener machine,那么会通过remote_listener这个参数,把连接请求转移到remote machine上的listener,然后由remote service listener发出一个server process返回客户端,建立连接,处理会话.

     当conn建立连接以后,listener就没有用了,不会再用到了,如果这个时候,已经连接的那个instance down了,会重新由新分配的master instance通过remote_listener切换到可用instance,此时客户不会发现连接中断。conn和select操作是不会中断的。

 

      当实例1注册监听的时候,即使节点2的instance没有启动,也会通过remote_listener在节点2 server上注册相应的listener1.它是在数据库启动的时候,添加到相应的listener service里的。



ORA-12545: Connect failed because target host or object does not exist
解決:
可以在/etc/hosts寫入,IP跟主機名對於關係

IP  NODE1
IP  NODE2



metalink文档解释如下:
Subject: RAC Connection Redirected To Wrong Host/IP ORA-12545
Doc ID: Note:364855.1 Type: PROBLEM
Last Revision Date: 23-APR-2007 Status: PUBLISHED
In this Document
Symptoms
Cause
Solution
References
--------------------------------------------------------------------------------
Applies to:
Oracle Net Services - Version: 9.1 to 10.2
This problem can occur on any platform.
Symptoms
When we try to connect to a RAC service name we sometimes get redirected by the first node's listener to the public address/hostname of the second node instead of its VIP address. An ORA-12545 error may be generated if that public hostname is not configured in DNS.
We were expecting the connection to eventually be redirected to the VIP of the other node.

Cause
The Database on one RAC node remote registers with the wrong local IP address to the listener on the other RAC node (e.g. the public IP address instead of the wanted VIP address).
The PMON process handles database registration to the local and remote listeners. For remote listeners registration PMON will have to find out what is the IP address of the local system in order to present it to the remote listener as database contact address.
In the default Oracle configuration, for hosts which have more than one IP address configured on the network interfaces, it is undefined which IP address will be selected for remote registration.

Solution
Modify the local_listener database parameter to point to the local VIP address. For the parameter value use either an alias name which contains in the DESCRIPTION field only the VIP address or use an explicit connection statement like the following:
local_listener='(ADDRESS = (PROTOCOL = TCP)(HOST = ) (PORT = 1521))'
The local_listener database parameter will give PMON a hint in respect of which IP address it should use for remote registration with other nodes' listener(s).
References
Note 235562.1 - Issues affecting Automatic Service Registration
Note 256275.1 - Dynamic Registration Fails On Multiple Network Interface Server
Errors
ORA-12541 TNS:no listener
ORA-12545 Connect failed because target host or object does not exist
Keywords
'RAC'   'LOCAL_LISTENER'   'IP~ADDRESS'   'REDIRECT'   'VIP'   'PMON'   'RAC'   'SERVICE~REGISTRATION'  

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