Oracle rac手工注册vip

手头上有一数据库crs资源状态显示如下,可以看到节点1并没有显示vip和监听资源。

[oracle@rac1 admin]$ crs_stat -t
Name           Type           Target    State     Host       
------------------------------------------------------------
ora.orcl.db    application    ONLINE    ONLINE    rac1       
ora....l1.inst application    ONLINE    ONLINE    rac1       
ora....l2.inst application    ONLINE    ONLINE    rac2       
ora....SM1.asm application    ONLINE    ONLINE    rac1       
ora.rac1.gsd   application    ONLINE    ONLINE    rac1       
ora.rac1.ons   application    ONLINE    ONLINE    rac1       
ora....SM2.asm application    ONLINE    ONLINE    rac2       
ora....C2.lsnr application    ONLINE    ONLINE    rac2       
ora.rac2.gsd   application    ONLINE    ONLINE    rac2       
ora.rac2.ons   application    ONLINE    ONLINE    rac2       
ora.rac2.vip   application    ONLINE    ONLINE    rac2 
在eth0的网卡上也没有绑定vip地址:
[root@rac1 ~]# ifconfig -a
eth0      Link encap:Ethernet  HWaddr 00:0C:29:FD:71:8B 
          inet addr:192.168.72.50  Bcast:192.168.72.255  Mask:255.255.255.0
          inet6 addr: fe80::20c:29ff:fefd:718b/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:498 errors:0 dropped:0 overruns:0 frame:0
          TX packets:170 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:45254 (44.1 KiB)  TX bytes:22108 (21.5 KiB)
          Interrupt:185 Base address:0x1480

eth1      Link encap:Ethernet  HWaddr 00:0C:29:FD:71:95 
          inet addr:10.10.10.50  Bcast:10.255.255.255  Mask:255.0.0.0
          inet6 addr: fe80::20c:29ff:fefd:7195/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:68919 errors:0 dropped:0 overruns:0 frame:0
          TX packets:53252 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:51438689 (49.0 MiB)  TX bytes:29116844 (27.7 MiB)
          Interrupt:193 Base address:0x1800
         
在操作系统上也没有监听进程存在:    
[oracle@rac1 admin]$ ps -ef|grep tns
oracle   15282 14968  0 09:21 pts/3    00:00:00 grep tns

查看/etc/hosts可以知道目前vip的ip配置
192.168.72.50   rac1
192.168.72.60   rac2
192.168.72.51   rac1-vip
192.168.72.61   rac2-vip
10.10.10.50     rac1-priv
10.10.10.60     rac2-priv
那怎么样把vip资源和监听资源手动注册到ocr盘里呢?直接在通过命令crs_profile可以知道crs_profile的使用方法
[oracle@rac1 bin]$ ./crs_profile
Usage:  crs_profile -create resource_name -t application
          [-dir directory_path] [-a action_script] [-B binary_pathname]
          [-d description] [-h hosting_members] [-r required_resources]
          [-l optional_resources] [-p placement_policy]
          [-o as=auto_start,ci=check_interval,ft=failure_threshold,
          fi=failure_interval,ra=restart_attempts,fd=failover_delay,
          st=script_timeout,ap=active_placement,
          ut=uptime_threshold,rt=start_timeout,pt=stop_timeout] [-f] [-q]

        crs_profile -create resource_name -I template_file [-dir directory_path] [-f] [-q]

        crs_profile -delete resource_name [-dir directory_path] [-q]

        crs_profile -print [resource_name [...]] [-dir directory_path] [-q]

        crs_profile -template resource_name [-dir directory_path] [-O template_file]

        crs_profile -template -t application [-O template_file]

        crs_profile -update resource_name [-dir directory_path] [option ...] [-o option,...] [-q]

        crs_profile -validate resource_name [-dir directory_path] [-q]

1、通过crs_profile创建vip资源       
[oracle@rac1 bin]$ ./crs_profile -create ora.rac1.vip -t application -d "Test VIP" -a /oracle/product/crs_1/bin/usrvip -o oi=eth0,ov=192.168.72.51,on=255.255.255.0 -h abtripat -p favored
注意参数意思:
oi => physical NIC name (use ifconfig to identify it) of the Data Guard subnet.  In this case it is eth4.
ov=> new VIP address for the NIC on the node
on => new VIP subnet
创建好vip资源后可以在/oracle/product/crs_1/crs/public目录下看到文件ora.rac1.vip.cap,其内容为
[oracle@rac1 public]$ more /oracle/product/crs_1/crs/public/ora.rac1.vip.cap
NAME=ora.rac1.vip
TYPE=application
ACTION_SCRIPT=/oracle/product/crs_1/bin/usrvip
ACTIVE_PLACEMENT=0
AUTO_START=restore
CHECK_INTERVAL=60
DESCRIPTION=Test VIP
FAILOVER_DELAY=0
FAILURE_INTERVAL=0
FAILURE_THRESHOLD=0
HOSTING_MEMBERS=abtripat
OPTIONAL_RESOURCES=
PLACEMENT=favored
REQUIRED_RESOURCES=
RESTART_ATTEMPTS=1
SCRIPT_TIMEOUT=60
START_TIMEOUT=0
STOP_TIMEOUT=0
UPTIME_THRESHOLD=7d
USR_ORA_ALERT_NAME=
USR_ORA_CHECK_TIMEOUT=0
USR_ORA_CONNECT_STR=/ as sysdba
USR_ORA_DEBUG=0
USR_ORA_DISCONNECT=false
USR_ORA_FLAGS=
USR_ORA_IF=eth0
USR_ORA_INST_NOT_SHUTDOWN=
USR_ORA_LANG=
USR_ORA_NETMASK=255.255.255.0
USR_ORA_OPEN_MODE=
USR_ORA_OPI=false
USR_ORA_PFILE=
USR_ORA_PRECONNECT=none
USR_ORA_SRV=
USR_ORA_START_TIMEOUT=0
USR_ORA_STOP_MODE=immediate
USR_ORA_STOP_TIMEOUT=0
USR_ORA_VIP=192.168.72.51
2、创建好内容之后通过crs_register可以注册ora.rac1.vip资源
[oracle@rac1 bin]$ crs_register ora.rac1.vip
注册完毕之后,可以看到ora.rac1.vip资源显示依然为offline状态
[oracle@rac1 bin]$  crs_stat -t
Name           Type           Target    State     Host       
------------------------------------------------------------
ora.orcl.db    application    ONLINE    ONLINE    rac1       
ora....l1.inst application    ONLINE    ONLINE    rac1       
ora....l2.inst application    ONLINE    ONLINE    rac2       
ora....SM1.asm application    ONLINE    ONLINE    rac1       
ora.rac1.gsd   application    ONLINE    ONLINE    rac1       
ora.rac1.ons   application    ONLINE    ONLINE    rac1       
ora.rac1.vip   application    OFFLINE   OFFLINE              
ora....SM2.asm application    ONLINE    ONLINE    rac2       
ora....C2.lsnr application    ONLINE    ONLINE    rac2       
ora.rac2.gsd   application    ONLINE    ONLINE    rac2       
ora.rac2.ons   application    ONLINE    ONLINE    rac2       
ora.rac2.vip   application    ONLINE    ONLINE    rac2       
3、接下来就是对资源ora.rac1.vip进行赋权操作,需要注意的是赋权操作需要在root用户下执行
oracle@rac1 bin]$ su
Password:
[root@rac1 bin]# crs_setperm ora.rac1.vip -o root
[root@rac1 bin]# crs_setperm ora.rac1.vip -u user:oracle:r-x
4、最后通过oracle用户启动ora.rac1.vip资源
[root@rac1 bin]# su - oracle
[oracle@rac1 ~]$ crs_start ora.rac1.vip
Attempting to start `ora.rac1.vip` on member `rac1`
Start of `ora.rac1.vip` on member `rac1` succeeded.
在操作系统上也可以看到vip已经绑定到eth0上。
[root@rac1 ~]# ifconfig -a
eth0      Link encap:Ethernet  HWaddr 00:0C:29:FD:71:8B 
          inet addr:192.168.72.50  Bcast:192.168.72.255  Mask:255.255.255.0
          inet6 addr: fe80::20c:29ff:fefd:718b/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:567 errors:0 dropped:0 overruns:0 frame:0
          TX packets:220 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:52754 (51.5 KiB)  TX bytes:28436 (27.7 KiB)
          Interrupt:185 Base address:0x1480

eth0:1    Link encap:Ethernet  HWaddr 00:0C:29:FD:71:8B 
          inet addr:192.168.72.51  Bcast:192.168.72.255  Mask:255.255.255.0
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          Interrupt:185 Base address:0x1480

你可能感兴趣的:(oracle)