10gRAC系列之三-使用crs_stat工具查看资源状态
Oracle10gRAC提供一个工具crs_stat可以用以查看RAC中各资源状态,该工具主要的常用用法如下:
1.通过-h参数可以得到系统提示bash-2.05$ crs_stat -h
Usage: crs_stat [resource_name [...]] [-v] [-l] [-q] [-c cluster_member]
crs_stat [resource_name [...]] -t [-v] [-q] [-c cluster_member]
crs_stat -p [resource_name [...]] [-q]
crs_stat [-a] application -g
crs_stat [-a] application -r [-c cluster_member]
crs_stat -f [resource_name [...]] [-q] [-c cluster_member]
crs_stat -ls [resource_name [...]] [-q]
2.通过ls命令查看RAC中各资源bash-2.05$ crs_stat -ls
Name Owner Primary PrivGrp Permission
-----------------------------------------------------------------
ora....C1.lsnr oracle dba rwxrwxr--
ora....ac1.gsd oracle dba rwxr-xr--
ora....ac1.ons oracle dba rwxr-xr--
ora....ac1.vip root dba rwxr-xr--
ora....C2.lsnr oracle dba rwxrwxr--
ora....ac2.gsd oracle dba rwxr-xr--
ora....ac2.ons oracle dba rwxr-xr--
ora....ac2.vip root dba rwxr-xr--
ora.eygle.db oracle dba rwxrwxr--
ora....ygle.cs oracle dba rwxrwxr--
ora....le1.srv oracle dba rwxrwxr--
ora....le2.srv oracle dba rwxrwxr--
ora....e1.inst oracle dba rwxrwxr--
ora....e2.inst oracle dba rwxrwxr--
3.直接使用crs_stat工具列出所有资源的具体信息
bash-2.05$ crs_statNAME=ora.db210-rac1.LISTENER_DB210-RAC1.lsnr
TYPE=application
TARGET=ONLINE
STATE=ONLINE on db210-rac1
NAME=ora.db210-rac1.gsd
TYPE=application
TARGET=ONLINE
STATE=ONLINE on db210-rac1
NAME=ora.db210-rac1.ons
TYPE=application
TARGET=ONLINE
STATE=ONLINE on db210-rac1
NAME=ora.db210-rac1.vip
TYPE=application
TARGET=ONLINE
STATE=ONLINE on db210-rac1
NAME=ora.db210-rac2.LISTENER_DB210-RAC2.lsnr
TYPE=application
TARGET=ONLINE
STATE=ONLINE on db210-rac2
NAME=ora.db210-rac2.gsd
TYPE=application
TARGET=ONLINE
STATE=ONLINE on db210-rac2
NAME=ora.db210-rac2.ons
TYPE=application
TARGET=ONLINE
STATE=ONLINE on db210-rac2
NAME=ora.db210-rac2.vip
TYPE=application
TARGET=ONLINE
STATE=ONLINE on db210-rac2
NAME=ora.eygle.db
TYPE=application
TARGET=ONLINE
STATE=ONLINE on db210-rac1
NAME=ora.eygle.eygle.cs
TYPE=application
TARGET=OFFLINE
STATE=OFFLINE
NAME=ora.eygle.eygle.eygle1.srv
TYPE=application
TARGET=OFFLINE
STATE=OFFLINE
NAME=ora.eygle.eygle.eygle2.srv
TYPE=application
TARGET=OFFLINE
STATE=OFFLINE
NAME=ora.eygle.eygle1.inst
TYPE=application
TARGET=ONLINE
STATE=ONLINE on db210-rac1
NAME=ora.eygle.eygle2.inst
TYPE=application
TARGET=ONLINE
STATE=ONLINE on db210-rac2
4.查看具体资源的状态bash-2.05$ crs_stat -p ora.db210-rac2.vip
NAME=ora.db210-rac2.vip
TYPE=application
ACTION_SCRIPT=/opt/oracle/product/10.2.0/Crs10g/bin/racgwrap
ACTIVE_PLACEMENT=1
AUTO_START=1
CHECK_INTERVAL=60
DESCRIPTION=CRS application for VIP on a node
FAILOVER_DELAY=0
FAILURE_INTERVAL=0
FAILURE_THRESHOLD=0
HOSTING_MEMBERS=db210-rac2
OPTIONAL_RESOURCES=
PLACEMENT=favored
REQUIRED_RESOURCES=
RESTART_ATTEMPTS=0
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=bge0
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=172.16.19.212
-The End-
By eygle on 2007-01-10 10:50 |
Comments (1) |
Advanced | 1299 |
1 Comment
补充一个
=================================my_crs_stat=====================
#!/usr/bin/ksh
#
# Sample 10g CRS resource status query script
#
# Description:
# - Returns formatted version of crs_stat -t, in tabular
# format, with the complete rsc names and filtering keywords
# - The argument, $RSC_KEY, is optional and if passed to the script, will
# limit the output to HA resources whose names match $RSC_KEY.
# Requirements:
# - $ORA_CRS_HOME should be set in your environment
RSC_KEY=$1
QSTAT=-u
AWK=/usr/xpg4/bin/awk # if not available use /usr/bin/awk
# Table header:echo ""
$AWK \
'BEGIN {printf "%-45s %-10s %-18s\n", "HA Resource", "Target", "State";
printf "%-45s %-10s %-18s\n", "-----------", "------", "-----";}'
# Table body:
$ORA_CRS_HOME/bin/crs_stat $QSTAT | $AWK \
'BEGIN { FS="="; state = 0; }
$1~/NAME/ && $2~/'$RSC_KEY'/ {appname = $2; state=1};
state == 0 {next;}
$1~/TARGET/ && state == 1 {apptarget = $2; state=2;}
$1~/STATE/ && state == 2 {appstate = $2; state=3;}
state == 3 {printf "%-45s %-10s %-18s\n", appname, apptarget, appstate; state=0;}'