11G RAC 一節點當機後修改監聽相關配置使通過當機節點VIP連線資料庫的客戶端可以連線

還不算暈發表於2016-11-17
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





相關文章