天天看點

Oracle 11g RAC crs_stat 指令結果完整顯示

Oracle 11g RAC中crs_stat指令較之前的版本多出了很多新的不同的資源類型,預設情況下,使用crs_stat -t來檢視資源是密密麻麻一大片,看起來着實費力。作者Paul Elbow, Enkitec為我們提供了一個crsstat腳本以更清晰的格式來展現Oracle 11g RAC下的所有資源類型,見本文下面的描述。

1、安裝crsstat

  通常情況下,建議使用root使用者或者oracle使用者來安裝到 /usr/local/bin 目錄

  當腳本首次運作時,會在安裝目錄産生一個 crsstat.env 檔案,該檔案用于描述crs的位置資訊

  安裝crsstat前,應啟動crs,其次對于crsstat腳本所在的安裝路徑應當具有寫的權限

  下面是安裝步驟

  # 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)

      State Details (11gR2 only)

b、使用crsstat檢視叢集資源   

  #顯示所有的資源  

  [oracle@linux1 bin]$ crsstat

  Resource Name                            Resource Type    Target     State        Node            FC RC State Details

  ---------------------------------------- ---------------- ---------- ------------ --------------- -- -- ---------------

  ora.ASM_DATA.dg                          diskgroup      L ONLINE     ONLINE       linux1           0   

  ora.ASM_DATA.dg                          diskgroup      L ONLINE     ONLINE       linux2           0   

  ora.FRA_DATA.dg                          diskgroup      L ONLINE     ONLINE       linux1           0   

  ora.FRA_DATA.dg                          diskgroup      L ONLINE     ONLINE       linux2           0   

  ora.LISTENER.lsnr                        Listener       L ONLINE     ONLINE       linux1           0   

  ora.LISTENER.lsnr                        Listener       L ONLINE     ONLINE       linux2           0   

  ora.LISTENER_SCAN1.lsnr                  SCAN Listener  C ONLINE     ONLINE       linux1           0   

  ora.LISTENER_SCAN2.lsnr                  SCAN Listener  C ONLINE     ONLINE       linux2           0   

  ora.OCR_VOTE.dg                          diskgroup      L ONLINE     ONLINE       linux1           0   

  ora.OCR_VOTE.dg                          diskgroup      L ONLINE     ONLINE       linux2           0   

  ora.asm                                  ASM            L ONLINE     ONLINE       linux1           0    Started

  ora.asm                                  ASM            L ONLINE     ONLINE       linux2           0    Started

  ora.eons                                 eons           L ONLINE     ONLINE       linux1           0   

  ora.eons                                 eons           L ONLINE     ONLINE       linux2           0   

  ora.gsd                                  Gbl Svc Daemon L OFFLINE    OFFLINE      (linux1)         0   

  ora.gsd                                  Gbl Svc Daemon L OFFLINE    OFFLINE      (linux2)         0   

  ora.linux1.vip                           Cluster VIP    C ONLINE     ONLINE       linux1           0   

  ora.linux2.vip                           Cluster VIP    C ONLINE     ONLINE       linux2           0   

  ora.mmbo.db                              database       C ONLINE     ONLINE       linux1           0    Open

  ora.mmbo.db                              database       C ONLINE     ONLINE       linux2           0    Open

  ora.mmbo11g.db                           database       C ONLINE     ONLINE       linux1           0    Open

  ora.net1.network                         Network (VIP)  L ONLINE     ONLINE       linux1           0   

  ora.net1.network                         Network (VIP)  L ONLINE     ONLINE       linux2           0   

  ora.oc4j                                 OC4J           C OFFLINE    OFFLINE      ()               0   

  ora.ons                                  Ora Notif Svc  L ONLINE     ONLINE       linux1           0   

  ora.ons                                  Ora Notif Svc  L ONLINE     ONLINE       linux2           0   

  ora.registry.acfs                        registry       L ONLINE     ONLINE       linux1           0   

  ora.registry.acfs                        registry       L ONLINE     ONLINE       linux2           0   

  ora.scan1.vip                            SCAN VIP       C ONLINE     ONLINE       linux1           0   

  ora.scan2.vip                            SCAN VIP       C ONLINE     ONLINE       linux2           0   

c、其它用法

  #顯示service相關的資訊,由于目前rac環境沒有配置service,是以無任何顯示

  # Author : Robinson

  [oracle@linux1 bin]$ crsstat service

  #顯示叢集中已注冊資料庫的資訊

  [oracle@linux1 bin]$ crsstat database

  #顯示叢集中監聽器的資訊

  [oracle@linux1 bin]$ crsstat lsnr

  #也可以結合grep指令來過濾

  [oracle@linux1 bin]$ crsstat | grep -i offline

  [grid@linux1 ~]$ crsstat -c listener

  Local Resources

  --------------------------------------------------------------------------------

  Cluster Resources

3、更多參考

Oracle 11g RAC crs_stat 指令結果完整顯示

<a href="http://blog.enkitec.com/2011/10/my-crsstat-script-improved-formatting-of-crs_stat-on-10g-and-11g/">My crsstat script: Improved Formatting of crs_stat on 10g and 11g</a>

<a href="http://blog.csdn.net/robinson_0612/article/details/7783724">DML Error Logging 特性 </a>

<a href="http://blog.csdn.net/robinson_0612/archive/2010/12/15/6078622.aspx">PL/SQL --&gt; 遊标</a>

<a href="http://blog.csdn.net/robinson_0612/archive/2010/12/22/6092066.aspx">PL/SQL --&gt; 隐式遊标(SQL%FOUND)</a>

<a href="http://blog.csdn.net/robinson_0612/article/details/7536926">批量SQL之 FORALL 語句</a>

<a href="http://blog.csdn.net/robinson_0612/article/details/7545597">批量SQL之 BULK COLLECT 子句</a>

<a href="http://blog.csdn.net/robinson_0612/article/details/7372061">PL/SQL 集合的初始化與指派</a>

<a href="http://blog.csdn.net/robinson_0612/article/details/7372061">PL/SQL 聯合數組與嵌套表</a>

<a href="http://blog.csdn.net/robinson_0612/article/details/7387647">PL/SQL 變長數組</a>

<a href="http://blog.csdn.net/robinson_0612/article/details/6084390">PL/SQL --&gt; PL/SQL記錄</a>

<a href="http://blog.csdn.net/robinson_0612/article/details/7422254">SQL tuning 步驟</a>

<a href="http://blog.csdn.net/robinson_0612/article/details/7406672">高效SQL語句必殺技</a>

<a href="http://blog.csdn.net/robinson_0612/article/details/6893477">父遊标、子遊标及共享遊标</a>

<a href="http://blog.csdn.net/robinson_0612/article/details/6904229">綁定變量及其優缺點</a>

<a href="http://blog.csdn.net/robinson_0612/article/details/6866925">dbms_xplan之display_cursor函數的使用</a>

<a href="http://blog.csdn.net/robinson_0612/article/details/6866870">dbms_xplan之display函數的使用</a>

<a href="http://blog.csdn.net/robinson_0612/article/details/6860007">執行計劃中各字段各子產品描述</a>

<a href="http://blog.csdn.net/robinson_0612/article/details/6837771">使用 EXPLAIN PLAN 擷取SQL語句執行計劃</a>