Check service is currently in use or not in an Oracle RAC environment

How to Check Service Status in Oracle RAC

To check whether a service is currently in use or not in an Oracle RAC environment, you can use one of the following approaches:

Method 1: Query Active Sessions for a Service

You can query the GV$SESSION view to check if there are any active sessions connected to a particular service. This will show whether the service is currently being used.

SELECT service_name, COUNT(*) AS active_sessions
FROM gv$session
WHERE service_name = '<service_name>'
GROUP BY service_name;

Method 2: Check the Service Status Using srvctl

You can use the srvctl command to check the current status of a service. Get the detail about service that its running on any instance or not.

srvctl status service -db <db_unique_name> -service <service_name>

Method 3: Using crsctl to Check Service Status

You can also use the crsctl utility to get the status of the service. Check the information about service is currently online or offline and which instances are hosting it.

crsctl stat res -w "NAME like '%<service_name>%'" -t

Method 4: Query Active Services from GV$ACTIVE_SERVICES

You can query the GV$ACTIVE_SERVICES view to see which services are currently active in the RAC environment. Show the active state of the service across all instances in the RAC.

SELECT name AS service_name, 
       inst_id, 
       state
FROM gv$active_services
WHERE name = '<service_name>';

Leave a Reply