Oracle 11g RAC中crs_stat命令较之前的版本多出了很多新的不同的资源类型,缺省情况下,使用crs_stat -t来查看资源是密密麻麻一大片,看起来着实费力。作者Paul Elbow, Enkitec为我们提供了一个crsstat脚本以更清晰的格式来展现Oracle 11g RAC下的所有资源类型,见本文下面的描述。
1、安装crsstat
通常情况下,建议使用root用户或者oracle用户来安装到 /usr/local/bin 目录
当脚本首次运行时,会在安装目录产生一个 crsstat.env 文件,该文件用于描述crs的位置信息
安装crsstat前,应启动crs,其次对于crsstat脚本所在的安装路径应当具有写的权限
crsstat.v1.2.2.zip 源文件下载:
免费下载地址在 http://linux.linuxidc.com/
用户名与密码都是www.linuxidc.com
具体下载目录在 /2013年资料/7月/25日/Oracle 11g RAC crs_stat 命令结果完整显示
不会下载的见
----------------------------------------------------------------------------------------
下面是安装步骤
# cd /usr/local/bin
# unzip crsstat.v1.2.1.zip
# mv crsstat.v1.2.2 crsstat
# chmod 755 crsstat
# ./crsstat
# chmod 644 crsstat.env
校验crsstat.env文件配置是否正确
# more crsstat.env
GRID_HOME=/u01/app/11.2.0/grid
GRID_VER=11.2
2、演示用法
crsstat用法比较简单,直接在提示符下执行crsstat命令即可,也可以使用crsstat -h 输出crsstat的帮助信息
a、crsstat的帮助信息
[grid@linux1 ~]$ crsstat -h
Usage: crsstat [-h] [-c] [search term]
-h => print this message
-c => output the resources by cluster or local
Examples:
crsstat # show all resources
crsstat listener # only show listener resources
crsstat database # only show database resources
crsstat -c listener # only show database resources sorted by cluster/local
Output Contains the following fields:
Resource Name
Resource Type, which includes an identifier C-Cluster and L-Local
Target State
Current State
Current Node (11gR2: or the last node in paraenthesis if the resource is Offline)
Failure Count (11gR2 only)
Restart Count (11gR2 only)
State Details (11gR2 only)
b、使用crsstat查看集群资源
#显示所有的资源
[oracle@linux1 bin]$ crsstat
Resource Name Resource Type Target State Node FC RC State Details
---------------------------------------- ---------------- ---------- ------------ --------------- -- -- ---------------
ora.ASM_DATA.dg diskgroup L ONLINE ONLINE linux1 0
ora.ASM_DATA.dg diskgroup L ONLINE ONLINE linux2 0
ora.FRA_DATA.dg diskgroup L ONLINE ONLINE linux1 0
ora.FRA_DATA.dg diskgroup L ONLINE ONLINE linux2 0
ora.LISTENER.lsnr Listener L ONLINE ONLINE linux1 0
ora.LISTENER.lsnr Listener L ONLINE ONLINE linux2 0
ora.LISTENER_SCAN1.lsnr SCAN Listener C ONLINE ONLINE linux1 0
ora.LISTENER_SCAN2.lsnr SCAN Listener C ONLINE ONLINE linux2 0
ora.OCR_VOTE.dg diskgroup L ONLINE ONLINE linux1 0
ora.OCR_VOTE.dg diskgroup L ONLINE ONLINE linux2 0
ora.asm ASM L ONLINE ONLINE linux1 0 Started
ora.asm ASM L ONLINE ONLINE linux2 0 Started
ora.eons eons L ONLINE ONLINE linux1 0
ora.eons eons L ONLINE ONLINE linux2 0
ora.gsd Gbl Svc Daemon L OFFLINE OFFLINE (linux1) 0
ora.gsd Gbl Svc Daemon L OFFLINE OFFLINE (linux2) 0
ora.linux1.vip Cluster VIP C ONLINE ONLINE linux1 0
ora.linux2.vip Cluster VIP C ONLINE ONLINE linux2 0
ora.mmbo.db database C ONLINE ONLINE linux1 0 Open
ora.mmbo.db database C ONLINE ONLINE linux2 0 Open
ora.mmbo11g.db database C ONLINE ONLINE linux1 0 Open
ora.net1.network Network (VIP) L ONLINE ONLINE linux1 0
ora.net1.network Network (VIP) L ONLINE ONLINE linux2 0
ora.oc4j OC4J C OFFLINE OFFLINE () 0
ora.ons Ora Notif Svc L ONLINE ONLINE linux1 0
ora.ons Ora Notif Svc L ONLINE ONLINE linux2 0
ora.registry.acfs registry L ONLINE ONLINE linux1 0
ora.registry.acfs registry L ONLINE ONLINE linux2 0
ora.scan1.vip SCAN VIP C ONLINE ONLINE linux1 0
ora.scan2.vip SCAN VIP C ONLINE ONLINE linux2 0
c、其它用法
#显示service相关的信息,由于当前rac环境没有配置service,所以无任何显示
# Author : Robinson
# Blog : http://www.linuxidc.com
[oracle@linux1 bin]$ crsstat service
Resource Name Resource Type Target State Node FC RC State Details
---------------------------------------- ---------------- ---------- ------------ --------------- -- -- ---------------
#显示集群中已注册数据库的信息
[oracle@linux1 bin]$ crsstat database
Resource Name Resource Type Target State Node FC RC State Details
---------------------------------------- ---------------- ---------- ------------ --------------- -- -- ---------------
ora.mmbo.db database C ONLINE ONLINE linux1 0 Open
ora.mmbo.db database C ONLINE ONLINE linux2 0 Open
ora.mmbo11g.db database C ONLINE ONLINE linux1 0 Open
#显示集群中监听器的信息
[oracle@linux1 bin]$ crsstat lsnr
Resource Name Resource Type Target State Node FC RC State Details
---------------------------------------- ---------------- ---------- ------------ --------------- -- -- ---------------
ora.LISTENER.lsnr Listener L ONLINE ONLINE linux1 0
ora.LISTENER.lsnr Listener L ONLINE ONLINE linux2 0
ora.LISTENER_SCAN1.lsnr SCAN Listener C ONLINE ONLINE linux1 0
ora.LISTENER_SCAN2.lsnr SCAN Listener C ONLINE ONLINE linux2 0
#也可以结合grep命令来过滤
[oracle@linux1 bin]$ crsstat | grep -i offline
ora.gsd Gbl Svc Daemon L OFFLINE OFFLINE (linux1) 0
ora.gsd Gbl Svc Daemon L OFFLINE OFFLINE (linux2) 0
ora.oc4j OC4J C OFFLINE OFFLINE () 0
[grid@linux1 ~]$ crsstat -c listener
Resource Name Resource Type Target State Node FC RC State Details
---------------------------------------- ---------------- ---------- ------------ --------------- -- -- ---------------
Local Resources
--------------------------------------------------------------------------------
ora.LISTENER.lsnr Listener L ONLINE ONLINE linux1 0
ora.LISTENER.lsnr Listener L ONLINE ONLINE linux2 0
Cluster Resources
--------------------------------------------------------------------------------
ora.LISTENER_SCAN1.lsnr SCAN Listener C ONLINE ONLINE linux1 0
ora.LISTENER_SCAN2.lsnr SCAN Listener C ONLINE ONLINE linux2 0