Relocating Oracle RAC services

 
During maintenance activities where only one (1) or not all of the database nodes/instances are shutdown, services are automatically relocated by Oracle to the other remaining online database nodes/instances. Unfortunately, when the database node/instance undergoing maintenance is brought back online, the corresponding service will not be automatically relocated by Oracle to the correct setup. Thus, to avoid overloading database nodes/instances we have to relocate services manually to their preferred setup.

I. Check Service Configuration

If you were not able to check the services setup prior to maintenance, you can check for the service configuration via the following command:

srvctl config service -d [database_name]
Example:
$ srvctl config service -d JAMESPR
JAMESPRsv1 PREF: JAMESPR1 AVAIL: JAMESPR2
JAMESPRsv2 PREF: JAMESPR2 AVAIL: JAMESPR1

Preferred node should be the node that the service should be running on. Available node is only for failover purposes.

II. Check Service Status

Use the command below to check for the current status of services (which node the services are currently running on):

srvctl status service -d [database_name]
Example:
$ srvctl status service -d JAMESPR
Service JAMESPRsv1 is running on instance(s) JAMESPR2
Service JAMESPRsv2 is running on instance(s) JAMESPR2

As you can see, the service JAMESPRsv1 is currently running on node 2 (JAMESPR2) which is incorrect. We need to relocate the service.

III. Relocate Services

Use the command below to relocate the services to the correct node. You can do this while users are online and even connected to the service. If there are users connected to the service while you perform the relocation, it will take some time for their sessions to failover to the correct node but it should be ok. But it is important to note that the relocation command will take some time to complete if users are connected to the service to be relocated.

srvctl relocate service -d [database_name]-s [service_name] -i [current_instance] -t [preferred_instance]
Example:
$ srvctl relocate service -d JAMESPR-s JAMESPRsv1 -i JAMESPR2 -t JAMESPR1

If you need more help with database issues, feel free to send me an email (jimmycdo@yahoo.com) and I'll gladly help.

About Jimbart