關於RAC CRS 自動啟動,raccrs啟動
關於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
怎啟動 rac
crsctl啟動crs進程,然後用crs_stat -v -t查看後台進程狀態,最後用srvct去啟動各個服務
RAC重啟,但是資料庫資源沒有隨CRS啟動
手工
srvctl start database -d xxxx
有報錯嘛?
如果無法正常啟動,先看一下叢集狀態。
crsctl stat res -t
視情況可以看一下oracle alert警示日誌。