11.2.0.4 RAC,一个节点宕机,此时VIP FAILOVER到了另一节点。
此时存在大量客户端连接,客户端使用VIP连接到数据库服务器;
且一半客户端为连接节点1 VIP,另一半客户端为连接节点2 VIP。
此时为了快速恢复客户端到数据库连接,使用在服务器端修改监听相关配置,使存活的数据库实例注册到VIP1/VIP2。
客户端可以不进行修改的连接到数据库。
—————-需求比较扯,最好还是用11G的SCAN IP。
1.查看FAILOVER后存活节点上的IP状态信息:
[grid@bys1 admin]$ ifconfig
eth0 Link encap:Ethernet HWaddr 08:00:27:29:4B:B4
inet addr:192.168.57.215 Bcast:192.168.57.255 Mask:255.255.255.0
inet6 addr: fe80::a00:27ff:fe29:4bb4/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:3383 errors:0 dropped:0 overruns:0 frame:0
TX packets:3107 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:307995 (300.7 KiB) TX bytes:388155 (379.0 KiB)
eth0:1 Link encap:Ethernet HWaddr 08:00:27:29:4B:B4
inet addr:192.168.57.219 Bcast:192.168.57.255 Mask:255.255.255.0
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
eth0:2 Link encap:Ethernet HWaddr 08:00:27:29:4B:B4
inet addr:192.168.57.218 Bcast:192.168.57.255 Mask:255.255.255.0
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
eth0:3 Link encap:Ethernet HWaddr 08:00:27:29:4B:B4
inet addr:192.168.57.216 Bcast:192.168.57.255 Mask:255.255.255.0
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
eth1 Link encap:Ethernet HWaddr 08:00:27:64:B0:1C
inet addr:192.168.58.1 Bcast:192.168.58.255 Mask:255.255.255.0
inet6 addr: fe80::a00:27ff:fe64:b01c/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:364 errors:0 dropped:0 overruns:0 frame:0
TX packets:79 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:37826 (36.9 KiB) TX bytes:12624 (12.3 KiB)
eth1:1 Link encap:Ethernet HWaddr 08:00:27:64:B0:1C
inet addr:169.254.167.252 Bcast:169.254.255.255 Mask:255.255.0.0
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
lo Link encap:Local Loopback
inet addr:127.0.0.1 Mask:255.0.0.0
inet6 addr: ::1/128 Scope:Host
UP LOOPBACK RUNNING MTU:65536 Metric:1
RX packets:21148 errors:0 dropped:0 overruns:0 frame:0
TX packets:21148 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:12245612 (11.6 MiB) TX bytes:12245612 (11.6 MiB)
[grid@bys1 admin]$ cat /etc/hosts
127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4
::1 localhost localhost.localdomain localhost6 localhost6.localdomain6
192.168.57.215 bys1.bys.com bys1
192.168.57.216 bys1-vip.bys.com bys1-vip
192.168.57.217 bys2.bys.com bys2
192.168.57.218 bys2-vip.bys.com bys2-vip
192.168.58.1 bys1-priv.bys.com bys1-priv
192.168.58.2 bys2-priv.bys.com bys2-priv
192.168.57.219 bysrac-scan.bys.com bysrac-scan
2.修改GRID下监听配置文件:
[grid@bys1 admin]$ cat listener.ora
#LISTENER=(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=IPC)(KEY=LISTENER)))) # line added by Agent
###ADD BY DBA
LISTENER =
(DESCRIPTION_LIST =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.57.215)(PORT = 1521))
(ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.57.216)(PORT = 1521))
(ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.57.218)(PORT = 1521))
(ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1521))
)
)
###
LISTENER_SCAN1=(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=IPC)(KEY=LISTENER_SCAN1)))) # line added by Agent
ENABLE_GLOBAL_DYNAMIC_ENDPOINT_LISTENER_SCAN1=ON # line added by Agent
ENABLE_GLOBAL_DYNAMIC_ENDPOINT_LISTENER=ON # line added by Agent
3.修改数据库local_listener参数
11.2.0.4 local_listener 默认是注册到本节点的VIP上。
SQL> show parameter local
NAME TYPE VALUE
———————————— ———– ——————————
local_listener string (ADDRESS=(PROTOCOL=TCP)(HOST=
192.168.57.216)(PORT=1521))
SQL> alter system set local_listener=”;
System altered.
修改为空值,则向本主机上所有IP地址注册。
SQL> show parameter local
NAME TYPE VALUE
———————————— ———– ——————————
local_listener string
log_archive_local_first boolean TRUE
parallel_force_local boolean FALSE
4.登陆测试:使用本机公网IP、VIP、宕机节点的VIP均可以连接–192.168.57.215/216/218
[oracle@bys1 ~]$ sqlplus system/oracle@192.168.57.215:1521/bysrac
SQL*Plus: Release 11.2.0.4.0 Production on Thu Nov 17 14:46:19 2016
Copyright (c) 1982, 2013, Oracle. All rights reserved.
Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 – 64bit Production
With the Partitioning, Real Application Clusters, Automatic Storage Management, Oracle Label Security,
OLAP, Data Mining, Oracle Database Vault and Real Application Testing options
SQL> exit
[oracle@bys1 ~]$ sqlplus system/oracle@192.168.57.216:1521/bysrac
SQL*Plus: Release 11.2.0.4.0 Production on Thu Nov 17 14:46:23 2016
Copyright (c) 1982, 2013, Oracle. All rights reserved.
Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 – 64bit Production
With the Partitioning, Real Application Clusters, Automatic Storage Management, Oracle Label Security,
OLAP, Data Mining, Oracle Database Vault and Real Application Testing options
SQL> exit
[oracle@bys1 ~]$ sqlplus system/oracle@192.168.57.218:1521/bysrac
SQL*Plus: Release 11.2.0.4.0 Production on Thu Nov 17 14:46:28 2016
Copyright (c) 1982, 2013, Oracle. All rights reserved.
Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 – 64bit Production
With the Partitioning, Real Application Clusters, Automatic Storage Management, Oracle Label Security,
OLAP, Data Mining, Oracle Database Vault and Real Application Testing options
SQL> exit