rac中各节点监听程序本来只监听当前节点的vip 和public ip,不知为何客户的rac各个节点配置成监听自己节点和对方节点的vip
连接rac数据库报TNS-12545错误
登录数据库服务器执行crs_stat -t
[oracle@keqsi1 admin]$ crs_stat -t Name Type Target State Host ------------------------------------------------------------ ora.keqjm.db application ONLINE ONLINE keqsi1 ora....m1.inst application ONLINE ONLINE keqsi1 ora....m2.inst application ONLINE ONLINE keqsi2 ora....orcl.cs application ONLINE ONLINE keqsi2 ora....jm1.srv application ONLINE ONLINE keqsi1 ora....jm2.srv application ONLINE ONLINE keqsi2 ora....SM1.asm application ONLINE ONLINE keqsi1 ora....I1.lsnr application ONLINE OFFLINE ora.keqsi1.gsd application ONLINE ONLINE keqsi1 ora.keqsi1.ons application ONLINE ONLINE keqsi1 ora.keqsi1.vip application ONLINE ONLINE keqsi1 ora....SM2.asm application ONLINE ONLINE keqsi2 ora....I2.lsnr application ONLINE OFFLINE ora.keqsi2.gsd application ONLINE ONLINE keqsi2 ora.keqsi2.ons application ONLINE ONLINE keqsi2 ora.keqsi2.vip application ONLINE ONLINE keqsi2
检查listener.ora文件:10.53.1.237和10.53.1.238是两个节点
的虚拟IP地址
[oracle@keqsi2 admin]$ more listener.ora # listener.ora.keqsi2 Network Configuration File: /u01/app/oracle/10gR2/db/network/admin/listener.ora.keqsi2 # Generated by Oracle configuration tools. LISTENER_KEQSI2 = (DESCRIPTION_LIST = (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = 10.53.1.237)(PORT = 1521)(IP = FIRST)) (ADDRESS = (PROTOCOL = TCP)(HOST = 10.53.1.238)(PORT = 1521)(IP = FIRST)) ) ) SID_LIST_LISTENER_KEQSI2 = (SID_LIST = (SID_DESC = (SID_NAME = PLSExtProc) (ORACLE_HOME = /u01/app/oracle/10gR2/db) (PROGRAM = extproc) ) )
检查网络是否能拼通
[oracle@keqsi2 admin]$ hostname keqsi2 [oracle@keqsi2 admin]$ more /etc/hosts # Do not remove the following line, or various programs # that require network functionality will fail. #127.0.0.1 keqsi2 localhost.localdomain localhost 127.0.0.1 localhost.localdomain localhost 172.18.20.1 keqsi1-priv 172.18.20.2 keqsi2-priv 10.53.1.230 keqsi1 10.53.1.237 keqsi1-vip 10.53.1.231 keqsi2 10.53.1.238 keqsi2-vip [oracle@keqsi2 admin]$ ping keqsi1 PING keqsi1 (10.53.1.230) 56(84) bytes of data. 64 bytes from keqsi1 (10.53.1.230): icmp_seq=0 ttl=64 time=0.131 ms 64 bytes from keqsi1 (10.53.1.230): icmp_seq=1 ttl=64 time=0.125 ms 64 bytes from keqsi1 (10.53.1.230): icmp_seq=2 ttl=64 time=0.128 ms 64 bytes from keqsi1 (10.53.1.230): icmp_seq=3 ttl=64 time=0.125 ms 64 bytes from keqsi1 (10.53.1.230): icmp_seq=4 ttl=64 time=0.126 ms 64 bytes from keqsi1 (10.53.1.230): icmp_seq=5 ttl=64 time=0.125 ms 64 bytes from keqsi1 (10.53.1.230): icmp_seq=6 ttl=64 time=0.126 ms --- keqsi1 ping statistics --- 7 packets transmitted, 7 received, 0% packet loss, time 5999ms rtt min/avg/max/mdev = 0.125/0.126/0.131/0.012 ms, pipe 2 [oracle@keqsi2 admin]$ ping keqsi2 PING keqsi2 (10.53.1.231) 56(84) bytes of data. 64 bytes from keqsi2 (10.53.1.231): icmp_seq=0 ttl=64 time=0.024 ms 64 bytes from keqsi2 (10.53.1.231): icmp_seq=1 ttl=64 time=0.010 ms 64 bytes from keqsi2 (10.53.1.231): icmp_seq=2 ttl=64 time=0.015 ms --- keqsi2 ping statistics --- 3 packets transmitted, 3 received, 0% packet loss, time 1999ms rtt min/avg/max/mdev = 0.010/0.016/0.024/0.006 ms, pipe 2 [oracle@keqsi2 admin]$ ping keqsi2-vip PING keqsi2-vip (10.53.1.238) 56(84) bytes of data. 64 bytes from keqsi2-vip (10.53.1.238): icmp_seq=0 ttl=64 time=0.018 ms 64 bytes from keqsi2-vip (10.53.1.238): icmp_seq=1 ttl=64 time=0.011 ms 64 bytes from keqsi2-vip (10.53.1.238): icmp_seq=2 ttl=64 time=0.010 ms 64 bytes from keqsi2-vip (10.53.1.238): icmp_seq=3 ttl=64 time=0.009 ms --- keqsi2-vip ping statistics --- 4 packets transmitted, 4 received, 0% packet loss, time 2999ms rtt min/avg/max/mdev = 0.009/0.012/0.018/0.003 ms, pipe 2 [oracle@keqsi2 admin]$ ping keqsi1-vip PING keqsi1-vip (10.53.1.237) 56(84) bytes of data. 64 bytes from keqsi1-vip (10.53.1.237): icmp_seq=0 ttl=64 time=0.135 ms 64 bytes from keqsi1-vip (10.53.1.237): icmp_seq=1 ttl=64 time=0.129 ms 64 bytes from keqsi1-vip (10.53.1.237): icmp_seq=2 ttl=64 time=0.121 ms --- keqsi1-vip ping statistics --- 3 packets transmitted, 3 received, 0% packet loss, time 2000ms rtt min/avg/max/mdev = 0.121/0.128/0.135/0.010 ms, pipe 2
经上面的命令检查网络没有问题
下面手功启动listener还是报TNS-12545
[oracle@keqsi2 admin]$ srvctl start listener -n keqsi2 keqsi2:ora.keqsi2.LISTENER_KEQSI2.lsnr: keqsi2:ora.keqsi2.LISTENER_KEQSI2.lsnr:LSNRCTL for Linux: Version 10.2.0.4.0 - Production on 28-AUG-2013 08:26:14 keqsi2:ora.keqsi2.LISTENER_KEQSI2.lsnr: keqsi2:ora.keqsi2.LISTENER_KEQSI2.lsnr:Copyright (c) 1991, 2007, Oracle. All rights reserved. keqsi2:ora.keqsi2.LISTENER_KEQSI2.lsnr: keqsi2:ora.keqsi2.LISTENER_KEQSI2.lsnr:Starting /u01/app/oracle/10gR2/db/bin/tnslsnr: please wait... keqsi2:ora.keqsi2.LISTENER_KEQSI2.lsnr: keqsi2:ora.keqsi2.LISTENER_KEQSI2.lsnr:TNSLSNR for Linux: Version 10.2.0.4.0 - Production keqsi2:ora.keqsi2.LISTENER_KEQSI2.lsnr:System parameter file is /u01/app/oracle/10gR2/db/network/admin/listener.ora keqsi2:ora.keqsi2.LISTENER_KEQSI2.lsnr:Log messages written to /u01/app/oracle/10gR2/db/network/log/listener_keqsi2.log keqsi2:ora.keqsi2.LISTENER_KEQSI2.lsnr:Error listening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=10.53.1.237)(PORT=1521)(IP=FIRST))) keqsi2:ora.keqsi2.LISTENER_KEQSI2.lsnr:TNS-12545: Connect failed because target host or object does not exist keqsi2:ora.keqsi2.LISTENER_KEQSI2.lsnr: TNS-12560: TNS:protocol adapter error keqsi2:ora.keqsi2.LISTENER_KEQSI2.lsnr: TNS-00515: Connect failed because target host or object does not exist keqsi2:ora.keqsi2.LISTENER_KEQSI2.lsnr: Linux Error: 99: Cannot assign requested address keqsi2:ora.keqsi2.LISTENER_KEQSI2.lsnr: keqsi2:ora.keqsi2.LISTENER_KEQSI2.lsnr:Listener failed to start. See the error message(s) above... keqsi2:ora.keqsi2.LISTENER_KEQSI2.lsnr: keqsi2:ora.keqsi2.LISTENER_KEQSI2.lsnr: keqsi2:ora.keqsi2.LISTENER_KEQSI2.lsnr:LSNRCTL for Linux: Version 10.2.0.4.0 - Production on 28-AUG-2013 08:26:14 keqsi2:ora.keqsi2.LISTENER_KEQSI2.lsnr: keqsi2:ora.keqsi2.LISTENER_KEQSI2.lsnr:Copyright (c) 1991, 2007, Oracle. All rights reserved. keqsi2:ora.keqsi2.LISTENER_KEQSI2.lsnr: keqsi2:ora.keqsi2.LISTENER_KEQSI2.lsnr:Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=10.53.1.237)(PORT=1521)(IP=FIRST))) keqsi2:ora.keqsi2.LISTENER_KEQSI2.lsnr:TNS-12541: TNS:no listener keqsi2:ora.keqsi2.LISTENER_KEQSI2.lsnr: TNS-12560: TNS:protocol adapter error keqsi2:ora.keqsi2.LISTENER_KEQSI2.lsnr: TNS-00511: No listener keqsi2:ora.keqsi2.LISTENER_KEQSI2.lsnr: Linux Error: 111: Connection refused keqsi2:ora.keqsi2.LISTENER_KEQSI2.lsnr:Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=10.53.1.238)(PORT=1521)(IP=FIRST))) keqsi2:ora.keqsi2.LISTENER_KEQSI2.lsnr:TNS-12541: TNS:no listener keqsi2:ora.keqsi2.LISTENER_KEQSI2.lsnr: TNS-12560: TNS:protocol adapter error keqsi2:ora.keqsi2.LISTENER_KEQSI2.lsnr: TNS-00511: No listener keqsi2:ora.keqsi2.LISTENER_KEQSI2.lsnr: Linux Error: 111: Connection refused CRS-0215: Could not start resource 'ora.keqsi2.LISTENER_KEQSI2.lsnr'.
下面让各个节点的监听程序只监听自己节点的vip
[oracle@keqsi2 admin]$ vi listener.ora # listener.ora.keqsi2 Network Configuration File: /u01/app/oracle/10gR2/db/network/admin/listener.ora.keqsi2 # Generated by Oracle configuration tools. LISTENER_KEQSI2 = (DESCRIPTION_LIST = (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = 10.53.1.238)(PORT = 1521)(IP = FIRST)) ) ) SID_LIST_LISTENER_KEQSI2 = (SID_LIST = (SID_DESC = (SID_NAME = PLSExtProc) (ORACLE_HOME = /u01/app/oracle/10gR2/db) (PROGRAM = extproc) ) ) ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ "listener.ora" 19L, 474C written [oracle@keqsi1 admin]$ vi listener.ora # listener.ora.keqsi1 Network Configuration File: /u01/app/oracle/10gR2/db/network/admin/listener.ora.keqsi1 # Generated by Oracle configuration tools. LISTENER_KEQSI1 = (DESCRIPTION_LIST = (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST =10.53.1.237)(PORT = 1521)(IP = FIRST)) ) ) SID_LIST_LISTENER_KEQSI1 = (SID_LIST = (SID_DESC = (SID_NAME = PLSExtProc) (ORACLE_HOME = /u01/app/oracle/10gR2/db) (PROGRAM = extproc) ) ) ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ "listener.ora" 19L, 473C written
启动监听程序正常
[oracle@keqsi2 admin]$ lsnrctl start LISTENER_KEQSI2 LSNRCTL for Linux: Version 10.2.0.4.0 - Production on 28-AUG-2013 08:42:17 Copyright (c) 1991, 2007, Oracle. All rights reserved. Starting /u01/app/oracle/10gR2/db/bin/tnslsnr: please wait... TNSLSNR for Linux: Version 10.2.0.4.0 - Production System parameter file is /u01/app/oracle/10gR2/db/network/admin/listener.ora Log messages written to /u01/app/oracle/10gR2/db/network/log/listener_keqsi2.log Listening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=10.53.1.238)(PORT=1521))) Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=10.53.1.238)(PORT=1521)(IP=FIRST))) STATUS of the LISTENER ------------------------ Alias LISTENER_KEQSI2 Version TNSLSNR for Linux: Version 10.2.0.4.0 - Production Start Date 28-AUG-2013 08:42:17 Uptime 0 days 0 hr. 0 min. 0 sec Trace Level off Security ON: Local OS Authentication SNMP OFF Listener Parameter File /u01/app/oracle/10gR2/db/network/admin/listener.ora Listener Log File /u01/app/oracle/10gR2/db/network/log/listener_keqsi2.log Listening Endpoints Summary... (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=10.53.1.238)(PORT=1521))) Services Summary... Service "PLSExtProc" has 1 instance(s). Instance "PLSExtProc", status UNKNOWN, has 1 handler(s) for this service... The command completed successfully [oracle@keqsi1 admin]$ lsnrctl start LISTENER_KEQSI1 LSNRCTL for Linux: Version 10.2.0.4.0 - Production on 28-AUG-2013 08:37:08 Copyright (c) 1991, 2007, Oracle. All rights reserved. Starting /u01/app/oracle/10gR2/db/bin/tnslsnr: please wait... TNSLSNR for Linux: Version 10.2.0.4.0 - Production System parameter file is /u01/app/oracle/10gR2/db/network/admin/listener.ora Log messages written to /u01/app/oracle/10gR2/db/network/log/listener_keqsi1.log Listening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=10.53.1.237)(PORT=1521))) Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=10.53.1.237)(PORT=1521)(IP=FIRST))) STATUS of the LISTENER ------------------------ Alias LISTENER_KEQSI1 Version TNSLSNR for Linux: Version 10.2.0.4.0 - Production Start Date 28-AUG-2013 08:37:08 Uptime 0 days 0 hr. 0 min. 0 sec Trace Level off Security ON: Local OS Authentication SNMP OFF Listener Parameter File /u01/app/oracle/10gR2/db/network/admin/listener.ora Listener Log File /u01/app/oracle/10gR2/db/network/log/listener_keqsi1.log Listening Endpoints Summary... (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=10.53.1.237)(PORT=1521))) Services Summary... Service "PLSExtProc" has 1 instance(s). Instance "PLSExtProc", status UNKNOWN, has 1 handler(s) for this service... The command completed successfully [oracle@keqsi1 admin]$ crs_stat -t Name Type Target State Host ------------------------------------------------------------ ora.keqjm.db application ONLINE ONLINE keqsi1 ora....m1.inst application ONLINE ONLINE keqsi1 ora....m2.inst application ONLINE ONLINE keqsi2 ora....orcl.cs application ONLINE ONLINE keqsi2 ora....jm1.srv application ONLINE ONLINE keqsi1 ora....jm2.srv application ONLINE ONLINE keqsi2 ora....SM1.asm application ONLINE ONLINE keqsi1 ora....I1.lsnr application ONLINE ONLINE keqsi1 ora.keqsi1.gsd application ONLINE ONLINE keqsi1 ora.keqsi1.ons application ONLINE ONLINE keqsi1 ora.keqsi1.vip application ONLINE ONLINE keqsi1 ora....SM2.asm application ONLINE ONLINE keqsi2 ora....I2.lsnr application ONLINE ONLINE keqsi2 ora.keqsi2.gsd application ONLINE ONLINE keqsi2 ora.keqsi2.ons application ONLINE ONLINE keqsi2 ora.keqsi2.vip application ONLINE ONLINE keqsi2
然后再重新启动rac数据库能正常启动
[oracle@keqsi1 admin]$ crs_stop -all Attempting to stop `ora.keqjm.orcl.keqjm1.srv` on member `keqsi1` Attempting to stop `ora.keqsi1.gsd` on member `keqsi1` Stop of `ora.keqjm.orcl.keqjm1.srv` on member `keqsi1` succeeded. Attempting to stop `ora.keqjm.orcl.keqjm2.srv` on member `keqsi2` Attempting to stop `ora.keqjm.db` on member `keqsi1` Attempting to stop `ora.keqsi1.ons` on member `keqsi1` Attempting to stop `ora.keqjm.orcl.cs` on member `keqsi2` Attempting to stop `ora.keqsi2.gsd` on member `keqsi2` Attempting to stop `ora.keqsi2.ons` on member `keqsi2` Stop of `ora.keqjm.orcl.keqjm2.srv` on member `keqsi2` succeeded. Stop of `ora.keqsi1.gsd` on member `keqsi1` succeeded. Stop of `ora.keqsi1.ons` on member `keqsi1` succeeded. Stop of `ora.keqsi2.gsd` on member `keqsi2` succeeded. Stop of `ora.keqsi2.ons` on member `keqsi2` succeeded. Stop of `ora.keqjm.orcl.cs` on member `keqsi2` succeeded. Stop of `ora.keqjm.db` on member `keqsi1` succeeded. `ora.keqjm.keqjm1.inst` is already OFFLINE. `ora.keqjm.keqjm2.inst` is already OFFLINE. Attempting to stop `ora.keqsi1.ASM1.asm` on member `keqsi1` Attempting to stop `ora.keqsi2.ASM2.asm` on member `keqsi2` Attempting to stop `ora.keqsi1.LISTENER_KEQSI1.lsnr` on member `keqsi1` Attempting to stop `ora.keqsi2.LISTENER_KEQSI2.lsnr` on member `keqsi2` Stop of `ora.keqsi2.LISTENER_KEQSI2.lsnr` on member `keqsi2` succeeded. Attempting to stop `ora.keqsi2.vip` on member `keqsi2` Stop of `ora.keqsi1.LISTENER_KEQSI1.lsnr` on member `keqsi1` succeeded. Attempting to stop `ora.keqsi1.vip` on member `keqsi1` Stop of `ora.keqsi2.vip` on member `keqsi2` succeeded. Stop of `ora.keqsi1.ASM1.asm` on member `keqsi1` succeeded. Stop of `ora.keqsi1.vip` on member `keqsi1` succeeded. Stop of `ora.keqsi2.ASM2.asm` on member `keqsi2` succeeded. CRS-0216: Could not stop resource 'ora.keqjm.keqjm1.inst'. CRS-0216: Could not stop resource 'ora.keqjm.keqjm2.inst'. [oracle@keqsi1 admin]$ crs_start -all Attempting to start `ora.keqsi1.ASM1.asm` on member `keqsi1` Attempting to start `ora.keqsi1.vip` on member `keqsi1` Attempting to start `ora.keqsi2.ASM2.asm` on member `keqsi2` Attempting to start `ora.keqsi2.vip` on member `keqsi2` Start of `ora.keqsi1.vip` on member `keqsi1` succeeded. Attempting to start `ora.keqsi1.LISTENER_KEQSI1.lsnr` on member `keqsi1` Start of `ora.keqsi2.vip` on member `keqsi2` succeeded. Attempting to start `ora.keqsi2.LISTENER_KEQSI2.lsnr` on member `keqsi2` Start of `ora.keqsi1.LISTENER_KEQSI1.lsnr` on member `keqsi1` succeeded. Start of `ora.keqsi2.LISTENER_KEQSI2.lsnr` on member `keqsi2` succeeded. Start of `ora.keqsi1.ASM1.asm` on member `keqsi1` succeeded. Attempting to start `ora.keqjm.keqjm1.inst` on member `keqsi1` Start of `ora.keqsi2.ASM2.asm` on member `keqsi2` succeeded. Attempting to start `ora.keqjm.keqjm2.inst` on member `keqsi2` Start of `ora.keqjm.keqjm1.inst` on member `keqsi1` succeeded. Start of `ora.keqjm.keqjm2.inst` on member `keqsi2` succeeded. CRS-1002: Resource 'ora.keqsi1.ons' is already running on member 'keqsi1' CRS-1002: Resource 'ora.keqsi2.ons' is already running on member 'keqsi2' CRS-1002: Resource 'ora.keqjm.db' is already running on member 'keqsi2' Attempting to start `ora.keqjm.orcl.cs` on member `keqsi2` Attempting to start `ora.keqsi1.gsd` on member `keqsi1` Attempting to start `ora.keqjm.orcl.keqjm1.srv` on member `keqsi1` Attempting to start `ora.keqjm.orcl.keqjm2.srv` on member `keqsi2` Attempting to start `ora.keqsi2.gsd` on member `keqsi2` Start of `ora.keqjm.orcl.cs` on member `keqsi2` succeeded. Start of `ora.keqjm.orcl.keqjm1.srv` on member `keqsi1` succeeded. Start of `ora.keqsi1.gsd` on member `keqsi1` succeeded. Start of `ora.keqjm.orcl.keqjm2.srv` on member `keqsi2` succeeded. Start of `ora.keqsi2.gsd` on member `keqsi2` succeeded. CRS-0223: Resource 'ora.keqjm.db' has placement error. CRS-0223: Resource 'ora.keqsi1.ons' has placement error. CRS-0223: Resource 'ora.keqsi2.ons' has placement error. [oracle@keqsi1 admin]$ crs_stat -t Name Type Target State Host ------------------------------------------------------------ ora.keqjm.db application ONLINE ONLINE keqsi2 ora....m1.inst application ONLINE ONLINE keqsi1 ora....m2.inst application ONLINE ONLINE keqsi2 ora....orcl.cs application ONLINE ONLINE keqsi2 ora....jm1.srv application ONLINE ONLINE keqsi1 ora....jm2.srv application ONLINE ONLINE keqsi2 ora....SM1.asm application ONLINE ONLINE keqsi1 ora....I1.lsnr application ONLINE ONLINE keqsi1 ora.keqsi1.gsd application ONLINE ONLINE keqsi1 ora.keqsi1.ons application ONLINE ONLINE keqsi1 ora.keqsi1.vip application ONLINE ONLINE keqsi1 ora....SM2.asm application ONLINE ONLINE keqsi2 ora....I2.lsnr application ONLINE ONLINE keqsi2 ora.keqsi2.gsd application ONLINE ONLINE keqsi2 ora.keqsi2.ons application ONLINE ONLINE keqsi2 ora.keqsi2.vip application ONLINE ONLINE keqsi2 [oracle@keqsi1 admin]$
修改数据库中的初始化参数LOCAL_LISTENER和REMOTE_LISTENER
oracle@keqsi1 admin ]$ sqlplus / as sysdba SQL*Plus: Release 10.2.0.5.0 - Production on Wed Aug 28 00:26:39 2013 Copyright (c) 1982, 2010, Oracle. All Rights Reserved. Connected to: Oracle Database 10g Enterprise Edition Release 10.2.0.5.0 - Production With the Partitioning, Real Application Clusters, OLAP, Data Mining and Real Application Testing options SQL> ALTER SYSTEM 2 SET LOCAL_LISTENER = '(ADDRESS = (PROTOCOL = TCP)(HOST = 10.53.1.237)(PORT = 1521))' 3 SID = 'keqsi1'; 系统已更改。 SQL> ALTER SYSTEM 2 SET LOCAL_LISTENER = '(ADDRESS = (PROTOCOL = TCP)(HOST = 10.53.1.238)(PORT = 1521))' 3 SID = 'keqsi2'; 系统已更改。 SQL> ALTER SYSTEM 2 SET REMOTE_LISTENER = 'LISTENERS_KEQJM' 3 SID = '*'; 系统已更改。
其中’LISTENERS_KEQJM’对应于tnsnames.ora中的LISTENERS_KEQJM
连接串,该参数用于rac的负载均衡
[oracle@keqsi1 admin]$ more tnsnames.ora # tnsnames.ora Network Configuration File: /u01/app/oracle/10gR2/db/network/admin/tnsnames.ora # Generated by Oracle configuration tools. KEQJM = (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = keqsi1-vip)(PORT = 1521)) (ADDRESS = (PROTOCOL = TCP)(HOST = keqsi2-vip)(PORT = 1521)) (LOAD_BALANCE = yes) (CONNECT_DATA = (SERVER = DEDICATED) (SERVICE_NAME = keqjm) ) ) KEQJM2 = (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = keqsi2-vip)(PORT = 1521)) (CONNECT_DATA = (SERVER = DEDICATED) (SERVICE_NAME = keqjm) (INSTANCE_NAME = keqjm2) ) ) KEQJM1 = (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = keqsi1-vip)(PORT = 1521)) (CONNECT_DATA = (SERVER = DEDICATED) (SERVICE_NAME = keqjm) (INSTANCE_NAME = keqjm1) ) ) LISTENERS_KEQJM = (ADDRESS_LIST = (ADDRESS = (PROTOCOL = TCP)(HOST = keqsi1-vip)(PORT = 1521)) (ADDRESS = (PROTOCOL = TCP)(HOST = keqsi2-vip)(PORT = 1521)) ) ORCL = (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = keqsi1-vip)(PORT = 1521)) (ADDRESS = (PROTOCOL = TCP)(HOST = keqsi2-vip)(PORT = 1521)) (LOAD_BALANCE = yes) (CONNECT_DATA = (SERVER = DEDICATED) (SERVICE_NAME = orcl) (FAILOVER_MODE = (TYPE = SELECT) (METHOD = BASIC) (RETRIES = 180) (DELAY = 5) ) ) ) EXTPROC_CONNECTION_DATA = (DESCRIPTION = (ADDRESS_LIST = (ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC0)) ) (CONNECT_DATA = (SID = PLSExtProc) (PRESENTATION = RO) ) )
下面是测看各个节点只监听自己的vip地址时通过remote_listener能不能实现
rac的负载均衡
在本机测试
[oracle@test admin]$ sqlplus /nolog SQL*Plus: Release 10.2.0.5.0 - Production on Wed Aug 28 00:31:45 2013 Copyright (c) 1982, 2010, Oracle. All Rights Reserved. SQL> conn test/test@keqsi Connected. SQL> select instance_name from v$instance; INSTANCE_NAME ---------------- keqjm1 SQL>exit [oracle@test admin]$ sqlplus /nolog SQL*Plus: Release 10.2.0.5.0 - Production on Wed Aug 28 00:31:45 2013 Copyright (c) 1982, 2010, Oracle. All Rights Reserved. SQL> conn test/test@keqsi Connected. SQL> select instance_name from v$instance; INSTANCE_NAME ---------------- keqjm2
经测试rac是可以负载均衡的
按照你所提供的解决方案看来,任何要登录到RAC的数据库不都得设置网络服务名为”LISTENERS_KEQJM”?
这样管理挺不方便的。一旦有应用不通过”LISTENERS_KEQJM”连接RAC数据库,肯定会出现负载不均衡的情况的。
LOCAL_LISTENER使PMON用LOCAL_LISTENER参数指定的地址连接LISTENER进行动态注册。LOCAL_LISTENER指定的IP地址必须是本机的IP地址。如果是非本机IP,则会忽略此参数,但是会从前一个已注册的监听中取消注册。与LOCAL_LISTENER对应的参数有REMOTE_LISTENER参数。REMOTE_LISTENER使PMON在远程(即非本机)监听上进行注册,这个参数在RAC中经常使用(用于负载均衡)。监听器的远程注册主要用于实现负载均衡。通常情况下,客户端发出的连接请求会首先被local_listener接受,然后由master instance来决定当前的连接请求应该由哪个目标instance发出server process响应这个连接请求。在启用了负载均衡的情形下,master instance会将请求转发到负载较小的实例,如果此时remote_listener中指定的实例负载较小,则当前的请求被重定向到负载较小的实例中来建立连接,派生服务器进程进行相应连接。
在RAC环境下不管是使用了默认的TCP和1521还是其他协议都建议配置LOCAL_LISTENER。REMOTE_LISTENER参数在RAC环境下非常重要,是服务器使用load_balance的一个工具,在服务器端的连接中,Oracle NET通过remote_listener确定当前RAC中的远程监听和实例,以便分发连接.