太懒
分类: Oracle
2013-06-03 11:35:35
rac装好一些,默认的crs_stat –t 会隐藏一部分resource name:
不是很方便
google一下,网上有个脚本,原作者貌似不详,非常好用,感谢一下原作者
[root@node1 bin]# cd /u01/app/grid/11.2.3
[root@node1 11.2.3]# cd bin/
[root@node1 bin]# pwd
/u01/app/grid/11.2.3/bin
[root@node1 bin]# ll |grep crs_stat
-rwxr-xr-x 1 oracle oinstall 8136 May 31 17:42 crs_stat
-rwxr-xr-x 1 oracle oinstall 4919196 May 31 17:02 crs_stat.bin
[root@node1 bin]# vi crs_stat.sh
[root@node1 bin]# ll |grep crs_stat
-rwxr-xr-x 1 oracle oinstall 8136 May 31 17:42 crs_stat
-rwxr-xr-x 1 oracle oinstall 4919196 May 31 17:02 crs_stat.bin
-rw-r--r-- 1 root root 566 Jun 3 11:22 crs_stat.sh
[root@node1 bin]# chmod 755 crs_st
crs_start crs_start.bin crs_stat crs_stat.bin crs_stat.sh crs_stop crs_stop.bin
[root@node1 bin]# chmod 755 crs_stat.sh
[root@node1 bin]# chown oracle:oinstall crs_stat.sh
[root@node1 bin]# ll |grep crs_stat
-rwxr-xr-x 1 oracle oinstall 8136 May 31 17:42 crs_stat
-rwxr-xr-x 1 oracle oinstall 4919196 May 31 17:02 crs_stat.bin
-rwxr-xr-x 1 oracle oinstall 566 Jun 3 11:22 crs_stat.sh
[root@node1 bin]# more crs_stat.sh
awk /
'BEGIN {printf "%-30s %-10s %-10s %-10s/n","Name ","Target ","State ","Host ";
printf "%-30s %-10s %-10s %-10s/n","------------------------------","----------", "---------","-------";}'
crs_stat | awk /
'BEGIN { FS="=| ";state = 0;}
$1~/NAME/ {appname = $2; state=1};
state == 0 {next;}
$1~/TARGET/ && state == 1 {apptarget = $2; state=2;}
$1~/STATE/ && state == 2 {appstate = $2; apphost = $4; state=3;}
state == 3 {printf "%-30s %-10s %-10s %-10s/n", appname,apptarget,appstate,apphost; state=0;}'
[root@node1 bin]#