Oracle Clusterware Services Status at a glance, fast!

If you use Oracle Clusterware or you deploy your databases to the Oracle Cloud, you probably have some application services defined with srvctl for your database.

If you have many databases, services and nodes, it might be annoying, when doing maintenance or service relocation, to have a quick overview about how services are distributed across the nodes and what’s their status.

With srvctl (the official tool for that), it is a per-database operation:

If you have many databases, you have to run db by db.

It is also slow! For example, this database has 20 services. Getting the status takes 27 seconds:

Instead of operating row-by-row (get the status for each service), why not relying on the cluster resources with crsctl and get the big picture once?

crsctl stat res -f  returns a list of ATTRIBUTE_NAME=value for each service, eventually more than one if the service is not singleton/single instance  but uniform/multi instance.

By parsing them with some awk code can provide nice results!

STATE, INTERNAL_STATE and TARGET are useful in this case and might be used to display colours as well.

  • Green: Status ONLINE, Target ONLINE, STABLE
  • Black: Status OFFLINE, Target OFFLNE, STABLE
  • Red: Status ONLINE, Target OFFLINE, STABLE
  • Yellow: all other cases

Here’s the code:

Here’s what you can expect, for 92 services distributed on 4 nodes and a dozen of databases (the output is snipped and the names are masked):

I’d be curious to know if it works well for your environment, please comment here. 🙂

Thanks

Ludo

The following two tabs change content below.

Ludovico

Oracle ACE Director and Computing Engineer at CERN
Ludovico is an Oracle ACE Director, frequent speaker and community contributor, working as Computing Engineer at CERN, the European Organization for Nuclear Research, in Switzerland.

2 thoughts on “Oracle Clusterware Services Status at a glance, fast!

  1. Hi

    Very nice script indeed.

    I have noticed that it will include output only if database resource has got some services defined.

    For example, this “Services: ” has to be defined
    $ srvctl config database -db orcl
    ..
    Services: foserv
    ..

    Then it will print it nicely.

    But if this service is not defined via “srvctl add service -db orcl -service ..”, then this database resource will not be printed at all.

    I was wondering, if that would be possible to output GRID resources same way with this script..?

    $ crsctl status resource -t
    ——————————————————————————–
    Name Target State Server State details
    ——————————————————————————–
    ora.LISTENER.lsnr
    ONLINE ONLINE node1 STABLE
    ONLINE ONLINE node2 STABLE
    ora.DATA.dg(ora.asmgroup)
    1 ONLINE ONLINE node1 STABLE
    2 ONLINE ONLINE node2 STABLE
    …….
    ….

    Regards
    Raul

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.