【RAC】如何讓Oracle RAC crs_stat 命令顯示完整
【RAC】如何讓Oracle RAC crs_stat命令顯示完整
BLOG文件結構圖
最近在研究rac,發現在Oracle 11g RAC中crs_stat命令較之前的版本多出了很多新的不同的資源型別,預設情況下,使用crs_stat -t來檢視資源是密密麻麻一大片,而且很多的name列顯示不全,於是上網搜了一下這個問題的解決辦法,大概有2個解決辦法,現總結如下:
[root@node1 ~]# crs_stat -t
Name Type Target State Host
------------------------------------------------------------
ora.ARCH.dg ora....up.type ONLINE ONLINE node1
ora.DATA.dg ora....up.type ONLINE ONLINE node1
ora....ER.lsnr ora....er.type ONLINE ONLINE node1
ora....N1.lsnr ora....er.type ONLINE ONLINE node1
ora.OVDISK.dg ora....up.type ONLINE ONLINE node1
ora.TEST.dg ora....up.type ONLINE ONLINE node1
ora.asm ora.asm.type ONLINE ONLINE node1
ora.db.db ora....se.type OFFLINE OFFLINE
ora.eons ora.eons.type ONLINE ONLINE node1
ora.gsd ora.gsd.type OFFLINE OFFLINE
ora.jmrac.db ora....se.type ONLINE ONLINE node1
ora....aha.svc ora....ce.type ONLINE ONLINE node1
ora....network ora....rk.type ONLINE ONLINE node1
ora....SM1.asm application ONLINE ONLINE node1
ora....E1.lsnr application ONLINE ONLINE node1
ora.node1.gsd application OFFLINE OFFLINE
ora.node1.ons application ONLINE ONLINE node1
ora.node1.vip ora....t1.type ONLINE ONLINE node1
ora....SM2.asm application ONLINE ONLINE node2
ora....E2.lsnr application ONLINE ONLINE node2
ora.node2.gsd application OFFLINE OFFLINE
ora.node2.ons application ONLINE ONLINE node2
ora.node2.vip ora....t1.type ONLINE ONLINE node2
ora.oc4j ora.oc4j.type OFFLINE OFFLINE
ora.ons ora.ons.type ONLINE ONLINE node1
ora....ry.acfs ora....fs.type ONLINE ONLINE node1
ora.scan1.vip ora....ip.type ONLINE ONLINE node1
[root@node1 ~]#
1 方法一:shell指令碼
將如下指令碼用vi編輯器編輯一個shell指令碼,然後賦可執行許可權後就可以使用了
## 無Type列
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;}'
##有type列
awk 'BEGIN {printf "%-26s %-26s %-10s %-10s %-10s \n","Name ","Type ","Target ","State ","Host "; printf "%-30s %-26s %-10s %-10s %-10s\n","------------------------------","--------------------------","----------", "---------","-------";}'
crs_stat | 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; apphost = $4; state=4;} state == 4 {printf "%-30s %-26s %-10s %-10s %-10s\n", appname,apptype,apptarget,appstate,apphost; state=0;}'
[root@node1 ~]# 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 ~]# ./crs_stat.sh
Name Target State Host
------------------------------ ---------- --------- -------
ora.ARCH.dg ONLINE ONLINE node1
ora.DATA.dg ONLINE ONLINE node1
ora.LISTENER.lsnr ONLINE ONLINE node1
ora.LISTENER_SCAN1.lsnr ONLINE ONLINE node1
ora.OVDISK.dg ONLINE ONLINE node1
ora.TEST.dg ONLINE ONLINE node1
ora.asm ONLINE ONLINE node1
ora.db.db OFFLINE OFFLINE
ora.eons ONLINE ONLINE node1
ora.gsd OFFLINE OFFLINE
ora.jmrac.db ONLINE ONLINE node1
ora.jmrac.haha.svc ONLINE ONLINE node1
ora.net1.network ONLINE ONLINE node1
ora.node1.ASM1.asm ONLINE ONLINE node1
ora.node1.LISTENER_NODE1.lsnr ONLINE ONLINE node1
ora.node1.gsd OFFLINE OFFLINE
ora.node1.ons ONLINE ONLINE node1
ora.node1.vip ONLINE ONLINE node1
ora.node2.ASM2.asm ONLINE ONLINE node2
ora.node2.LISTENER_NODE2.lsnr ONLINE ONLINE node2
ora.node2.gsd OFFLINE OFFLINE
ora.node2.ons ONLINE ONLINE node2
ora.node2.vip ONLINE ONLINE node2
ora.oc4j OFFLINE OFFLINE
ora.ons ONLINE ONLINE node1
ora.registry.acfs ONLINE ONLINE node1
ora.scan1.vip ONLINE ONLINE node1
[root@node1 ~]#
[root@node1 ~]# more crs_stat1.sh
awk 'BEGIN {printf "%-30s %-26s %-10s %-10s %-10s \n","Name ","Type ","Target ","State ","Host "; printf "%-30s %-26s %-10s %-10s %-10s\n","--------------
----------------","--------------------------","----------", "---------","-------";}'
crs_stat | 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~/ST
ATE/ && state == 3 {appstate = $2; apphost = $4; state=4;} state == 4 {printf "%-30s %-26s %-10s %-10s %-10s\n", appname,apptype,apptarget,appstate,apphost; state=0;}'
[root@node1 ~]# ./crs_stat1.sh
Name Type Target State Host
------------------------------ -------------------------- ---------- --------- -------
ora.ARCH.dg ora.diskgroup.type ONLINE ONLINE node1
ora.DATA.dg ora.diskgroup.type ONLINE ONLINE node1
ora.LISTENER.lsnr ora.listener.type ONLINE ONLINE node1
ora.LISTENER_SCAN1.lsnr ora.scan_listener.type ONLINE ONLINE node1
ora.OVDISK.dg ora.diskgroup.type ONLINE ONLINE node1
ora.TEST.dg ora.diskgroup.type ONLINE ONLINE node1
ora.asm ora.asm.type ONLINE ONLINE node1
ora.db.db ora.database.type OFFLINE OFFLINE
ora.eons ora.eons.type ONLINE ONLINE node1
ora.gsd ora.gsd.type OFFLINE OFFLINE
ora.jmrac.db ora.database.type ONLINE ONLINE node1
ora.jmrac.haha.svc ora.service.type ONLINE ONLINE node1
ora.net1.network ora.network.type ONLINE ONLINE node1
ora.node1.ASM1.asm application ONLINE ONLINE node1
ora.node1.LISTENER_NODE1.lsnr application ONLINE ONLINE node1
ora.node1.gsd application OFFLINE OFFLINE
ora.node1.ons application ONLINE ONLINE node1
ora.node1.vip ora.cluster_vip_net1.type ONLINE ONLINE node1
ora.node2.ASM2.asm application ONLINE ONLINE node2
ora.node2.LISTENER_NODE2.lsnr application ONLINE ONLINE node2
ora.node2.gsd application OFFLINE OFFLINE
ora.node2.ons application ONLINE ONLINE node2
ora.node2.vip ora.cluster_vip_net1.type ONLINE ONLINE node2
ora.oc4j ora.oc4j.type OFFLINE OFFLINE
ora.ons ora.ons.type ONLINE ONLINE node1
ora.registry.acfs ora.registry.acfs.type ONLINE ONLINE node1
ora.scan1.vip ora.scan_vip.type ONLINE ONLINE node1
[root@node1 ~]#
或者直接在/usr/local/bin/目錄下編輯也可以直接執行:
[root@node1 ~]# more /usr/local/bin/crsstat1
awk 'BEGIN {printf "%-30s %-26s %-10s %-10s %-10s \n","Name ","Type ","Target ","State ","Host "; printf "%-30s %-26s %-10s %-10s %-10s\n","--------------
----------------","--------------------------","----------", "---------","-------";}'
crs_stat | 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~/ST
ATE/ && state == 3 {appstate = $2; apphost = $4; state=4;} state == 4 {printf "%-30s %-26s %-10s %-10s %-10s\n", appname,apptype,apptarget,appstate,apphost; state=0;}'
[root@node1 ~]# crsstat1
Name Type Target State Host
------------------------------ -------------------------- ---------- --------- -------
ora.ARCH.dg ora.diskgroup.type ONLINE ONLINE node1
ora.DATA.dg ora.diskgroup.type ONLINE ONLINE node1
ora.LISTENER.lsnr ora.listener.type ONLINE ONLINE node1
ora.LISTENER_SCAN1.lsnr ora.scan_listener.type ONLINE ONLINE node1
ora.OVDISK.dg ora.diskgroup.type ONLINE ONLINE node1
ora.TEST.dg ora.diskgroup.type ONLINE ONLINE node1
ora.asm ora.asm.type ONLINE ONLINE node1
ora.db.db ora.database.type OFFLINE OFFLINE
ora.eons ora.eons.type ONLINE ONLINE node1
ora.gsd ora.gsd.type OFFLINE OFFLINE
ora.jmrac.db ora.database.type ONLINE ONLINE node1
ora.jmrac.haha.svc ora.service.type ONLINE ONLINE node1
ora.net1.network ora.network.type ONLINE ONLINE node1
ora.node1.ASM1.asm application ONLINE ONLINE node1
ora.node1.LISTENER_NODE1.lsnr application ONLINE ONLINE node1
ora.node1.gsd application OFFLINE OFFLINE
ora.node1.ons application ONLINE ONLINE node1
ora.node1.vip ora.cluster_vip_net1.type ONLINE ONLINE node1
ora.node2.ASM2.asm application ONLINE ONLINE node2
ora.node2.LISTENER_NODE2.lsnr application ONLINE ONLINE node2
ora.node2.gsd application OFFLINE OFFLINE
ora.node2.ons application ONLINE ONLINE node2
ora.node2.vip ora.cluster_vip_net1.type ONLINE ONLINE node2
ora.oc4j ora.oc4j.type OFFLINE OFFLINE
ora.ons ora.ons.type ONLINE ONLINE node1
ora.registry.acfs ora.registry.acfs.type ONLINE ONLINE node1
ora.scan1.vip ora.scan_vip.type ONLINE ONLINE node1
2 方法二:安裝一個包
具體參考大師樂沙彌的世界的blog: http://blog.csdn.net/leshami/article/details/9411177
1、安裝crsstat
通常情況下,建議使用root使用者或者oracle使用者來安裝到 /usr/local/bin 目錄
當指令碼首次執行時,會在安裝目錄產生一個 crsstat.env 檔案,該檔案用於描述crs的位置資訊
安裝crsstat前,應啟動crs,其次對於crsstat指令碼所在的安裝路徑應當具有寫的許可權
原始檔下載: http://blog.enkitec.com/wp-content/uploads/2012/07/crsstat.v1.2.2.zip
下面是安裝步驟
# cd /usr/local/bin
# unzip crsstat.v1.2.1.zip
# mv crsstat.v1.2.2 crsstat
# chmod 755 crsstat
# ./crsstat
# chmod 644 crsstat.env
校驗crsstat.env檔案配置是否正確
# more crsstat.env
GRID_HOME=/u01/app/11.2.0/grid
GRID_VER=11.2
2、演示用法
crsstat用法比較簡單,直接在提示符下執行crsstat命令即可,也可以使用crsstat -h 輸出crsstat的幫助資訊
a、crsstat的幫助資訊
[grid@linux1 ~]$ crsstat -h
Usage: crsstat [-h] [-c] [search term]
-h => print this message
-c => output the resources by cluster or local
Examples:
crsstat # show all resources
crsstat listener # only show listener resources
crsstat database # only show database resources
crsstat -c listener # only show database resources sorted by cluster/local
Output Contains the following fields:
Resource Name
Resource Type, which includes an identifier C-Cluster and L-Local
Target State
Current State
Current Node (11gR2: or the last node in paraenthesis if the resource is Offline)
Failure Count (11gR2 only)
Restart Count (11gR2 only)
b、使用crsstat檢視叢集資源
#顯示所有的資源 State Details (11gR2 only)
[root@node1 ~]# crsstat
Resource Name Resource Type Target State Node FC RC State Details
---------------------------------------- ---------------- ---------- ------------ --------------- -- -- ---------------
ora.ARCH.dg diskgroup L ONLINE ONLINE node1 0
ora.ARCH.dg diskgroup L ONLINE ONLINE node2 0
ora.DATA.dg diskgroup L ONLINE ONLINE node1 0
ora.DATA.dg diskgroup L ONLINE ONLINE node2 0
ora.LISTENER.lsnr Listener L ONLINE ONLINE node1 0
ora.LISTENER.lsnr Listener L ONLINE ONLINE node2 0
ora.LISTENER_SCAN1.lsnr SCAN Listener C ONLINE ONLINE node1 0
ora.OVDISK.dg diskgroup L ONLINE ONLINE node1 0
ora.OVDISK.dg diskgroup L ONLINE ONLINE node2 0
ora.TEST.dg diskgroup L ONLINE ONLINE node1 0
ora.TEST.dg diskgroup L ONLINE ONLINE node2 0
ora.asm ASM L ONLINE ONLINE node1 0 Started
ora.asm ASM L ONLINE ONLINE node2 0 Started
ora.db.db database C OFFLINE OFFLINE (node1) 0
ora.db.db database C OFFLINE OFFLINE (node2) 0
ora.eons eons L ONLINE ONLINE node1 0
ora.eons eons L ONLINE ONLINE node2 0
ora.gsd Gbl Svc Daemon L OFFLINE OFFLINE (node1) 0
ora.gsd Gbl Svc Daemon L OFFLINE OFFLINE (node2) 0
ora.jmrac.db database C ONLINE ONLINE node1 0 Open
ora.jmrac.db database C ONLINE ONLINE node2 0 Open
ora.jmrac.haha.svc service C ONLINE ONLINE node1 0
ora.jmrac.haha.svc service C ONLINE ONLINE node2 0
ora.net1.network Network (VIP) L ONLINE ONLINE node1 0
ora.net1.network Network (VIP) L ONLINE ONLINE node2 0
ora.node1.vip Cluster VIP C ONLINE ONLINE node1 0
ora.node2.vip Cluster VIP C ONLINE ONLINE node2 0
ora.oc4j OC4J C OFFLINE OFFLINE () 0
ora.ons Ora Notif Svc L ONLINE ONLINE node1 0
ora.ons Ora Notif Svc L ONLINE ONLINE node2 0
ora.registry.acfs registry L ONLINE ONLINE node1 0
ora.registry.acfs registry L ONLINE ONLINE node2 0
ora.scan1.vip SCAN VIP C ONLINE ONLINE node1 0
[root@node1 ~]#
c、其它用法
#顯示service相關的資訊
[root@node1 ~]# crsstat service
Resource Name Resource Type Target State Node FC RC State Details
---------------------------------------- ---------------- ---------- ------------ --------------- -- -- ---------------
ora.jmrac.haha.svc service C ONLINE ONLINE node1 0
ora.jmrac.haha.svc service C ONLINE ONLINE node2 0
#顯示叢集中已註冊資料庫的資訊
[root@node1 ~]# crsstat database
Resource Name Resource Type Target State Node FC RC State Details
---------------------------------------- ---------------- ---------- ------------ --------------- -- -- ---------------
ora.db.db database C OFFLINE OFFLINE (node1) 0
ora.db.db database C OFFLINE OFFLINE (node2) 0
ora.jmrac.db database C ONLINE ONLINE node1 0 Open
ora.jmrac.db database C ONLINE ONLINE node2 0 Open
[root@node1 ~]#
#顯示叢集中監聽器的資訊
[root@node1 ~]# crsstat lsnr
Resource Name Resource Type Target State Node FC RC State Details
---------------------------------------- ---------------- ---------- ------------ --------------- -- -- ---------------
ora.LISTENER.lsnr Listener L ONLINE ONLINE node1 0
ora.LISTENER.lsnr Listener L ONLINE ONLINE node2 0
ora.LISTENER_SCAN1.lsnr SCAN Listener C ONLINE ONLINE node1 0
[root@node1 ~]#
#也可以結合grep命令來過濾
[root@node1 ~]# crsstat | grep -i offline
ora.db.db database C OFFLINE OFFLINE (node1) 0
ora.db.db database C OFFLINE OFFLINE (node2) 0
ora.gsd Gbl Svc Daemon L OFFLINE OFFLINE (node1) 0
ora.gsd Gbl Svc Daemon L OFFLINE OFFLINE (node2) 0
ora.oc4j OC4J C OFFLINE OFFLINE () 0
[root@node1 ~]#
[root@node1 ~]# crsstat -c listener
Resource Name Resource Type Target State Node FC RC State Details
---------------------------------------- ---------------- ---------- ------------ --------------- -- -- ---------------
Local Resources
--------------------------------------------------------------------------------
ora.LISTENER.lsnr Listener L ONLINE ONLINE node1 0
ora.LISTENER.lsnr Listener L ONLINE ONLINE node2 0
Cluster Resources
--------------------------------------------------------------------------------
ora.LISTENER_SCAN1.lsnr SCAN Listener C ONLINE ONLINE node1 0
[root@node1 ~]#
About Me
.............................................................................................................................................
● 本文作者:小麥苗,部分內容整理自網路,若有侵權請聯絡小麥苗刪除
● 本文在itpub(http://blog.itpub.net/26736162/abstract/1/)、部落格園(http://www.cnblogs.com/lhrbest)和個人微信公眾號(xiaomaimiaolhr)上有同步更新
● 本文itpub地址:http://blog.itpub.net/26736162/abstract/1/
● 本文部落格園地址:http://www.cnblogs.com/lhrbest
● 本文pdf版、個人簡介及小麥苗雲盤地址:http://blog.itpub.net/26736162/viewspace-1624453/
● 資料庫筆試面試題庫及解答:http://blog.itpub.net/26736162/viewspace-2134706/
● DBA寶典今日頭條號地址:
.............................................................................................................................................
● QQ群號:230161599(滿)、618766405
● 微信群:可加我微信,我拉大家進群,非誠勿擾
● 聯絡我請加QQ好友(646634621),註明新增緣由
● 於 2017-12-01 09:00 ~ 2017-12-31 22:00 在魔都完成
● 文章內容來源於小麥苗的學習筆記,部分整理自網路,若有侵權或不當之處還請諒解
● 版權所有,歡迎分享本文,轉載請保留出處
.............................................................................................................................................
● 小麥苗的微店:
● 小麥苗出版的資料庫類叢書:http://blog.itpub.net/26736162/viewspace-2142121/
.............................................................................................................................................
使用微信客戶端掃描下面的二維碼來關注小麥苗的微信公眾號(xiaomaimiaolhr)及QQ群(DBA寶典),學習最實用的資料庫技術。
小麥苗的微信公眾號 小麥苗的DBA寶典QQ群2 《DBA筆試面寶典》讀者群 小麥苗的微店
.............................................................................................................................................
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/28389881/viewspace-1718727/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- Oracle 11g RAC crs_stat 命令結果完整顯示Oracle
- 如何讓crs_stat命令結果中的name列完全顯示
- oracle 11g rac asmcmd du 命令不顯示的一個情況OracleASM
- Oracle RAC日常管理命令Oracle
- Oracle RAC維護命令Oracle
- oracle rac crsctl 命令大全Oracle
- 使用ORACLE RAC GUARD命令——RAC GUARD概念和管理Oracle
- 【RAC】Oracle RAC如何修改心跳網路Oracle
- oracle rac管理基本命令Oracle
- 管理Oracle RAC工具及命令Oracle
- 【RAC】Oracle rac 如何修改公網及vipOracle
- [20210804]oracle rac執行命令crs_stat -t -v緩慢的分析.txtOracle
- 【RAC】Oracle rac修改IP地址及埠號命令參考Oracle
- Oracle RAC維護命令集Oracle
- Oracle RAC日常基本維護命令Oracle
- 【RAC】Oracle10g rac新增刪除節點命令參考Oracle
- linux_oracle10g_rac_asm_命令列配置rac記錄LinuxOracleASM命令列
- RAC 管理命令
- 【轉】Oracle RAC日常基本維護命令Oracle
- Oracle RAC 常用維護工具和命令Oracle
- oracle RACOracle
- RAC crs_stat unknown資源狀態處理(ZT)
- Oracle RAC Cache Fusion 系列十七:Oracle RAC DRMOracle
- Oracle 11.2 DataGuard RAC To RAC搭建Oracle
- oracle RAC 診斷叢集狀態命令Oracle
- oracle 11g rac 叢集操作命令Oracle
- Oracle 11g RAC 常用命令Oracle
- oracle 10g rac srvctl 命令總結Oracle 10g
- RAC操作命令大全
- RAC維護命令
- RAC常用管理命令
- RAC 常用管理命令
- 讓history命令顯示日期和時間
- Oracle RAC CacheFusion 系列十五:Oracle RAC CRServer Part TwoOracleServer
- win10系統如何讓工作管理員顯示命令列Win10命令列
- ORACLE RAC clusterwareOracle
- oracle rac oemOracle
- oracle rac + dataguardOracle