首页 > 代码库 > 关于RAC CRS 自动启动

关于RAC CRS 自动启动

关于CRS自动重启实验


一.检查ASM
[root@rac1 ~]# /etc/init.d/oracleasm status
Checking if ASM is loaded: yes
Checking if /dev/oracleasm is mounted: yes
[root@rac1 ~]# /etc/init.d/oracleasm listdisks
ASM01
ASM02
ASM03


二.RAC自动启动的时候后台CRS进程
[root@rac1 ~]# ls -l /etc/init.d/init.*
-r-xr-xr-x 1 root root  1951 Aug 20 11:57 /etc/init.d/init.crs
-r-xr-xr-x 1 root root  4722 Aug 20 11:57 /etc/init.d/init.crsd
-r-xr-xr-x 1 root root 35402 Aug 20 11:57 /etc/init.d/init.cssd
-r-xr-xr-x 1 root root  3198 Aug 20 11:57 /etc/init.d/init.evmd




三.我查看一下CRS状态
节点1
[oracle@rac1 ~]# crs_stat -t
Name           Type           Target    State     Host        
------------------------------------------------------------
ora....B1.inst application    ONLINE    ONLINE    rac1        
ora....B2.inst application    ONLINE    ONLINE    rac2        
ora.RACDB.db   application    ONLINE    ONLINE    rac1        
ora....SM1.asm application    ONLINE    ONLINE    rac1        
ora....C1.lsnr application    ONLINE    ONLINE    rac1        
ora.rac1.gsd   application    ONLINE    ONLINE    rac1        
ora.rac1.ons   application    ONLINE    ONLINE    rac1        
ora.rac1.vip   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  

节点2
[oracle@rac2 ~]# crs_stat -t
Name           Type           Target    State     Host        
------------------------------------------------------------
ora....B1.inst application    ONLINE    ONLINE    rac1        
ora....B2.inst application    ONLINE    ONLINE    rac2        
ora.RACDB.db   application    ONLINE    ONLINE    rac1        
ora....SM1.asm application    ONLINE    ONLINE    rac1        
ora....C1.lsnr application    ONLINE    ONLINE    rac1        
ora.rac1.gsd   application    ONLINE    ONLINE    rac1        
ora.rac1.ons   application    ONLINE    ONLINE    rac1        
ora.rac1.vip   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   


方法:也可以用crs_stat 查看全部进程信息
[root@rac1 bin]# ./crs_stat
NAME=ora.RACDB.RACDB1.inst
TYPE=application
TARGET=ONLINE
STATE=ONLINE on rac1


NAME=ora.RACDB.RACDB2.inst
TYPE=application
TARGET=ONLINE
STATE=ONLINE on rac2


NAME=ora.RACDB.db
TYPE=application
TARGET=ONLINE
STATE=ONLINE on rac1


NAME=ora.rac1.ASM1.asm
TYPE=application
TARGET=ONLINE
STATE=ONLINE on rac1




NAME=ora.rac2.gsd
TYPE=application
TARGET=ONLINE
STATE=OFFLINE on rac2


NAME=ora.rac2.ons
TYPE=application
TARGET=ONLINE
STATE=UNKNOWN on rac2
。。。


1.对于OFFLINE的进程可以手动启动
[root@rac1 bin]# ./crs_start ora.rac2.gsd
Attempting to start `ora.rac2.gsd` on member `rac2`
Start of `ora.rac2.gsd` on member `rac2` succeeded.
2.对于UNKNOWN的进程  可以先./crs_stop .... 后再 ./crs_start 

3.如果crs_stop不能结束,crs_start不能启动的进程,解决方式:
3.1 使用crs_stop -f 参数把crs中状态是UNKNOWN的服务关掉,然后再用crs_start -f(加一个-f的参数)启动所有的服务就可以。分别在两个节点上执行。
3.2 转换到root用户下用/etc/init.d/init.crs stop先禁用crs,然后在用/etc/init.d/init.crs start去启用crs,启用crs后会自启动crs的一系列服务,注意:此种方法最好在两节点都执行。 (但我自己做实验只在节点1上也可以)
[root@rac1 ~]# /etc/init.d/init.crs stop
Shutting down Oracle Cluster Ready Services (CRS):
Stopping resources.
Successfully stopped CRS resources 
Stopping CSSD.
Shutting down CSS daemon.
Shutdown request successfully issued.
Shutdown has begun. The daemons should exit soon.
[root@rac1 bin]# ./crs_stat -t
CRS-0184: Cannot communicate with the CRS daemon.
[root@rac1 bin]# ./crs_stat -t
Name           Type           Target    State     Host        
------------------------------------------------------------
ora....B1.inst application    ONLINE    ONLINE    rac1        
ora....B2.inst application    ONLINE    ONLINE    rac2        
ora.RACDB.db   application    ONLINE    ONLINE    rac2        
ora....SM1.asm application    ONLINE    ONLINE    rac1        
ora....C1.lsnr application    ONLINE    ONLINE    rac1        
ora.rac1.gsd   application    ONLINE    ONLINE    rac1        
ora.rac1.ons   application    ONLINE    ONLINE    rac1        
ora.rac1.vip   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    


2.查看当前关于crs的进程
[root@rac1 ~]$ ps -ef |grep crs
root     23206     1  0 03:05 ?        00:00:00 /u01/app/oracle/product/10.2.0/db_1/bin/crsd.bin restart
oracle   30815 29217  0 03:10 pts/4    00:00:00 grep crs


3.kill 掉crs进程
[root@rac1 ~]# kill -9 23206
[root@rac1 ~]# crs_stat -t
CRS-0184: Cannot communicate with the CRS daemon.


4.此时crs进程秒级的进入boot状态,还有服务init.crsd 运行
[root@rac1 ~]# ps -ef|grep crs
root       430     1  0 03:12 ?        00:00:00 /bin/sh /etc/init.d/init.crsd run
root       507   474  0 03:12 ?        00:00:00 /bin/su -l oracle -c /u01/app/oracle/product/10.2.0/db_1/bin/crsctl check boot > /tmp/crsctl.474
oracle     508   507  0 03:12 ?        00:00:00 -bash -c /u01/app/oracle/product/10.2.0/db_1/bin/crsctl check boot > /tmp/crsctl.474
oracle     539   508  0 03:12 ?        00:00:00 /u01/app/oracle/product/10.2.0/db_1/bin/crsctl.bin check boot
root       570  2971  0 03:12 pts/4    00:00:00 grep crs


节点2 
[oracle@rac2 ~]$ ps -ef|grep crs
root      4348     1  0 13:56 ?        00:00:01 /u01/app/oracle/product/10.2.0/db_1/bin/crsd.bin reboot
oracle   25981 16487  0 15:16 pts/3    00:00:00 grep crs
[oracle@rac2 ~]$ crs_stat -t
Name           Type           Target    State     Host        
------------------------------------------------------------
ora....B1.inst application    ONLINE    ONLINE    rac1        
ora....B2.inst application    ONLINE    ONLINE    rac2        
ora.RACDB.db   application    ONLINE    ONLINE    rac1        
ora....SM1.asm application    ONLINE    ONLINE    rac1        
ora....C1.lsnr application    ONLINE    ONLINE    rac1        
ora.rac1.gsd   application    ONLINE    ONLINE    rac1        
ora.rac1.ons   application    ONLINE    ONLINE    rac1        
ora.rac1.vip   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      


5.再次查看进程 只有init.crsd进程运行
[root@rac1 ~]# ps -ef|grep crs
root       430     1  0 03:12 ?        00:00:00 /bin/sh /etc/init.d/init.crsd run
root       730  2971  0 03:12 pts/4    00:00:00 grep crs
[root@rac1 ~]# ps -ef|grep crs
root       430     1  0 03:12 ?        00:00:00 /bin/sh /etc/init.d/init.crsd run
root       833  2971  0 03:12 pts/4    00:00:00 grep crs


6.一分钟左右查看
[root@rac1 ~]# ps -ef|grep crs
root       430     1  0 03:12 ?        00:00:00 /u01/app/oracle/product/10.2.0/db_1/bin/crsd.bin restart
root      4813  2971  0 03:14 pts/4    00:00:00 grep crs


此时的crs 服务已经是启动了
[root@rac1 ~]# crs_stat -t
Name           Type           Target    State     Host        
------------------------------------------------------------
ora....B1.inst application    ONLINE    ONLINE    rac1        
ora....B2.inst application    ONLINE    ONLINE    rac2        
ora.RACDB.db   application    ONLINE    ONLINE    rac1        
ora....SM1.asm application    ONLINE    ONLINE    rac1        
ora....C1.lsnr application    ONLINE    ONLINE    rac1        
ora.rac1.gsd   application    ONLINE    ONLINE    rac1        
ora.rac1.ons   application    ONLINE    ONLINE    rac1        
ora.rac1.vip   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