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

Principal Product Manager at Oracle
Ludovico is a member of the Oracle Database High Availability (HA), Scalability & Maximum Availability Architecture (MAA) Product Management team in Oracle. He focuses on Oracle Data Guard, Flashback technologies, and Cloud MAA.

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

  1. Hi,
    Could you please also publish one script to display all crsctl resources as requested by Rahul in previous comment?
    Thank you..
    Naga.

  2. 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.