这篇文档主要给大家介绍一下ORACLE RAC的crs的一些日常维护的常见命令:
1. 手工启动crs # /etc/init.d/init.crs start
手工关闭crs # /etc/init.d/init.crs stop
在不同的操作系统,该文件的路径可能不一样(下同,不同的系统,请转换为不同的路径):
sun: /etc/init.d/init.crs
Linux: /etc/init.d/init.crs
HP-UX: /sbin/init.d/init.crs
HP Tru64: /sbin/init.d/init.crs
IBM AIX: /etc/init.crs
默认情况下,系统启动时,crs会自动起来,如果没有起来,则可以使用以上命令启动
2. 系统启动时,
自动启动crs # /etc/init.d/init.crs enable
不自动启动crs,采取手工启动的方式 # /etc/init.d/init.crs disable
默认情况下,当系统启动时crs是自动起来的,这个也是推荐的一总方式,
但是有时crs没有自动起来,而我们又想让crs自动启动,则可以使用init.crs start
有时CRS不正常时,系统可能会自动重启,在问题解决前,系统又重启了,这个时候我们可以把crs的自动启动关闭,在解决问题后再让crs自动启动
3. 查看crs是否启动
$ crsctl check crs
CSS appears healthy
CRS appears healthy
EVM appears healthy
这三个资源资源的状态应该都为healthy
[oracle@zyy1 install]$ ps -ef|grep d.bin
root 10203 1 0 Dec07 ? 00:00:22 /u01/app/crs/bin/crsd.bin reboot
oracle 16927 10199 0 Dec07 ? 00:00:01 /u01/app/crs/bin/evmd.bin
oracle 17061 17031 0 Dec07 ? 00:00:04 /u01/app/crs/bin/ocssd.bin
oracle 31559 26820 0 11:43 pts/1 00:00:00 grep d.bin
4. 查看crs的资源是否起来
$ crs_stat -t
Name Type Target State Host
------------------------------------------------------------
ora....SM1.asm application ONLINE ONLINE zyy1
ora....37.lsnr application ONLINE ONLINE zyy1
ora.zyy1.gsd application ONLINE ONLINE zyy1
ora.zyy1.ons application ONLINE ONLINE zyy1
ora.zyy1.vip application ONLINE ONLINE zyy1
ora....SM2.asm application ONLINE ONLINE zyy2
ora....2.lsnr application ONLINE ONLINE zyy2
ora.zyy2.gsd application ONLINE ONLINE zyy2
ora.zyy2.ons application ONLINE ONLINE zyy2
ora.zyy2.vip application ONLINE ONLINE zyy2
ora.portal.db application ONLINE ONLINE zyy2
ora....zyydb.cs application ONLINE ONLINE zyy2
ora....db1.srv application ONLINE ONLINE zyy1
ora....db2.srv application ONLINE ONLINE zyy2
ora....b1.inst application ONLINE ONLINE zyy1
ora....b2.inst application ONLINE ONLINE zyy2
所有资源的状态均需要为ONLINE
$ crs_stat
[oracle@zyy1 ~]$ crs_stat
NAME=ora.zyy1.ASM1.asm
TYPE=application
TARGET=ONLINE
STATE=ONLINE on zyy1
NAME=ora.zyy1.LISTENER_zyy1.lsnr
TYPE=application
TARGET=ONLINE
STATE=ONLINE on zyy1
NAME=ora.zyy1.gsd
TYPE=application
TARGET=ONLINE
STATE=ONLINE on zyy1
NAME=ora.zyy1.ons
TYPE=application
TARGET=ONLINE
STATE=ONLINE on zyy1
NAME=ora.zyy1.vip
TYPE=application
TARGET=ONLINE
STATE=ONLINE on zyy1
NAME=ora.zyy2.ASM2.asm
TYPE=application
TARGET=ONLINE
STATE=ONLINE on zyy2
NAME=ora.zyy2.LISTENER_zyy2.lsnr
TYPE=application
TARGET=ONLINE
STATE=ONLINE on zyy2
NAME=ora.zyy2.gsd
TYPE=application
TARGET=ONLINE
STATE=ONLINE on zyy2
NAME=ora.zyy2.ons
TYPE=application
TARGET=ONLINE
STATE=ONLINE on zyy2
NAME=ora.zyy2.vip
TYPE=application
TARGET=ONLINE
STATE=ONLINE on zyy2
NAME=ora.zyydb.db
TYPE=application
TARGET=ONLINE
STATE=ONLINE on zyy2
NAME=ora.zyydb.zyydb.cs
TYPE=application
TARGET=ONLINE
STATE=ONLINE on zyy2
NAME=ora.portal.zyydb.zyydb1.srv
TYPE=application
TARGET=ONLINE
STATE=ONLINE on zyy1
NAME=ora.zyydb.zyydb.zyydb2.srv
TYPE=application
TARGET=ONLINE
STATE=ONLINE on zyy2
NAME=ora.zyydb.zyydb1.inst
TYPE=application
TARGET=ONLINE
STATE=ONLINE on zyy1
NAME=ora.zyydb.zyydb2.inst
TYPE=application
TARGET=ONLINE
STATE=ONLINE on zyy2
5. 关闭crs资源
# cd $ORA_CRS_HOME/bin
# ./crsctl stop crs
启动crs资源
# cd $ORA_CRS_HOME/bin
# ./crsctl start crs
6. 查看/启动/关闭数据库实例
srvctl status|stop|start instance -d [db_name] -i [inst_name]
srvctl status|stop|start database -d [db_name]
eg:
[oracle@zyy2 ~]$ srvctl status database -d zyydb
Instance zyydb1 is running on node zyy1
Instance zyydb2 is running on node zyy2
7. 启动/查看/关闭asm实例
srvctl status|stop|start asm -n [node_name]
eg:
$ srvctl status asm -n zyy2
ASM instance +ASM1 is running on node zyy2.
8. 启动/查看/关闭nodeapps资源
eg:
$ srvctl status nodeapps -n zyy1
VIP is running on node: zyy1
GSD is running on node: zyy1
Listener is running on node: zyy1
ONS daemon is running on node: zyy1
$ srvctl status nodeapps -n zyy2
VIP is running on node: zyy2
GSD is running on node: zyy2
Listener is running on node: zyy2
ONS daemon is running on node: zyy2
9.启动某个单独的资源
$ crs_start [NAME] 注:使用crs_stat可以查看相应资源的名字
[CLUSTERWARE]> crs_start ora.zyydb.zyydb1.inst
来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/786749/viewspace-511991/,如需转载,请注明出处,否则将追究法律责任。