• oracle-RAC修改服务器ip


    主要实施步骤如下:

    环境说明:服务器操作系统centos7.3、oracle RAC 11.2.0.4
    说明:服务器实际ip变动,虚拟ip不变
    #pub
    80.150.20.101     msrkzyk1  
    80.150.20.102     msrkzyk2  
    #pri 
    172.168.1.1        msrkzyk1p
    172.168.1.2        msrkzyk2p
    #vip
    80.150.20.103     msrkzyk1v 
    80.150.20.104     msrkzyk2v
    
    #scan 
    80.150.20.105      msrkscan
    
    -----
    --改后
    #pub
    80.150.22.101     msrkzyk1  
    80.150.22.102     msrkzyk2  
    #pri 
    172.168.1.1        msrkzyk1p
    172.168.1.2        msrkzyk2p
    #vip
    80.150.22.103     msrkzyk1v 
    80.150.22.104     msrkzyk2v
    
    #scan 
    80.150.22.105      msrkscan
    
    1、[root@node-1 ~]# crs_stop -all
    [root@node-1 ~]# crsctl stop crs -f #强制停止
    2、修改服务器的物理ip
    3、然后再vi修改/etc/hosts文件
    4、重新配置免密ssh
    su - grid
    ssh-keygen
    ssh-copy-id grid@80.150.22.101
    ssh-copy-id grid@80.150.22.102
    ssh-copy-id grid@172.168.1.1
    ssh-copy-id grid@172.168.1.2
    
    ssh grid@172.168.1.1 date
    ssh grid@172.168.1.2 date
    ssh grid@80.150.22.101 date
    ssh grid@80.150.22.102 date
    
    ssh grid@msrkzyk1 date
    ssh grid@msrkzyk2 date
    
    ssh grid@msrkzyk1p date
    ssh grid@msrkzyk2p date
    
    su - oracle
    ssh-keygen
    ssh-copy-id oracle@80.150.22.101
    ssh-copy-id oracle@80.150.22.102
    ssh-copy-id oracle@172.168.1.1
    ssh-copy-id oracle@172.168.1.2
    
    ssh oracle@172.168.1.1 date
    ssh oracle@172.168.1.2 date
    ssh oracle@80.150.22.101 date
    ssh oracle@80.150.22.102 date
    
    ssh oracle@msrkzyk1 date
    ssh oracle@msrkzyk2 date
    
    ssh oracle@msrkzyk1p date
    ssh oracle@msrkzyk2p date
    
    5、启动crs
    [root@msrkzyk2 ~]# /u01/grid/11.2/bin/crsctl start crs
    
    注意:这里如果是按照我上面关闭crs的操作,正常数据库和监听是没有启动的,对应target和state都应该是offline:
    ora.LISTENER.lsnr
                   OFFLINE OFFLINE      msrkzyk1                            
                   OFFLINE OFFLINE      msrkzyk2       
    ora.msrkzyk.db
          1        OFFLINE OFFLINE                    Instance Shutdown
          2        OFFLINE OFFLINE                    Instance Shutdown
    
    6、修改Public IP,VIP,SCAN VIP
    6.1 修改Public IP
    [root@msrkzyk1 ~]# find / -name oifcfg #查找命令
    /u01/grid/11.2/bin/oifcfg getif  
    
    [root@msrkzyk1 ~]# /u01/grid/11.2/bin/oifcfg getif #查看ip
    eno1  80.150.20.0  global  public
    eno2  172.168.1.0  global  cluster_interconnect
    
    #节点一设置ip,删除ip 设置ip
    [root@msrkzyk1 ~]# /u01/grid/11.2/bin/oifcfg delif -global eno1  #删除原public ip
    [root@msrkzyk1 ~]# /u01/grid/11.2/bin/oifcfg setif -global eno1/80.150.22.0:public  #设置新public ip
    #两个节点查看ip
    [root@msrkzyk1 ~]# /u01/grid/11.2/bin/oifcfg getif
    eno2  172.168.1.0  global  cluster_interconnect
    eno1  80.150.22.0  global  public
    [root@msrkzyk2 ~]# /u01/grid/11.2/bin/oifcfg getif
    eno2  172.168.1.0  global  cluster_interconnect
    eno1  80.150.22.0  global  public
    
    6.2 修改VIP
    需要停止数据库、监听和vip,目前数据库和监听、vip都是停止的查看命令grid用户
    srvctl stop vip -n msrkzyk1 #停止命令
    
    #单独查看
    [grid@msrkzyk1 ~]$ srvctl status vip -n msrkzyk1
    VIP msrkzyk1v is enabled
    VIP msrkzyk1v is not running
    
    [grid@msrkzyk1 ~]$ srvctl status vip -n msrkzyk2
    VIP msrkzyk2v is enabled
    VIP msrkzyk2v is not running
    [grid@msrkzyk1 ~]$ srvctl status database -d msrkzyk
    Instance msrkzyk1 is not running on node msrkzyk1
    Instance msrkzyk2 is not running on node msrkzyk2
    
    [grid@msrkzyk1 ~]$ srvctl status LISTENER -n msrkzyk1
    Listener LISTENER is enabled on node(s): msrkzyk1
    Listener LISTENER is not running on node(s): msrkzyk1
    [grid@msrkzyk1 ~]$ srvctl status LISTENER -n msrkzyk2
    Listener LISTENER is enabled on node(s): msrkzyk2
    Listener LISTENER is not running on node(s): msrkzyk2
    
    #或者
    [grid@msrkzyk1 ~]$ crsctl stat res -t
    --------------------------------------------------------------------------------
    NAME           TARGET  STATE        SERVER                   STATE_DETAILS       
    --------------------------------------------------------------------------------
    Local Resources
    --------------------------------------------------------------------------------
    ora.CRS.dg
                   ONLINE  ONLINE       msrkzyk1                                     
                   ONLINE  ONLINE       msrkzyk2                                     
    ora.DATA.dg
                   ONLINE  ONLINE       msrkzyk1                                     
                   ONLINE  ONLINE       msrkzyk2                                     
    ora.FRA.dg
                   ONLINE  ONLINE       msrkzyk1                                     
                   ONLINE  ONLINE       msrkzyk2                                     
    ora.LISTENER.lsnr
                   OFFLINE OFFLINE      msrkzyk1                                     
                   OFFLINE OFFLINE      msrkzyk2                                     
    ora.PIC.dg
                   ONLINE  ONLINE       msrkzyk1                                     
                   ONLINE  ONLINE       msrkzyk2                                     
    ora.asm
                   ONLINE  ONLINE       msrkzyk1                 Started             
                   ONLINE  ONLINE       msrkzyk2                 Started             
    ora.gsd
                   OFFLINE OFFLINE      msrkzyk1                                     
                   OFFLINE OFFLINE      msrkzyk2                                     
    ora.net1.network
                   ONLINE  OFFLINE      msrkzyk1                                     
                   ONLINE  OFFLINE      msrkzyk2                                     
    ora.ons
                   ONLINE  OFFLINE      msrkzyk1                                     
                   ONLINE  OFFLINE      msrkzyk2                                     
    --------------------------------------------------------------------------------
    Cluster Resources
    --------------------------------------------------------------------------------
    ora.LISTENER_SCAN1.lsnr
          1        OFFLINE OFFLINE                                                   
    ora.cvu
          1        OFFLINE OFFLINE                                                   
    ora.msrkzyk.db
          1        OFFLINE OFFLINE                               Instance Shutdown   
          2        OFFLINE OFFLINE                               Instance Shutdown   
    ora.msrkzyk1.vip
          1        OFFLINE OFFLINE                                                   
    ora.msrkzyk2.vip
          1        OFFLINE OFFLINE                                                   
    ora.oc4j
          1        OFFLINE OFFLINE                                                   
    ora.scan1.vip
          1        OFFLINE OFFLINE 
    
    查看当前vip设置 grid用户
    [grid@msrkzyk1 ~]$ olsnodes -s
    msrkzyk1        Active
    msrkzyk2        Active
    [grid@msrkzyk1 ~]$ srvctl config vip -n msrkzyk1
    VIP exists: /msrkzyk1v/80.150.22.103/80.150.20.0/255.255.255.0/eno1, hosting node msrkzyk1
    [grid@msrkzyk1 ~]$ srvctl config vip -n msrkzyk2
    VIP exists: /msrkzyk2v/80.150.22.104/80.150.20.0/255.255.255.0/eno1, hosting node msrkzyk2
    
    修改vip设置 root 用户
    [root@msrkzyk1 ~]# find / -name srvctl
    /u01/grid/11.2/bin/srvctl
    
    [root@msrkzyk1 ~]# /u01/grid/11.2/bin/srvctl modify nodeapps -n msrkzyk1 -A 80.150.22.103/255.255.255.0/eno1
    [root@msrkzyk1 ~]# /u01/grid/11.2/bin/srvctl modify nodeapps -n msrkzyk2 -A 80.150.22.104/255.255.255.0/eno1
    
    再次验证vip设置
    [root@msrkzyk1 ~]# /u01/grid/11.2/bin/srvctl config vip -n msrkzyk1
    VIP exists: /msrkzyk1v/80.150.22.103/80.150.22.0/255.255.255.0/eno1, hosting node msrkzyk1
    [root@msrkzyk1 ~]# /u01/grid/11.2/bin/srvctl config vip -n msrkzyk2
    VIP exists: /msrkzyk2v/80.150.22.104/80.150.22.0/255.255.255.0/eno1, hosting node msrkzyk2
    
    启动vip、grid用户
    [root@msrkzyk1 ~]# su - grid
    Last login: Tue Sep  7 14:52:57 CST 2021 on pts/1
    [grid@msrkzyk1 ~]$ srvctl start vip -n msrkzyk1
    [grid@msrkzyk1 ~]$ srvctl start vip -n msrkzyk2
    [grid@msrkzyk1 ~]$ srvctl status vip -n msrkzyk1
    VIP msrkzyk1v is enabled
    VIP msrkzyk1v is running on node: msrkzyk1
    [grid@msrkzyk1 ~]$ srvctl status vip -n msrkzyk2
    VIP msrkzyk2v is enabled
    VIP msrkzyk2v is running on node: msrkzyk2
    
    启动监听
    [grid@msrkzyk1 ~]$ srvctl start listener
    [grid@msrkzyk1 ~]$ srvctl status LISTENER 
    Listener LISTENER is enabled
    Listener LISTENER is running on node(s): msrkzyk2,msrkzyk1
    
    启动数据库
    [grid@msrkzyk1 ~]$ srvctl start database -d msrkzyk
    [grid@msrkzyk1 ~]$ srvctl status database -d msrkzyk
    Instance msrkzyk1 is running on node msrkzyk1
    Instance msrkzyk2 is running on node msrkzyk2
    
    4、检查local_listener信息,不正确就需要修改(我这儿对的不用修改)
    [oracle@msrkzyk1 ~]$ sqlplus / as sysdba
    
    SQL> show parameter local_listener
    
    NAME           TYPE                 VALUE
    --------      ---------     ----------------
    local_listener  string   (ADDRESS=(PROTOCOL=TCP)(HOST=80.150.22.103)(PORT=1521))
    #修改的命令
    alter system set local_listenner='(ADDRESS=(PROTOCOL=TCP)(HOST=80.150.22.103)(PORT=1521))' sid='msrkzyk1';
    alter system set local_listenner='(ADDRESS=(PROTOCOL=TCP)(HOST=80.150.22.104)(PORT=1521))' sid='msrkzyk2';
    
    5、修改scan vip
    查看scan vip的配置 grid用户
    [root@msrkzyk1 ~]# su - grid
    [grid@msrkzyk1 ~]$ srvctl config scan
    SCAN name: msrkscan, Network: 1/80.150.22.0/255.255.255.0/eno1
    SCAN VIP name: scan1, IP: /msrkscan/80.150.20.105
    
    停止scan_listener和scan资源
    [grid@msrkzyk1 ~]$ srvctl stop scan_listener
    [grid@msrkzyk1 ~]$ srvctl stop scan
    
    --确认已经停止
    [grid@msrkzyk1 ~]$ srvctl status scan_listener
    SCAN Listener LISTENER_SCAN1 is enabled
    SCAN listener LISTENER_SCAN1 is not running
    [grid@msrkzyk1 ~]$ srvctl status scan
    SCAN VIP scan1 is enabled
    SCAN VIP scan1 is not running
    
    使用root用户修改scan vip
    [root@msrkzyk1 ~]# /u01/grid/11.2/bin/srvctl modify scan -n msrkscan
    
    注意:root用户执行修改,且确认/etc/hosts映射关系已经修改为新的scan VIP。

    修改并启动资源库 grid用户

    [grid@msrkzyk1 ~]$ srvctl modify scan_listener -u
    [grid@msrkzyk1 ~]$ srvctl start scan_listener
    
    注意:执行后确认scan_listener和scan都已经启动
    [grid@msrkzyk1 ~]$ srvctl status scan_listener
    SCAN Listener LISTENER_SCAN1 is enabled
    SCAN listener LISTENER_SCAN1 is running on node msrkzyk1
    [grid@msrkzyk1 ~]$ srvctl status scan
    SCAN VIP scan1 is enabled
    SCAN VIP scan1 is running on node msrkzyk1
    
    确认修改成功
    [grid@msrkzyk1 ~]$ srvctl config scan
    SCAN name: msrkscan, Network: 1/80.150.22.0/255.255.255.0/eno1
    SCAN VIP name: scan1, IP: /msrkscan/80.150.22.105
    [grid@msrkzyk1 ~]$ srvctl config scan_listener
    SCAN Listener LISTENER_SCAN1 exists. Port: TCP:1521
    
    6、验证整个集群
    [grid@msrkzyk1 ~]$ crsctl stat res -t
    --------------------------------------------------------------------------------
    NAME           TARGET  STATE        SERVER                   STATE_DETAILS       
    --------------------------------------------------------------------------------
    Local Resources
    --------------------------------------------------------------------------------
    ora.CRS.dg
                   ONLINE  ONLINE       msrkzyk1                                     
                   ONLINE  ONLINE       msrkzyk2                                     
    ora.DATA.dg
                   ONLINE  ONLINE       msrkzyk1                                     
                   ONLINE  ONLINE       msrkzyk2                                     
    ora.FRA.dg
                   ONLINE  ONLINE       msrkzyk1                                     
                   ONLINE  ONLINE       msrkzyk2                                     
    ora.LISTENER.lsnr
                   ONLINE  ONLINE       msrkzyk1                                     
                   ONLINE  ONLINE       msrkzyk2                                     
    ora.PIC.dg
                   ONLINE  ONLINE       msrkzyk1                                     
                   ONLINE  ONLINE       msrkzyk2                                     
    ora.asm
                   ONLINE  ONLINE       msrkzyk1                 Started             
                   ONLINE  ONLINE       msrkzyk2                 Started             
    ora.gsd
                   OFFLINE OFFLINE      msrkzyk1                                     
                   OFFLINE OFFLINE      msrkzyk2                                     
    ora.net1.network
                   ONLINE  ONLINE       msrkzyk1                                     
                   ONLINE  ONLINE       msrkzyk2                                     
    ora.ons
                   ONLINE  ONLINE       msrkzyk1                                     
                   ONLINE  ONLINE       msrkzyk2                                     
    --------------------------------------------------------------------------------
    Cluster Resources
    --------------------------------------------------------------------------------
    ora.LISTENER_SCAN1.lsnr
          1        ONLINE  ONLINE       msrkzyk1                                     
    ora.cvu
          1        OFFLINE OFFLINE                                                   
    ora.msrkzyk.db
          1        ONLINE  ONLINE       msrkzyk1                 Open                
          2        ONLINE  ONLINE       msrkzyk2                 Open                
    ora.msrkzyk1.vip
          1        ONLINE  ONLINE       msrkzyk1                                     
    ora.msrkzyk2.vip
          1        ONLINE  ONLINE       msrkzyk2                                     
    ora.oc4j
          1        OFFLINE OFFLINE                                                   
    ora.scan1.vip
          1        ONLINE  ONLINE       msrkzyk1 
    

      

      

      

      

    做一个决定,并不难,难的是付诸行动,并且坚持到底。
  • 相关阅读:
    2014-12-28 iframe,style,body style
    2014-12-25 网页基础,html。
    2014-12-19 特殊集合:stack、queue、Hashtable
    2014-12-18 集合
    2014-12-16 多维数组
    2014-12-15 数组
    2014-12-14 跳转语句,while循环,各种类的用法
    combobox DataGridView
    面向对象(重载、封装、继承、抽象)
    winform
  • 原文地址:https://www.cnblogs.com/wukc/p/15239130.html
Copyright © 2020-2023  润新知