crs_stat for mere mortals

crs_stat is the Oracle Clusterware command that provides status information for resources on the cluster nodes.

It provides NAME,TYPE,TARGET and STATE information for each configured resource in the following format by default:

NAME=ora.DB.DB1.inst
TYPE=application
TARGET=ONLINE
STATE=ONLINE on node1

NAME=ora.DB.DB2.inst
TYPE=application
TARGET=ONLINE
STATE=ONLINE on node2

NAME=ora.DB.db
TYPE=application
TARGET=ONLINE
STATE=ONLINE on node2

It is not very easy to read this output if you have large number of nodes with lots of resources configured on them. You can use the “-t” option with the crs_stat to see the output in a tabular form like:

crs_stat

crs_stat

However, this output is designed for a fixed terminal width of 60 characters. Hence the resource names are truncated. This makes it even more difficult to see what resource is in which state.

Thankfully, there are some scripts out there that parse the default output of the crs_stat and provide a tabular output in a wider form so you can see what your are looking for.

As being a one liner junkie I prefer my own version

crs_stat | awk -F= '/NAME=/{n=$2}/TYPE=/{t=$2}/TARGET=/{g=$2}/STATE=/{s=$2; printf("%-45s%-15s%-10s%-30s\n", n,t,g,s)}'

I also have an alias my_crs_stat for this command so I don’t have type it all the time.

alias my_crs_stat='crs_stat | awk -F= '\''/NAME=/{n=$2}/TYPE=/{t=$2}/TARGET=/{g=$2}/STATE=/{s=$2; printf("%-45s%-15s%-10s%-30s\n", n,t,g,s)}'\'''

This will do the trick and provide a fancier output.

my_crs_stat

my_crs_stat

About these ads
Follow

Get every new post delivered to your Inbox.

%d bloggers like this: