RAC重建SCAN IP

dbLjy2015發表於2016-10-25

1.檢視原始scanIP

[root@vast1 ~]# su - grid

[grid@vast1 ~]$ srvctl config scan

SCAN name: scan-ip, Network: 1/192.168.80.0/255.255.255.0/eth0

SCAN VIP name: scan1, IP: /scan-ip/192.168.80.111

SCAN VIP name: scan2, IP: /scan-ip/192.168.80.112

SCAN VIP name: scan3, IP: /scan-ip/192.168.80.113

可見scanIP的別名是scan-ip,當前SCANIP192.168.80.111192.168.80.112192.168.80.113

2. 停止監聽

[grid@vast1 ~]$ srvctl stop listener

[grid@vast1 ~]$ crsctl stat res -t

-------------------------------------------------------------------------------

NAME           TARGET  STATE        SERVER                   STATE_DETAILS      

-------------------------------------------------------------------------------

Local Resources

-------------------------------------------------------------------------------

ora.DATA.dg

               ONLINE  ONLINE       vast1                                       

               ONLINE  ONLINE       vast2                                       

ora.FRA.dg

               ONLINE  ONLINE       vast1                                       

               ONLINE  ONLINE       vast2                                       

ora.LISTENER.lsnr

               OFFLINE OFFLINE      vast1                                        

               OFFLINE OFFLINE      vast2                                       

ora.asm

               ONLINE  ONLINE       vast1                    Started            

               ONLINE  ONLINE       vast2                    Started             

ora.gsd

               OFFLINE OFFLINE      vast1                                       

               OFFLINE OFFLINE      vast2                                       

ora.net1.network

               ONLINE  ONLINE       vast1                                        

               ONLINE  ONLINE       vast2                                       

ora.ons

               ONLINE  ONLINE       vast1                                       

               ONLINE  ONLINE       vast2                                       

-------------------------------------------------------------------------------

Cluster Resources

-------------------------------------------------------------------------------

ora.LISTENER_SCAN1.lsnr

      1        ONLINE  ONLINE       vast2                                       

ora.LISTENER_SCAN2.lsnr

      1        ONLINE  ONLINE       vast1                                       

ora.LISTENER_SCAN3.lsnr

      1        ONLINE  ONLINE       vast1                                       

ora.cvu

      1        ONLINE  ONLINE       vast1                                       

ora.oc4j

      1        ONLINE  ONLINE       vast1                                       

ora.rac.db

      1        ONLINE  ONLINE       vast1                    Open               

      2        ONLINE  ONLINE       vast2                    Open               

ora.scan1.vip

      1        ONLINE  ONLINE       vast2                                        

ora.scan2.vip

      1        ONLINE  ONLINE       vast1                                       

ora.scan3.vip

      1        ONLINE  ONLINE       vast1                                       

ora.vast1.vip

      1        ONLINE  ONLINE       vast1                                        

ora.vast2.vip

      1        ONLINE  ONLINE       vast2                                       

[grid@vast1 ~]$ srvctl status listener

Listener LISTENER is enabled

Listener LISTENER is not running

 

3.停止scanIPscan_listener

先停scan_listener,後停scanIP

[grid@vast1 ~]$ srvctl stop scan_listener

[grid@vast1 ~]$ srvctl stop scan

 

4.檢視狀態

[grid@vast1 ~]$ srvctl status scan_listener

SCAN Listener LISTENER_SCAN1 is enabled

SCAN listener LISTENER_SCAN1 is not running

SCAN Listener LISTENER_SCAN2 is enabled

SCAN listener LISTENER_SCAN2 is not running

SCAN Listener LISTENER_SCAN3 is enabled

SCAN listener LISTENER_SCAN3 is not running

--此時監聽可用但沒有執行

[grid@vast1 ~]$ srvctl status scan

SCAN VIP scan1 is enabled

SCAN VIP scan1 is not running

SCAN VIP scan2 is enabled

SCAN VIP scan2 is not running

SCAN VIP scan3 is enabled

SCAN VIP scan3 is not running

[grid@vast1 ~]$ crs_stat -t |grep  lsnr

ora....ER.lsnr ora....er.type OFFLINE   OFFLINE              

ora....N1.lsnr ora....er.type OFFLINE   OFFLINE              

ora....N2.lsnr ora....er.type OFFLINE   OFFLINE              

ora....N3.lsnr ora....er.type OFFLINE   OFFLINE              

ora....T1.lsnr application    OFFLINE   OFFLINE              

ora....T2.lsnr application    OFFLINE   OFFLINE              

[grid@vast1 ~]$ exit

 

5.修改/etc/hosts檔案

[root@vast1 ~]# vi /etc/hosts

127.0.0.1   localhost localhost.localdomain localhost4 localhost4.localdomain4

::1         localhost localhost.localdomain localhost6 localhost6.localdomain6

##Public Network - (eth0)

192.168.80.31 vast1

192.168.80.32 vast2

 

##Private Interconnect - (eth1)

10.0.0.11 vast1-priv

10.0.0.12 vast2-priv

 

##Public Virtual IP (VIP) addresses - (eth0)

192.168.80.131 vast1-vip

192.168.80.132 vast2-vip

##Scan IP

192.168.80.111(4 scan-ip

192.168.80.112(5 scan-ip

192.168.80.113(6scan-ip

以上為將原IP192.168.80.111改為192.168.80.114,以此類推

修改節點二hosts檔案,內容同節點一相同

[root@vast1 ~]# ssh vast2

root@vast2's password:

Last login: Tue Oct 25 04:19:39 2016 from 192.168.80.1

[root@vast2 ~]# vi /etc/hosts

127.0.0.1   localhost localhost.localdomain localhost4 localhost4.localdomain4

::1         localhost localhost.localdomain localhost6 localhost6.localdomain6

##Public Network - (eth0)

192.168.80.31 vast1

192.168.80.32 vast2

 

##Private Interconnect - (eth1)

10.0.0.11 vast1-priv

10.0.0.12 vast2-priv

 

##Public Virtual IP (VIP) addresses - (eth0)

192.168.80.131 vast1-vip

192.168.80.132 vast2-vip

##Scan IP

192.168.80.111(4 scan-ip

192.168.80.112(5 scan-ip

192.168.80.113(6 scan-ip

~

[root@vast2 ~]# exit

logout

Connection to vast2 closed.

 

6.使用root修改叢集scanIP

此步一定要使用root使用者進行修改

[root@vast1 ~]# /u01/app/11.2.0/grid/bin/srvctl modify scan -n scan-ip

7.檢視scanIP

[root@vast1 ~]# /u01/app/11.2.0/grid/bin/srvctl config scan

SCAN name: scan-ip, Network: 1/192.168.80.0/255.255.255.0/eth0

SCAN VIP name: scan1, IP: /scan-ip/192.168.80.114

SCAN VIP name: scan2, IP: /scan-ip/192.168.80.115

SCAN VIP name: scan3, IP: /scan-ip/192.168.80.116

可見此時IP已經被修改完成

8.開啟scanIPscan監聽

先開啟scan監聽

[root@vast1 ~]# su - grid

[grid@vast1 ~]$ srvctl start scan

[grid@vast1 ~]$ srvctl start scan_listener

 

9.檢視狀態

[grid@vast1 ~]$ crs_stat -t | grep scan

ora.scan1.vip  ora....ip.type ONLINE    ONLINE    vast2      

ora.scan2.vip  ora....ip.type ONLINE    ONLINE    vast1      

ora.scan3.vip  ora....ip.type ONLINE    ONLINE    vast1      

[grid@vast1 ~]$ crs_stat -t | grep lsnr

ora....ER.lsnr ora....er.type OFFLINE   OFFLINE              

ora....N1.lsnr ora....er.type ONLINE    ONLINE    vast2      

ora....N2.lsnr ora....er.type ONLINE    ONLINE    vast1      

ora....N3.lsnr ora....er.type ONLINE    ONLINE    vast1      

ora....T1.lsnr application    OFFLINE   OFFLINE              

ora....T2.lsnr application    OFFLINE   OFFLINE              

 

10.開啟LISTENER監聽

[grid@vast1 ~]$  srvctl start listener

 

11.檢視狀態

[grid@vast1 ~]$ crs_stat -t | grep lsnr

ora....ER.lsnr ora....er.type ONLINE    ONLINE    vast1      

ora....N1.lsnr ora....er.type ONLINE    ONLINE    vast2      

ora....N2.lsnr ora....er.type ONLINE    ONLINE    vast1      

ora....N3.lsnr ora....er.type ONLINE    ONLINE    vast1      

ora....T1.lsnr application    ONLINE    ONLINE    vast1      

ora....T2.lsnr application    ONLINE    ONLINE    vast2      

[grid@vast1 ~]$ crsctl stat res -t

-------------------------------------------------------------------------------

NAME           TARGET  STATE        SERVER                   STATE_DETAILS      

-------------------------------------------------------------------------------

Local Resources

-------------------------------------------------------------------------------

ora.DATA.dg

               ONLINE  ONLINE       vast1                                       

               ONLINE  ONLINE       vast2                                       

ora.FRA.dg

               ONLINE  ONLINE       vast1                                       

               ONLINE  ONLINE       vast2                                       

ora.LISTENER.lsnr

               ONLINE  ONLINE       vast1                                        

               ONLINE  ONLINE       vast2                                       

ora.asm

               ONLINE  ONLINE       vast1                    Started            

               ONLINE  ONLINE       vast2                    Started            

ora.gsd

               OFFLINE OFFLINE      vast1                                       

               OFFLINE OFFLINE      vast2                                       

ora.net1.network

               ONLINE  ONLINE       vast1                                       

               ONLINE  ONLINE       vast2                                       

ora.ons

               ONLINE  ONLINE       vast1                                        

               ONLINE  ONLINE       vast2                                       

-------------------------------------------------------------------------------

Cluster Resources

-------------------------------------------------------------------------------

ora.LISTENER_SCAN1.lsnr

      1        ONLINE  ONLINE       vast2                                       

ora.LISTENER_SCAN2.lsnr

      1        ONLINE  ONLINE       vast1                                       

ora.LISTENER_SCAN3.lsnr

      1        ONLINE  ONLINE       vast1                                       

ora.cvu

      1        ONLINE  ONLINE       vast1                                       

ora.oc4j

      1        ONLINE  ONLINE       vast1                                        

ora.rac.db

      1        ONLINE  ONLINE       vast1                    Open               

      2        ONLINE  ONLINE       vast2                    Open               

ora.scan1.vip

      1        ONLINE  ONLINE       vast2                                       

ora.scan2.vip

      1        ONLINE  ONLINE       vast1                                       

ora.scan3.vip

      1        ONLINE  ONLINE       vast1                                        

ora.vast1.vip

      1        ONLINE  ONLINE       vast1                                       

ora.vast2.vip

      1        ONLINE  ONLINE       vast2                                       

 

11.檢視各scan_listener狀態

[grid@vast1 ~]$ lsnrctl status listener_scan1

 

LSNRCTL for Linux: Version 11.2.0.3.0 - Production on 25-OCT-2016 04:32:15

 

Copyright (c) 1991, 2011, Oracle.  All rights reserved.

 

Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=LISTENER_SCAN1)))

TNS-12541: TNS:no listener

 TNS-12560: TNS:protocol adapter error

  TNS-00511: No listener

   Linux Error: 2: No such file or directory

[grid@vast1 ~]$ lsnrctl status listener_scan2

 

LSNRCTL for Linux: Version 11.2.0.3.0 - Production on 25-OCT-2016 04:32:19

 

Copyright (c) 1991, 2011, Oracle.  All rights reserved.

 

Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=LISTENER_SCAN2)))

STATUS of the LISTENER

------------------------

Alias                     LISTENER_SCAN2

Version                   TNSLSNR for Linux: Version 11.2.0.3.0 - Production

Start Date                25-OCT-2016 04:30:45

Uptime                    0 days 0 hr. 1 min. 33 sec

Trace Level               off

Security                  ON: Local OS Authentication

SNMP                      OFF

Listener Parameter File   /u01/app/11.2.0/grid/network/admin/listener.ora

Listener Log File         /u01/app/grid/diag/tnslsnr/vast1/listener_scan2/alert/log.xml

Listening Endpoints Summary...

  (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=LISTENER_SCAN2)))

  (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=192.168.80.115)(PORT=1521)))

The listener supports no services

The command completed successfully

[grid@vast1 ~]$ lsnrctl status listener_scan3

 

LSNRCTL for Linux: Version 11.2.0.3.0 - Production on 25-OCT-2016 04:32:28

 

Copyright (c) 1991, 2011, Oracle.  All rights reserved.

 

Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=LISTENER_SCAN3)))

STATUS of the LISTENER

------------------------

Alias                     LISTENER_SCAN3

Version                   TNSLSNR for Linux: Version 11.2.0.3.0 - Production

Start Date                25-OCT-2016 04:30:47

Uptime                    0 days 0 hr. 1 min. 40 sec

Trace Level               off

Security                  ON: Local OS Authentication

SNMP                      OFF

Listener Parameter File   /u01/app/11.2.0/grid/network/admin/listener.ora

Listener Log File         /u01/app/grid/diag/tnslsnr/vast1/listener_scan3/alert/log.xml

Listening Endpoints Summary...

  (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=LISTENER_SCAN3)))

  (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=192.168.80.116)(PORT=1521)))

The listener supports no services

The command completed successfully

 

發現這時候還沒有資料庫的資訊註冊進來,最重要的一步,重啟資料庫。

測試環境中重啟資料庫很容易,但要在生產環境就大不相同了。

(1)     做好備份

(2)     確認資料檔案是否有壞塊

(3)     確認停機時間

12.重啟資料庫

[grid@vast1 ~]$ srvctl  stop database -d rac

[grid@vast1 ~]$ srvctl  start database -d rac

13.檢視各scan_listener

[grid@vast1 ~]$ lsnrctl status listener_scan1

LSNRCTL for Linux: Version 11.2.0.3.0 - Production on 25-OCT-2016 04:36:46

Copyright (c) 1991, 2011, Oracle.  All rights reserved.

Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=LISTENER_SCAN1)))

TNS-12541: TNS:no listener

 TNS-12560: TNS:protocol adapter error

  TNS-00511: No listener

   Linux Error: 2: No such file or directory

[grid@vast1 ~]$ lsnrctl status listener_scan2

LSNRCTL for Linux: Version 11.2.0.3.0 - Production on 25-OCT-2016 04:36:48

Copyright (c) 1991, 2011, Oracle.  All rights reserved.

Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=LISTENER_SCAN2)))

STATUS of the LISTENER

------------------------

Alias                     LISTENER_SCAN2

Version                   TNSLSNR for Linux: Version 11.2.0.3.0 - Production

Start Date                25-OCT-2016 04:30:45

Uptime                    0 days 0 hr. 6 min. 3 sec

Trace Level               off

Security                  ON: Local OS Authentication

SNMP                      OFF

Listener Parameter File   /u01/app/11.2.0/grid/network/admin/listener.ora

Listener Log File         /u01/app/grid/diag/tnslsnr/vast1/listener_scan2/alert/log.xml

Listening Endpoints Summary...

  (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=LISTENER_SCAN2)))

  (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=192.168.80.115)(PORT=1521)))

Services Summary...

Service "rac" has 2 instance(s).

  Instance "rac1", status READY, has 1 handler(s) for this service...

  Instance "rac2", status READY, has 1 handler(s) for this service...

Service "racXDB" has 2 instance(s).

  Instance "rac1", status READY, has 1 handler(s) for this service...

  Instance "rac2", status READY, has 1 handler(s) for this service...

The command completed successfully

[grid@vast1 ~]$ lsnrctl status listener_scan3

LSNRCTL for Linux: Version 11.2.0.3.0 - Production on 25-OCT-2016 04:36:51

Copyright (c) 1991, 2011, Oracle.  All rights reserved.

Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=LISTENER_SCAN3)))

STATUS of the LISTENER

------------------------

Alias                     LISTENER_SCAN3

Version                   TNSLSNR for Linux: Version 11.2.0.3.0 - Production

Start Date                25-OCT-2016 04:30:47

Uptime                    0 days 0 hr. 6 min. 4 sec

Trace Level               off

Security                  ON: Local OS Authentication

SNMP                      OFF

Listener Parameter File   /u01/app/11.2.0/grid/network/admin/listener.ora

Listener Log File         /u01/app/grid/diag/tnslsnr/vast1/listener_scan3/alert/log.xml

Listening Endpoints Summary...

  (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=LISTENER_SCAN3)))

  (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=192.168.80.116)(PORT=1521)))

Services Summary...

Service "rac" has 2 instance(s).

  Instance "rac1", status READY, has 1 handler(s) for this service...

  Instance "rac2", status READY, has 1 handler(s) for this service...

Service "racXDB" has 2 instance(s).

  Instance "rac1", status READY, has 1 handler(s) for this service...

  Instance "rac2", status READY, has 1 handler(s) for this service...

The command completed successfully

這裡listener_scan1沒有開啟,是因為listener_scan1在節點二上執行

14.測試各scanIP是否可以拼通

 

[grid@vast1 ~]$ ping 192.168.80.114

PING 192.168.80.114 (192.168.80.114) 56(84) bytes of data.

64 bytes from 192.168.80.114: icmp_seq=1 ttl=64 time=0.241 ms

64 bytes from 192.168.80.114: icmp_seq=2 ttl=64 time=0.502 ms

--- 192.168.80.114 ping statistics ---

2 packets transmitted, 2 received, 0% packet loss, time 1641ms

rtt min/avg/max/mdev = 0.241/0.371/0.502/0.131 ms

[grid@vast1 ~]$ ping 192.168.80.115

PING 192.168.80.115 (192.168.80.115) 56(84) bytes of data.

64 bytes from 192.168.80.115: icmp_seq=1 ttl=64 time=0.012 ms

64 bytes from 192.168.80.115: icmp_seq=2 ttl=64 time=0.030 ms

--- 192.168.80.115 ping statistics ---

2 packets transmitted, 2 received, 0% packet loss, time 1929ms

rtt min/avg/max/mdev = 0.012/0.021/0.030/0.009 ms

[grid@vast1 ~]$ ping 192.168.80.116

PING 192.168.80.116 (192.168.80.116) 56(84) bytes of data.

64 bytes from 192.168.80.116: icmp_seq=1 ttl=64 time=0.013 ms

64 bytes from 192.168.80.116: icmp_seq=2 ttl=64 time=0.044 ms

64 bytes from 192.168.80.116: icmp_seq=3 ttl=64 time=0.039 ms

--- 192.168.80.116 ping statistics ---

3 packets transmitted, 3 received, 0% packet loss, time 2399ms

到此,RAC環境中的scanIP就修改成功了





---------------------End--------------------------
           2016.10.25

來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/30820196/viewspace-2127091/,如需轉載,請註明出處,否則將追究法律責任。

相關文章