DBAtlas · Database operations atlas

Relocate a RAC service to another instance

OracleRAC & Grid

Command

# First check the current placement:
srvctl status service -db <db_unique_name> -service <service>
# Relocate by instance (sessions are drained):
srvctl relocate service -db <db_unique_name> -service <service> \
  -oldinst <inst1> -newinst <inst3> -drain_timeout 120 -wait YES
# By node (policy-managed / singleton service):
srvctl relocate service -db <db_unique_name> -service <service> \
  -currentnode <node1> -targetnode <node2>
# Session distribution per instance (SQL):
SELECT inst_id, service_name, COUNT(*) AS sessions
FROM   gv$session
WHERE  type = 'USER'
GROUP  BY inst_id, service_name
ORDER  BY service_name, inst_id;

What it does

Moves a running service from one instance/node to another; new connections go to the target instance and existing sessions are left to close on their own during drain_timeout.

When to use it

To empty a node before maintenance, to move a service back to its preferred instance after a failover, or to rebalance load.

Caution

Relocation is temporary: it does not change the service configuration (preferred/available); when the instance restarts the service returns to its preferred instance. -force kills existing sessions; if the application cannot reconnect, users see an outage.

Open in DBAtlas →

Related