Saturday, October 23, 2010

crsstat –t detailed output

 crsstat –t shows truncated resource names like below
# /u01/app/crs/bin/crs_stat -t
Name           Type           Target    State     Host       
------------------------------------------------------------
ora....SM1.asm application    ONLINE    ONLINE    fire       
ora....RE.lsnr application    ONLINE    ONLINE    fire       
ora.fire.gsd   application    ONLINE    ONLINE    fire       
ora.fire.ons   application    ONLINE    ONLINE    fire       
ora.fire.vip   application    ONLINE    ONLINE    fire       
ora.racdb.db   application    ONLINE    ONLINE    water      
ora....b1.inst application    ONLINE    ONLINE    fire       
ora....b2.inst application    ONLINE    ONLINE    water      
ora....SM2.asm application    ONLINE    ONLINE    water      
ora....ER.lsnr application    ONLINE    ONLINE    water      
ora.water.gsd  application    ONLINE    ONLINE    water      
ora.water.ons  application    ONLINE    ONLINE    water      
ora.water.vip  application    ONLINE    ONLINE    water   

The resource name is truncated and dots are used in Name column.

To view complete names, here is a wrapper script, (saved as my_crs_stat.sh in my system)
command=/u01/app/crs/bin/crs_stat
format_string="%-35s %-15s %-10s %-20s \n"

printf "$format_string" "Name" "Type" "Target" "State"
printf "$format_string" | tr ' ' '-'

$command | cut -f 2 -d= | tr '\n' ',' | sed s/,,/:/g | tr ':' '\n' | while read line
do
    name=`echo $line | cut -f1 -d','`
    type=`echo $line | cut -f2 -d','`
  target=`echo $line | cut -f3 -d','`
   state=`echo $line | cut -f4 -d','`

  printf "$format_string" "$name" "$type" "$target" "$state"
done

Output of the script looks like below
# ./my_crs_stat.sh
Name                                Type            Target     State               
------------------------------------------------------------------------------------
ora.fire.ASM1.asm                   application     ONLINE     ONLINE on fire      
ora.fire.LISTENER_FIRE.lsnr         application     ONLINE     ONLINE on fire      
ora.fire.gsd                        application     ONLINE     ONLINE on fire      
ora.fire.ons                        application     ONLINE     ONLINE on fire      
ora.fire.vip                        application     ONLINE     ONLINE on fire      
ora.racdb.db                        application     ONLINE     ONLINE on water     
ora.racdb.racdb1.inst               application     ONLINE     ONLINE on fire      
ora.racdb.racdb2.inst               application     ONLINE     ONLINE on water     
ora.water.ASM2.asm                  application     ONLINE     ONLINE on water     
ora.water.LISTENER_WATER.lsnr       application     ONLINE     ONLINE on water     
ora.water.gsd                       application     ONLINE     ONLINE on water     
ora.water.ons                       application     ONLINE     ONLINE on water     
ora.water.vip                       application     ONLINE     ONLINE on water


No comments:

Post a Comment