• oracle RAC 更换IP


    1.查看原来的数据库IP 信息

    [oracle@rac2 ~]$ cat /etc/hosts
    127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4
    ::1 localhost localhost.localdomain localhost6 localhost6.localdomain6
    192.168.3.180 rac1
    10.10.10.180 rac1-priv
    192.168.3.182 rac1-vip

    192.168.3.181 rac2
    10.10.10.181 rac2-priv
    192.168.3.183 rac2-vip

    192.168.3.184 rac-scan

     

     

     

     

     

    2.查看当前数据库状态

    [grid@rac2 ~]$ crsctl stat res -t
    --------------------------------------------------------------------------------
    Name Target State Server State details
    --------------------------------------------------------------------------------
    Local Resources
    --------------------------------------------------------------------------------
    ora.LISTENER.lsnr
    ONLINE ONLINE rac2 STABLE
    ora.MGMT.GHCHKPT.advm
    OFFLINE OFFLINE rac2 STABLE
    ora.chad
    ONLINE ONLINE rac2 STABLE
    ora.helper
    OFFLINE OFFLINE rac2 IDLE,STABLE
    ora.mgmt.ghchkpt.acfs
    OFFLINE OFFLINE rac2 STABLE
    ora.net1.network
    ONLINE ONLINE rac2 STABLE
    ora.ons
    ONLINE ONLINE rac2 STABLE
    ora.proxy_advm
    OFFLINE OFFLINE rac2 STABLE
    --------------------------------------------------------------------------------
    Cluster Resources
    --------------------------------------------------------------------------------
    ora.ASMNET1LSNR_ASM.lsnr(ora.asmgroup)
    1 ONLINE ONLINE rac2 STABLE
    2 ONLINE OFFLINE STABLE
    3 ONLINE OFFLINE STABLE
    ora.DATA.dg(ora.asmgroup)
    1 ONLINE ONLINE rac2 STABLE
    2 OFFLINE OFFLINE STABLE
    3 OFFLINE OFFLINE STABLE
    ora.LISTENER_SCAN1.lsnr
    1 ONLINE ONLINE rac2 STABLE
    ora.MGMT.dg(ora.asmgroup)
    1 ONLINE ONLINE rac2 STABLE
    2 OFFLINE OFFLINE STABLE
    3 OFFLINE OFFLINE STABLE
    ora.MGMTLSNR
    1 ONLINE ONLINE rac2 169.254.28.55 10.10.
    10.181,STABLE
    ora.OCR.dg(ora.asmgroup)
    1 ONLINE ONLINE rac2 STABLE
    2 OFFLINE OFFLINE STABLE
    3 OFFLINE OFFLINE STABLE
    ora.asm(ora.asmgroup)
    1 ONLINE ONLINE rac2 Started,STABLE
    2 OFFLINE OFFLINE STABLE
    3 OFFLINE OFFLINE STABLE
    ora.asmnet1.asmnetwork(ora.asmgroup)
    1 ONLINE ONLINE rac2 STABLE
    2 OFFLINE OFFLINE STABLE
    3 OFFLINE OFFLINE STABLE
    ora.cvu
    1 ONLINE ONLINE rac2 STABLE
    ora.mgmtdb
    1 ONLINE ONLINE rac2 Open,STABLE
    ora.prodb.db
    1 ONLINE ONLINE rac2 Open,HOME=/u01/app/o
    racle/product/19.3.0
    /db_1,STABLE
    ora.qosmserver
    1 ONLINE ONLINE rac2 STABLE
    ora.rac2.vip
    1 ONLINE ONLINE rac2 STABLE
    ora.rhpserver
    1 OFFLINE OFFLINE STABLE
    ora.scan1.vip
    1 ONLINE ONLINE rac2 STABLE
    --------------------------------------------------------------------------------

     

    3.看当前节点信息

    [grid@rac2 ~]$ srvctl config scan
    SCAN name: rac-scan, Network: 1
    Subnet IPv4: 192.168.3.0/255.255.255.0/enp0s3, static
    Subnet IPv6:
    SCAN 1 IPv4 VIP: 192.168.3.184
    SCAN VIP is enabled.

     

    4.停掉应用,禁用listener,关掉本地监听

    [grid@rac2 ~]$ srvctl disable listener
    [grid@rac2 ~]$
    [grid@rac2 ~]$ srvctl stop listener

    [grid@rac2 ~]$ srvctl status listener
    Listener LISTENER is disabled
    Listener LISTENER is not running
    [grid@rac2 ~]$

     

     

    5.关库

    [oracle@rac2 ~]$ cd /u01/app/19.3.0/grid/bin/

    [oracle@rac2 ~]$ srvctl enable database -d prodb
    [oracle@rac2 bin]$ srvctl stop database -d prodb

     

     

     

    6关掉 远程监听

     [grid@rac2 ~]$servctl disable scan_listener

     [grid@rac2 ~]$ srvctl stop  scan_listener

     

     

     

     

     

    [root@rac2 ~]# /u01/app/19.3.0/grid/bin/srvctl disable scan

     [root@rac2 ~]# /u01/app/19.3.0/grid/bin/srvctl stop scan

     [root@rac2 ~]#/u01/app/19.3.0/grid/bin/srvctl status scan

     

     

     

    7.关集群

    /u01/app/19.3.0/grid/bin/crsctl  stop  crs

     

    8.修改ip

    192.168.6.21 rac1
    10.10.10.20 rac1-priv
    192.168.6.22 rac1-vip

    192.168.6.20 rac2
    10.10.10.21 rac2-priv
    192.168.6.23 rac2-vip

    192.168.6.24 rac-scan

     

    [root@rac2 ~]# vi /etc/sysconfig/network-scripts/ifcfg-enp0s3
    [root@rac2 ~]# vi /etc/sysconfig/network-scripts/ifcfg-enp0s8
    [root@rac2 ~]#
    [root@rac2 ~]# service network restart
    Restarting network (via systemctl):
    Socket error Event: 32 Error: 10053.
    Connection closing...Socket close.

    Connection closed by foreign host.

    Disconnected from remote host(root2) at 17:10:54.

    Type `help' to learn how to use Xshell prompt.
    [c:~]$

     

    9.连接到ip 信息

     

    [root@rac2 ~]# ifconfig -a
    enp0s3: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
    inet 192.168.6.20 netmask 255.255.255.0 broadcast 192.168.3.255
    ether 08:00:27:3a:c4:85 txqueuelen 1000 (Ethernet)
    RX packets 5857 bytes 488487 (477.0 KiB)
    RX errors 0 dropped 0 overruns 0 frame 0
    TX packets 3278 bytes 449239 (438.7 KiB)
    TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0

    enp0s8: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
    inet 10.10.10.20 netmask 255.255.255.0 broadcast 10.10.10.255
    ether 08:00:27:a5:bd:18 txqueuelen 1000 (Ethernet)
    RX packets 0 bytes 0 (0.0 B)
    RX errors 0 dropped 0 overruns 0 frame 0
    TX packets 278 bytes 43961 (42.9 KiB)
    TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0

    lo: flags=73<UP,LOOPBACK,RUNN

     

    10. 启动crs

     

    [root@rac2 ~]# /u01/app/19.3.0/grid/bin/crsctl start crs

    [root@rac2 ~]# /u01/app/19.3.0/grid/bin/crsctl check crs
    CRS-4638: Oracle High Availability Services is online
    CRS-4537: Cluster Ready Services is online
    CRS-4529: Cluster Synchronization Services is online
    CRS-4533: Event Manager is online
    [root@rac2 ~]#

    11. 更新网卡信息(两个节点都需要操作,对于不同网段的ip,如果是同网段的可以忽略)

    [root@rac2 ~]# /u01/app/19.3.0/grid/bin/oifcfg getif
    enp0s3 192.168.3.0 global public
    enp0s8 10.10.10.0 global cluster_interconnect,asm
    [root@rac2 ~]#

     

    [root@rac2 ~]# /u01/app/19.3.0/grid/bin/oifcfg setif -global enp0s3/192.168.6.0:public
    [root@rac2 ~]# /u01/app/19.3.0/grid/bin/oifcfg getif
    enp0s8 10.10.10.0 global cluster_interconnect,asm
    enp0s3 192.168.6.0 global public
    [root@rac2 ~]#

    [root@rac2 ~]# /u01/app/19.3.0/grid/bin/oifcfg delif -global enp0s3
    [root@rac2 ~]# /u01/app/19.3.0/grid/bin/oifcfg getif
    enp0s8 10.10.10.0 global cluster_interconnect,asm
    [root@rac2 ~]#

    12. 更新 priv  ip   (两个节点都需要操作,对于不同网段的ip,如果是同网段的可以忽略)

    13. 更新vip   (两个节点都需要操作,对于不同网段的ip,如果是同网段的可以忽略)

    [root@rac2 ~]# /u01/app/19.3.0/grid/bin/srvctl modify nodeapps -n rac2 -A 192.168.6.23/255.255.255.0

    [root@rac2 ~]# /u01/app/19.3.0/grid/bin/srvctl config vip -n rac2
    VIP exists: network number 1, hosting node rac2
    VIP Name: rac2-vip
    VIP IPv4 Address: 192.168.6.23
    VIP IPv6 Address:
    VIP is enabled.
    VIP is individually enabled on nodes:
    VIP is individually disabled on nodes:
    [root@rac2 ~]#

    14. 更新scan ip

    [root@rac2 ~]# /u01/app/19.3.0/grid/bin/srvctl config scan
    SCAN name: rac-scan, Network: 1
    Subnet IPv4: 192.168.6.0/255.255.255.0/, static
    Subnet IPv6:
    SCAN 1 IPv4 VIP: 192.168.3.184
    SCAN VIP is disabled

    [root@rac2 ~]   /u01/app/19.3.0/grid/bin/srvctl modify scan -n 192.168.6.24

    [root@rac2 ~]# /u01/app/19.3.0/grid/bin/srvctl config scan
    SCAN name: 192.168.6.24, Network: 1
    Subnet IPv4: 192.168.6.0/255.255.255.0/, static
    Subnet IPv6:
    SCAN 1 IPv4 VIP: 192.168.6.24
    SCAN VIP is disabled.

    15. 启动服务

    srvctl enable listener

    srvctl enable vip -i " rac2-vip"

    srvctl enable vip -i " rac1-vip"

    srvctl enable scan_listener

    srvctl enable scan

    srvctl enable database -d prodb

    [root@rac2 ~]# /u01/app/19.3.0/grid/bin/srvctl enable listener

    [root@rac2 ~]# /u01/app/19.3.0/grid/bin/srvctl enable vip -i " rac2-vip"

    [root@rac2 ~]# /u01/app/19.3.0/grid/bin/srvctl enable scan_listener

    [root@rac2 ~]# /u01/app/19.3.0/grid/bin/srvctl enable scan

    [root@rac2 ~]# /u01/app/19.3.0/grid/bin/srvctl start  listener

    [root@rac2 ~]# /u01/app/19.3.0/grid/bin/srvctl start  vip -i " rac2-vip"

    [root@rac2 ~]# /u01/app/19.3.0/grid/bin/srvctl start  scan_listener

    [root@rac2 ~]# /u01/app/19.3.0/grid/bin/srvctl start  scan

    [oracle@rac2 ~]$ /u01/app/19.3.0/grid/bin/srvctl start  database -d prodb

    16. 启动后检查数据库情况

    [grid@rac2 ~]$ /u01/app/19.3.0/grid/bin/srvctl status database -d prodb
    Instance prodb1 is running on node rac2
    [grid@rac2 ~]$

    [grid@rac2 ~]$ crsctl stat res -t
    --------------------------------------------------------------------------------
    Name Target State Server State details
    --------------------------------------------------------------------------------
    Local Resources
    --------------------------------------------------------------------------------
    ora.LISTENER.lsnr
    ONLINE ONLINE rac2 STABLE
    ora.MGMT.GHCHKPT.advm
    OFFLINE OFFLINE rac2 STABLE
    ora.chad
    ONLINE ONLINE rac2 STABLE
    ora.helper
    OFFLINE OFFLINE rac2 IDLE,STABLE
    ora.mgmt.ghchkpt.acfs
    OFFLINE OFFLINE rac2 STABLE
    ora.net1.network
    ONLINE ONLINE rac2 STABLE
    ora.ons
    ONLINE ONLINE rac2 STABLE
    ora.proxy_advm
    OFFLINE OFFLINE rac2 STABLE
    --------------------------------------------------------------------------------
    Cluster Resources
    --------------------------------------------------------------------------------
    ora.ASMNET1LSNR_ASM.lsnr(ora.asmgroup)
    1 ONLINE ONLINE rac2 STABLE
    2 ONLINE OFFLINE STABLE
    3 ONLINE OFFLINE STABLE
    ora.DATA.dg(ora.asmgroup)
    1 ONLINE ONLINE rac2 STABLE
    2 OFFLINE OFFLINE STABLE
    3 OFFLINE OFFLINE STABLE
    ora.LISTENER_SCAN1.lsnr
    1 ONLINE ONLINE rac2 STABLE
    ora.MGMT.dg(ora.asmgroup)
    1 ONLINE ONLINE rac2 STABLE
    2 OFFLINE OFFLINE STABLE
    3 OFFLINE OFFLINE STABLE
    ora.MGMTLSNR
    1 ONLINE ONLINE rac2 169.254.28.55,STABLE
    ora.OCR.dg(ora.asmgroup)
    1 ONLINE ONLINE rac2 STABLE
    2 OFFLINE OFFLINE STABLE
    3 OFFLINE OFFLINE STABLE
    ora.asm(ora.asmgroup)
    1 ONLINE ONLINE rac2 Started,STABLE
    2 OFFLINE OFFLINE STABLE
    3 OFFLINE OFFLINE STABLE
    ora.asmnet1.asmnetwork(ora.asmgroup)
    1 ONLINE OFFLINE STABLE
    2 OFFLINE OFFLINE STABLE
    3 OFFLINE OFFLINE STABLE
    ora.cvu
    1 ONLINE ONLINE rac2 STABLE
    ora.mgmtdb
    1 ONLINE ONLINE rac2 Open,STABLE
    ora.prodb.db
    1 ONLINE ONLINE rac2 Open,HOME=/u01/app/o
    racle/product/19.3.0
    /db_1,STABLE
    ora.qosmserver
    1 ONLINE OFFLINE STABLE
    ora.rac2.vip
    1 ONLINE ONLINE rac2 STABLE
    ora.rhpserver
    1 OFFLINE OFFLINE STABLE
    ora.scan1.vip
    1 ONLINE ONLINE rac2 STABLE
    --------------------------------------------------------------------------------

    [oracle@rac2 ~]$ sqlplus / as sysdba

    SQL*Plus: Release 19.0.0.0.0 - Production on Thu Sep 24 19:40:15 2020
    Version 19.3.0.0.0

    Copyright (c) 1982, 2019, Oracle. All rights reserved.


    Connected to:
    Oracle Database 19c Enterprise Edition Release 19.0.0.0.0 - Production
    Version 19.3.0.0.0

    SQL>


    SQL> select file_name from dba_data_files;

    FILE_NAME
    --------------------------------------------------------------------------------
    +DATA/PRODB/DATAFILE/system.257.1036271357
    +DATA/PRODB/DATAFILE/sysaux.258.1036271451
    +DATA/PRODB/DATAFILE/undotbs1.259.1036271485
    +DATA/PRODB/DATAFILE/users.260.1036271487
    +DATA/PRODB/DATAFILE/test.276.1050595021
    +DATA/PRODB/DATAFILE/test.277.1050595241

    6 rows selected.

    --------------------------至此RAC 数据库更换ip 完成。

  • 相关阅读:
    Eclipse本地创建新的GIT分支,并推送至远程Git分支
    将持久态数据转化为游离态数据代码实现
    Java根据当前日期获得昨天的当前日期代码实现
    @RequestMapping和@GetMapping区别
    炫酷的banner.txt
    小程序colorUI框架初步使用教程
    Java Spring boot element ui activiti前后端分离,流程审批,权限管理框架
    Activiti (一)
    CSS Clip 裁剪
    @SpringBootApplication的使用
  • 原文地址:https://www.cnblogs.com/dqliuq1215/p/13725048.html
Copyright © 2020-2023  润新知