Quantcast
Channel: A! Help
Viewing all articles
Browse latest Browse all 314

Script For Listing 11gR2 Cluster Resource Status in CRS_STAT Output Format

$
0
0
crs_stat -t is depreciated in 11gR2 and replaced with crsctl stat res -t. Following script could be used to generate resource status output in a format that is similar to crs_stat -t in 11gR1.
#!/bin/sh
# Sample 11gR2 CRS resource status query script
# gives output similar to crs_stat -t in 11gR1
# Asanga Pradeep

awk \
'BEGIN {printf "%-35s %-25s %-18s %-18s\n", "Resource Name", "Type", "Target","State";
printf "%-35s %-25s %-18s %-18s\n", "-----------", "------", "-------","--------";}'
crsctl stat res | egrep -w "NAME|TYPE|TARGET|STATE" | sed -e "s/ / /g" | awk \
'BEGIN { FS="="; state = 0; }
$1~/NAME/ {appname = $2; state=1};
state == 0 {next;}
$1~/TYPE/ && state == 1 {apptype = $2; state=2;}
$1~/TARGET/ && state == 2 {apptarget = $2; state=3;}
$1~/STATE/ && state == 3 {appstate = $2; state=4;}
state == 4 {
split(apptarget,targetarray,", ");
x=length(targetarray);
split(appstate,statearray,", ");
for(ix=1;ix<=x;ix++)
printf "%-35s %-25s %-18s %-18s\n", appname, apptype,targetarray[ix], statearray[ix]; state=0;}'




Output
Resource Name                       Type                      Target             State
----------- ------ ------- --------
ora.CLUSTERDG.dg ora.diskgroup.type ONLINE ONLINE on rac4
ora.CLUSTERDG.dg ora.diskgroup.type ONLINE ONLINE on rac5
ora.DATA.dg ora.diskgroup.type ONLINE ONLINE on rac4
ora.DATA.dg ora.diskgroup.type ONLINE ONLINE on rac5
ora.FLASH.dg ora.diskgroup.type ONLINE ONLINE on rac4
ora.FLASH.dg ora.diskgroup.type ONLINE ONLINE on rac5
ora.LISTENER.lsnr ora.listener.type ONLINE ONLINE on rac4
ora.LISTENER.lsnr ora.listener.type ONLINE ONLINE on rac5
ora.LISTENER_SCAN1.lsnr ora.scan_listener.type ONLINE ONLINE on rac5
ora.asm ora.asm.type ONLINE ONLINE on rac4
ora.asm ora.asm.type ONLINE ONLINE on rac5
ora.cvu ora.cvu.type OFFLINE OFFLINE
ora.gsd ora.gsd.type OFFLINE OFFLINE
ora.gsd ora.gsd.type OFFLINE OFFLINE
ora.net1.network ora.network.type ONLINE ONLINE on rac4
ora.net1.network ora.network.type ONLINE ONLINE on rac5
ora.oc4j ora.oc4j.type OFFLINE OFFLINE
ora.ons ora.ons.type ONLINE ONLINE on rac4
ora.ons ora.ons.type ONLINE ONLINE on rac5
ora.rac11g2.db ora.database.type ONLINE ONLINE on rac4
ora.rac11g2.db ora.database.type ONLINE ONLINE on rac5
ora.rac11g2.test.svc ora.service.type ONLINE ONLINE on rac4
ora.rac11g2.test.svc ora.service.type ONLINE ONLINE on rac5
ora.rac4.vip ora.cluster_vip_net1.type ONLINE ONLINE on rac4
ora.rac5.vip ora.cluster_vip_net1.type ONLINE ONLINE on rac5
ora.registry.acfs ora.registry.acfs.type ONLINE ONLINE on rac4
ora.registry.acfs ora.registry.acfs.type ONLINE ONLINE on rac5
ora.scan1.vip ora.scan_vip.type ONLINE ONLINE on rac5

Related Post
Script to get full name of the resources from crs_stat

Viewing all articles
Browse latest Browse all 314

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>