通常执行crs_stat的时候,name 那一列总是显示不完整:
网上查看了一个脚本可以格式化输出,完整的显示资源的名称
cat crs_stat.sh
RSC_KEY=$1
QSTAT=-u
AWK=/usr/bin/awk # if not available use /usr/bin/awk
#
$AWK \
'BEGIN {printf "%-45s %-10s %-18s\n", " Resource name", "Target", "State";
printf "%-45s %-10s %-18s\n", "--------------", "------", "-----";}'
$ORACLE_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;}'
chmod +x crs_stat.sh
执行效果如下:
时间: 2024-11-15 22:22:27