oracle数据库修改11.2 RAC 的 SCAN IP的例子

作者:袖梨 2022-06-29

在某些情况下,由于是C/S架构,从以前的单机系统迁移到现在11.2的rac中,如果修改客户端ip地址工作量太大,而且也不现实,一般建议直接修改scan ip地址和以前一样,从而实现业务直接访问scan ip实现应用不用一个个单独配置.这里通过简单演示,实现修改scan ip的过程(网段不变),主要是把scan名字为scan-xff的ip地址从192.168.137.245修改为192.168.137.248
查看当前scan ip信息
[root-www.111com.net@xff1 ~]# ping xff-scan
PING xff-scan (192.168.137.245) 56(84) bytes of data.
^C
--- xff-scan ping statistics ---
2 packets transmitted, 0 received, 100% packet loss, time 1738ms
[root-www.111com.net@xff1 ~]# crsctl status res -t
--------------------------------------------------------------------------------
NAME           TARGET  STATE        SERVER                   STATE_DETAILS      
--------------------------------------------------------------------------------
Local Resources
--------------------------------------------------------------------------------
ora.DATA.dg
               ONLINE  ONLINE       xff1                                        
               ONLINE  ONLINE       xff2                                        
ora.LISTENER.lsnr
               ONLINE  ONLINE       xff1                                        
               ONLINE  ONLINE       xff2                                        
ora.asm
               ONLINE  ONLINE       xff1                     Started            
               ONLINE  ONLINE       xff2                     Started            
ora.gsd
               OFFLINE OFFLINE      xff1                                        
               OFFLINE OFFLINE      xff2                                        
ora.net1.network
               ONLINE  ONLINE       xff1                                        
               ONLINE  ONLINE       xff2                                        
ora.ons
               ONLINE  ONLINE       xff1                                        
               ONLINE  ONLINE       xff2                                        
--------------------------------------------------------------------------------
Cluster Resources
--------------------------------------------------------------------------------
ora.LISTENER_SCAN1.lsnr
      1        ONLINE  ONLINE       xff1                                        
ora.cvu
      1        ONLINE  ONLINE       xff1                                        
ora.oc4j
      1        ONLINE  ONLINE       xff1                                        
ora.scan1.vip
      1        ONLINE  ONLINE       xff1                                        
ora.xff1.vip
      1        ONLINE  ONLINE       xff1                                        
ora.xff2.vip
      1        ONLINE  ONLINE       xff2                                        
ora.xffdb.db
      1        ONLINE  ONLINE       xff1                     Open               
      2        ONLINE  ONLINE       xff2                     Open  
[root-www.111com.net@xff1 ~]# srvctl config scan
SCAN name: xff-scan, Network: 1/192.168.137.0/255.255.255.0/eth0
SCAN VIP name: scan1, IP: /xff-scan/192.168.137.245
修改scan ip
[root-www.111com.net@xff1 ~]# srvctl stop scan_listener
[root-www.111com.net@xff1 ~]# srvctl stop scan
[root-www.111com.net@xff1 ~]# crsctl status res -t
--------------------------------------------------------------------------------
NAME           TARGET  STATE        SERVER                   STATE_DETAILS      
--------------------------------------------------------------------------------
Local Resources
--------------------------------------------------------------------------------
ora.DATA.dg
               ONLINE  ONLINE       xff1                                        
               ONLINE  ONLINE       xff2                                        
ora.LISTENER.lsnr
               ONLINE  ONLINE       xff1                                        
               ONLINE  ONLINE       xff2                                        
ora.asm
               ONLINE  ONLINE       xff1                     Started            
               ONLINE  ONLINE       xff2                     Started            
ora.gsd
               OFFLINE OFFLINE      xff1                                        
               OFFLINE OFFLINE      xff2                                        
ora.net1.network
               ONLINE  ONLINE       xff1                                        
               ONLINE  ONLINE       xff2                                        
ora.ons
               ONLINE  ONLINE       xff1                                        
               ONLINE  ONLINE       xff2                                        
--------------------------------------------------------------------------------
Cluster Resources
--------------------------------------------------------------------------------
ora.LISTENER_SCAN1.lsnr
      1        OFFLINE OFFLINE                                                  
ora.cvu
      1        ONLINE  ONLINE       xff1                                        
ora.oc4j
      1        ONLINE  ONLINE       xff1                                        
ora.scan1.vip
      1        OFFLINE OFFLINE                                                  
ora.xff1.vip
      1        ONLINE  ONLINE       xff1                                        
ora.xff2.vip
      1        ONLINE  ONLINE       xff2                                        
ora.xffdb.db
      1        ONLINE  ONLINE       xff1                     Open               
      2        ONLINE  ONLINE       xff2                     Open
 
--如果是dns,注意修改dns中scan ip信息,如果是hosts文件注意多个节点都需要修改
[root-www.111com.net@xff1 ~]# ping xff-scan
PING xff-scan (192.168.137.248) 56(84) bytes of data.
^C
--- xff-scan ping statistics ---
2 packets transmitted, 0 received, 100% packet loss, time 1738ms
 
[root-www.111com.net@xff1 ~]# srvctl modify scan -n xff-scan
[root-www.111com.net@xff1 ~]# srvctl config scan
SCAN name: xff-scan, Network: 1/192.168.137.0/255.255.255.0/eth0
SCAN VIP name: scan1, IP: /xff-scan/192.168.137.248
[root-www.111com.net@xff1 ~]# srvctl start scan
[root-www.111com.net@xff1 ~]# srvctl start scan_listener
[root-www.111com.net@xff1 ~]# crsctl status res -t
--------------------------------------------------------------------------------
NAME           TARGET  STATE        SERVER                   STATE_DETAILS      
--------------------------------------------------------------------------------
Local Resources
--------------------------------------------------------------------------------
ora.DATA.dg
               ONLINE  ONLINE       xff1                                        
               ONLINE  ONLINE       xff2                                        
ora.LISTENER.lsnr
               ONLINE  ONLINE       xff1                                        
               ONLINE  ONLINE       xff2                                        
ora.asm
               ONLINE  ONLINE       xff1                     Started            
               ONLINE  ONLINE       xff2                     Started            
ora.gsd
               OFFLINE OFFLINE      xff1                                        
               OFFLINE OFFLINE      xff2                                        
ora.net1.network
               ONLINE  ONLINE       xff1                                        
               ONLINE  ONLINE       xff2                                        
ora.ons
               ONLINE  ONLINE       xff1                                        
               ONLINE  ONLINE       xff2                                        
--------------------------------------------------------------------------------
Cluster Resources
--------------------------------------------------------------------------------
ora.LISTENER_SCAN1.lsnr
      1        ONLINE  ONLINE       xff2                                        
ora.cvu
      1        ONLINE  ONLINE       xff1                                        
ora.oc4j
      1        ONLINE  ONLINE       xff1                                        
ora.scan1.vip
      1        ONLINE  ONLINE       xff2                                        
ora.xff1.vip
      1        ONLINE  ONLINE       xff1                                        
ora.xff2.vip
      1        ONLINE  ONLINE       xff2                                        
ora.xffdb.db
      1        ONLINE  ONLINE       xff1                     Open               
      2        ONLINE  ONLINE       xff2                     Open
查看修改后的scan listener状态
xff2:/home/grid> lsnrctl status LISTENER_SCAN1
 
LSNRCTL for Linux: Version 11.2.0.4.0 - Production on 12-MAR-2016 17:02:32
 
Copyright (c) 1991, 2013, Oracle.  All rights reserved.
 
Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=LISTENER_SCAN1)))
STATUS of the LISTENER
------------------------
Alias                     LISTENER_SCAN1
Version                   TNSLSNR for Linux: Version 11.2.0.4.0 - Production
Start Date                12-MAR-2016 16:59:05
Uptime                    0 days 0 hr. 3 min. 27 sec
Trace Level               off
Security                  ON: Local OS Authentication
SNMP                      OFF
Listener Parameter File   /u01/oracle/app/grid/network/admin/listener.ora
Listener Log File         /u01/oracle/app/grid/log/diag/tnslsnr/xff2/listener_scan1/alert/log.xml
Listening Endpoints Summary...
  (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=LISTENER_SCAN1)))
  (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=192.168.137.248)(PORT=1521)))
The listener supports no services
The command completed successfully
 
[root-www.111com.net@xff2 ~]# su - oracle
xff2:/home/oracle> sqlplus / as sysdba
 
SQL*Plus: Release 11.2.0.4.0 Production on Sat Mar 12 17:01:11 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, OLAP,
Data Mining and Real Application Testing options
 
SQL> alter system register;
 
System altered.
 
SQL> /
 
System altered.
 
SQL> exit
Disconnected from Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production
With the Partitioning, Real Application Clusters, Automatic Storage Management, OLAP,
Data Mining and Real Application Testing options
xff2:/home/oracle> exit
logout
[root-www.111com.net@xff2 ~]# su - grid
xff2:/home/grid> lsnrctl status LISTENER_SCAN1
 
LSNRCTL for Linux: Version 11.2.0.4.0 - Production on 12-MAR-2016 17:01:24
 
Copyright (c) 1991, 2013, Oracle.  All rights reserved.
 
Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=LISTENER_SCAN1)))
STATUS of the LISTENER
------------------------
Alias                     LISTENER_SCAN1
Version                   TNSLSNR for Linux: Version 11.2.0.4.0 - Production
Start Date                12-MAR-2016 16:59:05
Uptime                    0 days 0 hr. 2 min. 18 sec
Trace Level               off
Security                  ON: Local OS Authentication
SNMP                      OFF
Listener Parameter File   /u01/oracle/app/grid/network/admin/listener.ora
Listener Log File         /u01/oracle/app/grid/log/diag/tnslsnr/xff2/listener_scan1/alert/log.xml
Listening Endpoints Summary...
  (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=LISTENER_SCAN1)))
  (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=192.168.137.248)(PORT=1521)))
The listener supports no services
The command completed successfully
这里发现修改scan ip之后,scan listener没有正确或者到监听的动态注册信息,哪怕人工执行了alter system register;也不行.

通过重启数据库,解决修改scan ip后的动态监听注册问题
[root-www.111com.net@xff2 ~]# su - oracle
xff2:/home/oracle> srvctl stop database -d xffdb
xff2:/home/oracle> srvctl start database -d xffdb
xff2:/home/oracle> exit
logout
[root-www.111com.net@xff2 ~]# su - grid
xff2:/home/grid> lsnrctl status LISTENER_SCAN1
 
LSNRCTL for Linux: Version 11.2.0.4.0 - Production on 12-MAR-2016 17:06:17
 
Copyright (c) 1991, 2013, Oracle.  All rights reserved.
 
Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=LISTENER_SCAN1)))
STATUS of the LISTENER
------------------------
Alias                     LISTENER_SCAN1
Version                   TNSLSNR for Linux: Version 11.2.0.4.0 - Production
Start Date                12-MAR-2016 16:59:05
Uptime                    0 days 0 hr. 7 min. 11 sec
Trace Level               off
Security                  ON: Local OS Authentication
SNMP                      OFF
Listener Parameter File   /u01/oracle/app/grid/network/admin/listener.ora
Listener Log File         /u01/oracle/app/grid/log/diag/tnslsnr/xff2/listener_scan1/alert/log.xml
Listening Endpoints Summary...
  (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=LISTENER_SCAN1)))
  (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=192.168.137.248)(PORT=1521)))
Services Summary...
Service "xffdb" has 2 instance(s).
  Instance "xffdb1", status READY, has 1 handler(s) for this service...
  Instance "xffdb2", status READY, has 1 handler(s) for this service...
Service "xffdbXDB" has 2 instance(s).
  Instance "xffdb1", status READY, has 1 handler(s) for this service...
  Instance "xffdb2", status READY, has 1 handler(s) for this service...
The command completed successfully

原文来自:http://www.xifenfei.com/2016/03/修改11-2-rac-的-scan-ip.html

相关文章

精彩推荐