按照前文所述搭建好RAC环境后,发现在rac2上面无法查看到listener的状态,如下:
[oracle@rac2 ~]$ lsnrctl statusLSNRCTL for Linux: Version 10.2.0.1.0 - Production on 14-FEB-2011 20:35:41Copyright (c) 1991, 2005, Oracle. All rights reserved.Connecting to (ADDRESS=(PROTOCOL=tcp)(HOST=)(PORT=1521))TNS-12541: TNS:no listener TNS-12560: TNS:protocol adapter error TNS-00511: No listener Linux Error: 111: Connection refused同时,下面的连接命令也不能运行:
sqlplus sys/sys@racdb2 as sysdba
还有就是在测试负载均衡的时候也不行,在网上google了好久,没有找到解决办法,倒是看到很多提意见的,毫无疑问的提到了看listener.ora文件的配置问题,我按照前文的链接安装的RAC环境,在没有更改listener.ora文件时,其内容如下:
[oracle@rac2 admin]$ cat listener.ora # listener.ora.rac2 Network Configuration File: /opt/ora10g/product/10.2.0/db_0/network/admin/listener.ora.rac2# Generated by Oracle configuration tools.LISTENER_RAC2 = (DESCRIPTION_LIST = (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = rac2-vip)(PORT = 1521)(IP = FIRST)) (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.1.101)(PORT = 1521)(IP = FIRST)) ) )SID_LIST_LISTENER_RAC2 = (SID_LIST = (SID_DESC = (SID_NAME = PLSExtProc) (ORACLE_HOME = /opt/ora10g/product/10.2.0/db_0) (PROGRAM = extproc) ) )而rac1上面这个文件的内容确和这个不一样,
(ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.1.101)(PORT = 1521)(IP = FIRST))
这里的IP地址是 127.0.0.1
于是我把rac2上的listener.ora文件更改后并重启整个RAC的服务器,再次测试的时候一切正常
lsnrctl status的输出正常,
sqlplus sys/sys@racdb2 as sysdba也能访问,
负载均衡的情况测试出来也是对的,
BTW: 负载均衡的配置可以参看下面的文章:
http://www.cnblogs.com/millen/archive/2009/05/06/1450844.html但是与此不同的是服务器端的配置我并没有手动去做,而是安装完成后就是那样的了
下面是我本机的tnsnames.ora文件,这样的配置是直接在客户端里面实现负载均衡,其中
192.168.1.200和192.168.1.201是RAC两台服务器的virtual ip, 这个virtal ip也会在两台服务器
之间漂移的,比如我直接关掉rac1这台服务器,那么这两个ip就都在rac2上面,但是客户端的连接肯定是中断了,还得重新再连一次。
# tnsnames.ora Network Configuration File: C:\oracle\product\10.2.0\db_1\NETWORK\ADMIN\tnsnames.ora# Generated by Oracle configuration tools.RACDB = (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.1.200)(PORT = 1521)) (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.1.201)(PORT = 1521)) (LOAD_BALANCE = on) (CONNECT_DATA = (SERVICE_NAME = racdb) ) )
阅读(3799) | 评论(1) | 转发(0) |