Translation

The oldest posts, are written in Italian. If you are interested and you want read the post in English, please use Google Translator. You can find it on the right side. If the translation is wrong, please email me: I'll try to translate for you.

giovedì, marzo 10, 2016

cstat

There are several versions of "crsctl status resource" command. You can see the most cool version in [1].

In any case I made my personal output.



crsctl status resource  -v |\
      egrep -w "NAME|TYPE|TARGET|STATE|STATE_DETAILS"|\
      awk 'BEGIN {FS="=";
                    printf "%-35s %-20s %-25s %-10s %30s\n", "HA Resource", "Resource Type", "Target", "State", "Details";                    printf "%-73s \n", "---------------------------------   --------------       ---------------------     --------   --------------------------------------------------";}
                  {
switch ($1){
  case "NAME"         :  resname=$2; break;
  case "TYPE"         :  restyp=$2;  break;
  case "STATE"        :  resst=$2;   break
  case "TARGET"       :  restrg=$2;  break;
  case "STATE_DETAILS": {resdet=$2
    idx1=index(restyp , "."); subtyp=substr(restyp , idx1+1);
    idx2=index(subtyp, "."); typ=substr(subtyp, 1, idx2-1)

    # following if is added for grid 12.2
    if (typ=="database" && length($3)!=0) { resdet=resdet"="$3 }
    #
    switch (typ){
      case "appvipx"         : typ="App VIP";       break;
      case "diskgroup"       : typ="Diskgroup";     break;
      case "scan_listener"   : typ="SCAN Listener"; break;
      case "listener"        : typ="Listener";      break;
      case "asm"             : typ="ASM";           break;
      case "cvu"             : typ="CVU";           break;
      case "acfs"            : typ="ASM FS";        break;
      case "oc4j"            : typ="OC4J";          break;
      case "mgmtdb"          : typ="MGMT DB";       break;
      case "cluster_vip_net1": typ="Cluster VIP";   break;
      case "network"         : typ="Network (VIP)"; break;
      case "database"        : typ="Database";      break;
      case "ons"             : typ="Ora Notif Svc"; break;
      case "scan_vip"        : typ="SCAN VIP";      break;
      case "service"         : typ="Service";       break;
      case "volume"          : typ="Volume";        break;
      case "mgmtlsnr"        : typ="MGMT Listener"; break;
     }
     printf "%-35s %-20s %-25s %-10s %-10s\n", resname, typ , resst, restrg, resdet
                                  }; break; }

}'


Because of switch command, it works with awk version >= 4.0.2. If you are using an early version, then you have to change switch command with a if-then-else

crsctl status resource  -v |\
      egrep -w "NAME|TYPE|TARGET|STATE|STATE_DETAILS"|\
      /bin/gawk 'BEGIN {FS="=";
                    printf "%-35s %-20s %-25s %-10s %30s\n", "HA Resource", "Resource Type", "Target", "State", "Details";
                    printf "%-73s \n", "---------------------------------   --------------       ---------------------     --------   --------------------------------------------------";}
                  {
if ($1=="NAME")  resname=$2; else
if ($1=="TYPE")   restyp=$2; else
if ($1=="STATE")   resst=$2; else
if ($1=="TARGET") restrg=$2; else
if ($1=="STATE_DETAILS") { resdet=$2
    idx1=index(restyp , "."); subtyp=substr(restyp , idx1+1);
    idx2=index(subtyp, "."); typ=substr(subtyp, 1, idx2-1);

    # following if is added for grid 12.2
    if (typ=="database" && length($3)!=0) { resdet=resdet"="$3 }
    #
      if (typ=="appvipx" )               typ="App VIP"; else
      if (typ=="diskgroup " )          typ="Diskgroup"; else
      if (typ=="scan_listener " ) typ="SCAN Listener "; else
      if (typ=="listener" )             typ="Listener"; else
      if (typ=="asm" )                   typ="App VIP"; else
      if (typ=="cvu")                        typ="CVU"; else
      if (typ=="acfs")                    typ="ASM FS"; else
      if (typ=="oc4j")                      typ="OC4J"; else
      if (typ=="mgmtdb")                 typ="MGMT DB"; else
      if (typ=="cluster_vip_net1")   typ="Cluster VIP"; else
      if (typ=="network")          typ="Network (VIP)"; else
      if (typ=="database" )             typ="Database"; else
      if (typ=="ons")              typ="Ora Notif Svc"; else
      if (typ=="scan_vip" )             typ="SCAN VIP"; else
      if (typ=="service")                typ="Service"; else
      if (typ=="volume")                  typ="Volume"; else
      if (typ=="mgmtlsnr")         typ="MGMT Listener";
        printf "%-35s %-20s %-25s %-10s %-10s\n", resname, typ , resst, restrg, resdet}

}'

I checked this commands on Linux.


Following there is an output

HA Resource                         Resource Type        Target                    State                             Details
---------------------------------   --------------       ---------------------     --------   --------------------------------------------------
bck.dbCUSCTIp-bk.vip                App VIP              ONLINE on mdapora1d02     ONLINE
ora.DGCUSCTIPDB01.dg                Diskgroup            ONLINE on mdapora1d01     ONLINE
ora.DGCUSCTIPDB01.dg                Diskgroup            ONLINE on mdapora1d02     ONLINE
ora.DGCUSCTIPFS.LVCUSCTIPAK.advm    Volume               ONLINE on mdapora1d01     ONLINE     Volume device /dev/asm/lvcusctipak-156 is online
ora.DGCUSCTIPFS.LVCUSCTIPAK.advm    Volume               ONLINE on mdapora1d02     ONLINE     Volume device /dev/asm/lvcusctipak-156 is online
ora.LISTENER.lsnr                   Listener             ONLINE on mdapora1d01     ONLINE
ora.LISTENER.lsnr                   Listener             ONLINE on mdapora1d02     ONLINE
ora.LISTENER_CUSTCTIP.lsnr          Listener             ONLINE on mdapora1d01     ONLINE
ora.LISTENER_CUSTCTIP.lsnr          Listener             ONLINE on mdapora1d02     ONLINE
ora.LISTENER_SCAN1.lsnr             SCAN Listener        ONLINE on mdapora1d01     ONLINE
ora.LISTENER_SCAN2.lsnr             SCAN Listener        ONLINE on mdapora1d02     ONLINE
ora.LISTENER_SCAN3.lsnr             SCAN Listener        ONLINE on mdapora1d02     ONLINE
ora.MGMTLSNR                        MGMT Listener        ONLINE on mdapora1d02     ONLINE     169.254.62.41 10.52.254.20
ora.asm                             App VIP              ONLINE on mdapora1d01     ONLINE     Started
ora.asm                             App VIP              ONLINE on mdapora1d02     ONLINE     Started
ora.cusctip.db                      Database             ONLINE on mdapora1d01     ONLINE     Open
ora.cusctip.db                      Database             ONLINE on mdapora1d02     ONLINE     Open
ora.cvu                             CVU                  OFFLINE                   OFFLINE
ora.dggenmmpfs.lvgenmmpak.acfs      ASM FS               ONLINE on mdapora1d01     ONLINE     mounted on /dbGENMMp/akGENMMp01
ora.dggenmmpfs.lvgenmmpak.acfs      ASM FS               ONLINE on mdapora1d02     ONLINE     mounted on /dbGENMMp/akGENMMp01
ora.gencmpp.gencmpp_dem1.svc        Service              ONLINE on mdapora1d02     ONLINE
ora.gencmpp.gencmpp_dem1.svc        Service              ONLINE on mdapora1d01     ONLINE
ora.mdapora1d01.vip                 Cluster VIP          ONLINE on mdapora1d01     ONLINE
ora.mdapora1d02.vip                 Cluster VIP          ONLINE on mdapora1d02     ONLINE
ora.mdmcrp.db                       Database             ONLINE on mdapora1d01     ONLINE     Open
ora.mdmcrp.db                       Database             ONLINE on mdapora1d02     ONLINE     Open
ora.mgmtdb                          MGMT DB              ONLINE on mdapora1d02     ONLINE     Open
ora.net1.network                    Network (VIP)        ONLINE on mdapora1d01     ONLINE
ora.net1.network                    Network (VIP)        ONLINE on mdapora1d02     ONLINE
ora.net2.network                    Network (VIP)        ONLINE on mdapora1d01     ONLINE
ora.net2.network                    Network (VIP)        ONLINE on mdapora1d02     ONLINE
ora.oc4j                            OC4J                 ONLINE on mdapora1d02     ONLINE
ora.ons                             Ora Notif Svc        ONLINE on mdapora1d01     ONLINE
ora.ons                             Ora Notif Svc        ONLINE on mdapora1d02     ONLINE
ora.scan1.vip                       SCAN VIP             ONLINE on mdapora1d01     ONLINE
ora.scan2.vip                       SCAN VIP             ONLINE on mdapora1d02     ONLINE
ora.scan3.vip                       SCAN VIP             ONLINE on mdapora1d02     ONLINE
ora.sdcp.db                         Database             ONLINE on mdapora1d01     ONLINE     Open
ora.sdcp.db                         Database             OFFLINE                   OFFLINE


[1] http://blog.enkitec.com/2011/10/my-crsstat-script-improved-formatting-of-crs_stat-on-10g-and-11g/

Update

2017/08/08 - Oracle Grid 12cR2 show some differences with the prvious release.

This is from Grid 12.1.0.2 on a Linux RAC 2 nodes

ora.mdmcrp.db                       Database             OFFLINE                  OFFLINE    Instance Shutdown
ora.mdmcrp.db                       Database             ONLINE on srvora1d02     ONLINE     Open
ora.sdcp.db                         Database             ONLINE on srvora1d01     ONLINE     Open
ora.sdcp.db                         Database             OFFLINE                  OFFLINE    Open

This is from a Grid 12.2.0.1 on Linux Oracle Restart:

ora.fosi.db                         Database             OFFLINE                  OFFLINE    Instance Shutdown
ora.pcii.db                         Database             ONLINE on srvora2d       ONLINE     Open,HOME=/sbRdbms/app/oracle/product/12.1.0.2/dbh01

The new version of Oracle Grid, show now the ORACLE_HOME with which the database is started. So I modified the above script

Nessun commento: