step by step change public-ip and vip
本站文章除注明转载外,均为本站原创: 转载自love wife love life —Roger的Oracle/MySQL/PostgreSQL数据恢复博客
1 2 3 |
如下是更改10g RAC 公网IP以及VIP的一个简单步骤: 1. Stop all Crs resources |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 |
[oracle@hsdb1 ~]$ crs_stop -all Attempting to stop `ora.hsdb1.gsd` on member `hsdb1` Attempting to stop `ora.hsdb1.ons` on member `hsdb1` Attempting to stop `ora.hskj.db` on member `hsdb1` Attempting to stop `ora.hsdb2.gsd` on member `hsdb2` Attempting to stop `ora.hskj.hskj_db.hskj2.srv` on member `hsdb2` Stop of `ora.hsdb2.gsd` on member `hsdb2` succeeded. Attempting to stop `ora.hsdb2.ons` on member `hsdb2` Attempting to stop `ora.hskj.hskj_db.cs` on member `hsdb2` Stop of `ora.hsdb1.gsd` on member `hsdb1` succeeded. Stop of `ora.hskj.hskj_db.hskj2.srv` on member `hsdb2` succeeded. Stop of `ora.hsdb1.ons` on member `hsdb1` succeeded. Stop of `ora.hsdb2.ons` on member `hsdb2` succeeded. Stop of `ora.hskj.hskj_db.cs` on member `hsdb2` succeeded. Stop of `ora.hskj.db` on member `hsdb1` succeeded. `ora.hskj.hskj1.inst` is already OFFLINE. `ora.hskj.hskj2.inst` is already OFFLINE. Attempting to stop `ora.hsdb1.ASM1.asm` on member `hsdb1` Target set to OFFLINE for `ora.hsdb1.LISTENER_HSDB1.lsnr` Target set to OFFLINE for `ora.hsdb2.LISTENER_HSDB2.lsnr` Attempting to stop `ora.hsdb2.ASM2.asm` on member `hsdb2` Attempting to stop `ora.hsdb1.vip` on member `hsdb1` Attempting to stop `ora.hsdb2.vip` on member `hsdb2` Stop of `ora.hsdb1.vip` on member `hsdb1` succeeded. Stop of `ora.hsdb2.vip` on member `hsdb2` succeeded. Stop of `ora.hsdb2.ASM2.asm` on member `hsdb2` succeeded. Stop of `ora.hsdb1.ASM1.asm` on member `hsdb1` succeeded. CRS-0216: Could not stop resource 'ora.hskj.hskj1.inst'. CRS-0216: Could not stop resource 'ora.hskj.hskj2.inst'. |
1 |
当然我这里其实并不是标准的操作步骤,根据官方文档,其实应该如下操作: |
1 2 3 |
srvctl stop asm -n asm1/asm2 srvctl stop instance -d hsdb -i hsdb1/hsdb2 srvctl stop nodeapps -n hsdb1/hsdb2 |
1 2 3 |
2. Modify /etc/hosts 这里修改以后为如下: |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 |
[oracle@hsdb1 admin]$ cat /etc/hosts # Do not remove the following line, or various programs # that require network functionality will fail. 127.0.0.1 localhost.localdomain localhost ::1 localhost6.localdomain6 localhost6 #### for oracle rac 192.168.5.220 hsdb1 192.168.5.222 hsdb1-vip 10.10.10.1 hsdb1-priv 192.168.5.221 hsdb2 192.168.5.223 hsdb2-vip 10.10.10.2 hsdb2-priv (注:RAC cluster中所有节点都需要进行修改。) |
1 2 3 |
3. Change $ORACLE_HOME/network/admin/listener.ora 我这里修改以后为如下: |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 |
[oracle@hsdb1 admin]$ cat listener.ora # listener.ora.hsdb1 Network Configuration File: /oracle/product/10.2/db/network/admin/listener.ora.hsdb1 # Generated by Oracle configuration tools. SID_LIST_LISTENER_HSDB1 = (SID_LIST = (SID_DESC = (SID_NAME = PLSExtProc) (ORACLE_HOME = /oracle/product/10.2/db) (PROGRAM = extproc) ) ) LISTENER_HSDB1 = (DESCRIPTION_LIST = (DESCRIPTION = (ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC)) (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.5.222)(PORT = 1521)(IP = FIRST)) (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.5.220)(PORT = 1521)(IP = FIRST)) ) ) #TRACE_LEVEL_LISTENER = 16 #TRACE_FILE_LISTENER = /oracle/product/10.2/db/network/log/trace.log #TRACE_DIRECTORY_LISTENER = /oracle/product/10.2/db/network/log #TRACE_TIMESTAMP_LISTENER = ON #TRACE_FILELEN_LISTENER = 204800 #TRACE_FILENO_LISTENER = 10 #----ADDED BY TNSLSNR 18-DEC-2011 15:37:21--- SAVE_CONFIG_ON_STOP_LISTENER_HSDB1 = ON INBOUND_CONNECT_TIMEOUT_LISTENER_HSDB1 = 0 #-------------------------------------------- (注:如果这里host你用的name,那么不必进行修改。) |
1 |
4. Delete Public eth0 (在其中一个node操作即可) |
1 2 3 4 5 6 7 8 9 10 |
[root@localhost bin]# ./oifcfg getif eth0 192.168.1.0 global public eth1 10.10.10.0 global cluster_interconnect [root@localhost bin]# ./oifcfg delif -global eth0 [root@localhost bin]# ./oifcfg getif eth1 10.10.10.0 global cluster_interconnect |
1 |
5. Add new public eth0 |
1 2 3 4 5 6 7 8 9 |
[root@localhost bin]# ./oifcfg setif -global eth0/192.168.5.0:public [root@localhost bin]# ./oifcfg getif eth0 192.168.5.0 global public <== 新的网段 eth1 10.10.10.0 global cluster_interconnect (注:因为vip地址必须跟public ip处于同一网段,故公网IP网段更改以后,必须更改vip地址或网段。) |
1 |
6. Change vip |
1 2 3 4 5 6 7 8 9 |
++++++ Node 1 ++++++ [root@hsdb1 crs]# cd bin [root@hsdb1 bin]# ./srvctl modify nodeapps -n hsdb1 -A 192.168.5.222/255.255.255.0/eth0 ++++++ Node 2 ++++++ [root@hsdb2 bin]# ./srvctl modify nodeapps -n hsdb2 -A 192.168.5.223/255.255.255.0/eth0 |
1 |
7. Start cluster all resource |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 |
[oracle@hsdb1 admin]$ crs_start -all Attempting to start `ora.hsdb1.ASM1.asm` on member `hsdb1` Attempting to start `ora.hsdb2.vip` on member `hsdb2` Attempting to start `ora.hsdb1.vip` on member `hsdb1` Attempting to start `ora.hsdb2.ASM2.asm` on member `hsdb2` Start of `ora.hsdb2.vip` on member `hsdb2` succeeded. Attempting to start `ora.hsdb2.LISTENER_HSDB2.lsnr` on member `hsdb2` Start of `ora.hsdb2.LISTENER_HSDB2.lsnr` on member `hsdb2` succeeded. Start of `ora.hsdb1.ASM1.asm` on member `hsdb1` succeeded. Start of `ora.hsdb2.ASM2.asm` on member `hsdb2` succeeded. Attempting to start `ora.hskj.hskj1.inst` on member `hsdb1` Attempting to start `ora.hskj.hskj2.inst` on member `hsdb2` Start of `ora.hsdb1.vip` on member `hsdb1` failed. Attempting to start `ora.hsdb1.vip` on member `hsdb2` Start of `ora.hsdb1.vip` on member `hsdb2` succeeded. hsdb1 : CRS-1018: Resource ora.hsdb1.vip (application) is already running on hsdb2 hsdb2 : CRS-1019: Resource ora.hsdb1.LISTENER_HSDB1.lsnr (application) cannot run on hsdb2 Start of `ora.hskj.hskj2.inst` on member `hsdb2` succeeded. Start of `ora.hskj.hskj1.inst` on member `hsdb1` succeeded. CRS-1002: Resource 'ora.hsdb1.ons' is already running on member 'hsdb1' CRS-1002: Resource 'ora.hsdb2.ons' is already running on member 'hsdb2' CRS-1002: Resource 'ora.hskj.db' is already running on member 'hsdb1' Attempting to start `ora.hsdb1.gsd` on member `hsdb1` Attempting to start `ora.hskj.hskj_db.cs` on member `hsdb2` Attempting to start `ora.hsdb2.gsd` on member `hsdb2` Attempting to start `ora.hskj.hskj_db.hskj1.srv` on member `hsdb1` Attempting to start `ora.hskj.hskj_db.hskj2.srv` on member `hsdb2` Start of `ora.hskj.hskj_db.cs` on member `hsdb2` succeeded. Start of `ora.hskj.hskj_db.hskj2.srv` on member `hsdb2` succeeded. Start of `ora.hsdb2.gsd` on member `hsdb2` succeeded. Start of `ora.hsdb1.gsd` on member `hsdb1` succeeded. Start of `ora.hskj.hskj_db.hskj1.srv` on member `hsdb1` succeeded. CRS-0223: Resource 'ora.hsdb1.LISTENER_HSDB1.lsnr' has placement error. CRS-0223: Resource 'ora.hsdb1.ons' has placement error. CRS-0223: Resource 'ora.hsdb2.ons' has placement error. CRS-0223: Resource 'ora.hskj.db' has placement error. [oracle@hsdb1 admin]$ crs_stat -t Name Type Target State Host ------------------------------------------------------------ ora....SM1.asm application ONLINE ONLINE hsdb1 ora....B1.lsnr application OFFLINE OFFLINE ora.hsdb1.gsd application ONLINE ONLINE hsdb1 ora.hsdb1.ons application ONLINE ONLINE hsdb1 ora.hsdb1.vip application ONLINE ONLINE hsdb1 ora....SM2.asm application ONLINE ONLINE hsdb2 ora....B2.lsnr application ONLINE ONLINE hsdb2 ora.hsdb2.gsd application ONLINE ONLINE hsdb2 ora.hsdb2.ons application ONLINE ONLINE hsdb2 ora.hsdb2.vip application ONLINE ONLINE hsdb2 ora.hskj.db application ONLINE ONLINE hsdb1 ora....j1.inst application ONLINE ONLINE hsdb1 ora....j2.inst application ONLINE ONLINE hsdb2 ora....j_db.cs application ONLINE ONLINE hsdb2 ora....kj1.srv application ONLINE ONLINE hsdb1 ora....kj2.srv application ONLINE ONLINE hsdb2 [oracle@hsdb1 admin]$ crs_stat -p | grep lsnr NAME=ora.hsdb1.LISTENER_HSDB1.lsnr NAME=ora.hsdb2.LISTENER_HSDB2.lsnr [oracle@hsdb1 admin]$ crs_start ora.hsdb1.LISTENER_HSDB1.lsnr Attempting to start `ora.hsdb1.LISTENER_HSDB1.lsnr` on member `hsdb1` Start of `ora.hsdb1.LISTENER_HSDB1.lsnr` on member `hsdb1` succeeded. [oracle@hsdb1 admin]$ crs_stat -t Name Type Target State Host ------------------------------------------------------------ ora....SM1.asm application ONLINE ONLINE hsdb1 ora....B1.lsnr application ONLINE ONLINE hsdb1 ora.hsdb1.gsd application ONLINE ONLINE hsdb1 ora.hsdb1.ons application ONLINE ONLINE hsdb1 ora.hsdb1.vip application ONLINE ONLINE hsdb1 ora....SM2.asm application ONLINE ONLINE hsdb2 ora....B2.lsnr application ONLINE ONLINE hsdb2 ora.hsdb2.gsd application ONLINE ONLINE hsdb2 ora.hsdb2.ons application ONLINE ONLINE hsdb2 ora.hsdb2.vip application ONLINE ONLINE hsdb2 ora.hskj.db application ONLINE ONLINE hsdb1 ora....j1.inst application ONLINE ONLINE hsdb1 ora....j2.inst application ONLINE ONLINE hsdb2 ora....j_db.cs application ONLINE ONLINE hsdb2 ora....kj1.srv application ONLINE ONLINE hsdb1 ora....kj2.srv application ONLINE ONLINE hsdb2 |
1 |
8. Change local_listener |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 |
++++++ Node 1 ++++++ SQL> show parameter listener NAME TYPE VALUE ------------------------------------ ---------------------- ------------------------------ local_listener string (ADDRESS = (PROTOCOL = TCP)(HO ST = 192.168.1.222)(PORT = 152 1)) remote_listener string LISTENERS_HSKJ SQL> alter system 2 set local_listener = '(ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.5.222)(PORT = 1521))' 3 scope = both 4 sid = 'hskj1'; System altered. SQL> show parameter listener NAME TYPE VALUE ------------------------------------ ---------------------- ------------------------------ local_listener string (ADDRESS = (PROTOCOL = TCP)(HO ST = 192.168.5.222)(PORT = 152 1)) remote_listener string LISTENERS_HSKJ ++++++ Node 2 ++++++ SQL> alter system 2 set local_listener = '(ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.5.223)(PORT = 1521))' 3 scope = both 4 sid = 'hskj2'; System altered. SQL> show parameter instance_name NAME TYPE VALUE ------------------------------------ ---------------------- ------------------------------ instance_name string hskj2 |
1 2 |
如上是一个简约步骤,没有任何难度,网上有人说最后还需重新配置ssh等效性, 其实是不需要的,如下检测: |
1 2 3 4 5 6 7 8 9 |
[oracle@hsdb1 ~]$ ssh hsdb2 Warning: Permanently added the RSA host key for IP address '192.168.5.221' to the list of known hosts. Last login: Sat Feb 25 11:44:33 2012 from mail.atlantic.ro [oracle@hsdb2 ~]$ ssh hsdb1 Warning: Permanently added the RSA host key for IP address '192.168.5.220' to the list of known hosts. Last login: Sun Mar 4 17:12:51 2012 from 86.126.70.106 |
Leave a Reply
You must be logged in to post a comment.