In this document, i have explained how to move the service from one node of the cluster to the other node of the cluster. you can move it through Temporarily & Permanently. i have tried this example in 11gR2 RAC environment having 2 node primary & 2 node standby database.
ABOUT SERVICE IN RAC
Service name is used by clients to connect to one or more instances. The service name should be unique throughout your system.
If multiple databases in the cluster offer the same service name, then RAC balances connections to that service across all such databases. If you want client connections to a service to be directed to a particular database, then the service name must be unique within the cluster
TEMPORARILY RELOCATE SERVICE FROM ONE NODE TO ANOTHER NODE IN CLUSTER
$srvctl relocate service -h
Temporarily relocates service from one node of the cluster to another.
Usage: srvctl relocate service -d <db_unique_name> -s <service_name> {-i <old_inst_name> -t <new_inst_name> | -c <current_node> -n <target_node>} [-f]
Specify instances for an administrator-managed database, or nodes for a policy managed database
-d <db_unique_name> Unique name for the database
-s <service> Service name
-i <old_inst> Old instance name
-t <new_inst> New instance name
-c <current_node> Node name to relocate service from
-n <target_node> Node name to relocate service to
-f Disconnect all sessions during stop or relocate service operations
-h Print usage
BEFORE CHANGING SERVICE STATUS
ora.BHU_a.db ONLINE on bhuora01, ONLINE on bhuora02
ora.BHU_a.bhurac.com.svc ONLINE on bhuora01
Using Relocate service option to move from one node to another node
% srvctl relocate service -d BHU_A -s bhurac.com -i BHU_2 -t BHU_1 –f
AFTER CHANGING SERVICE STATUS
ora.BHU_a.db ONLINE on bhuora01, ONLINE on bhuora02
ora.BHU_a.bhurac.com.svc ONLINE on bhuora01
In the above example, we have moved our service from one node to another node of the cluster. this doesnt change in the configuration
$ srvctl config service -d BHU_a
Service name: bhurac.com
Service is enabled
Server pool: BHU_A_RAC.com
Cardinality: 1
Disconnect: false
Service role: PRIMARY
Management policy: AUTOMATIC
DTP transaction: false
AQ HA notifications: false
Failover type: NONE
Failover method: NONE
TAF failover retries: 0
TAF failover delay: 0
Connection Load Balancing Goal: LONG
Runtime Load Balancing Goal: NONE
TAF policy specification: NONE
Edition:
Preferred instances: BHU_2
Available instances: BHU_1
PERMANENT RELOCATE SERVICE FROM ONE NODE OF THE CLUSTER TO ANOTHER
To view the service configuration of the environment. i am planning to move my service from BHU_1 to BHU_2 permanently
$ srvctl config service -d BHU_b -s bhurac.com
Service name: bhurac.com
Service is enabled
Server pool: BHU_B_rac.com
Cardinality: 1
Disconnect: true
Service role: PRIMARY
Management policy: AUTOMATIC
DTP transaction: false
AQ HA notifications: false
Failover type: NONE
Failover method: NONE
TAF failover retries: 0
TAF failover delay: 0
Connection Load Balancing Goal: LONG
Runtime Load Balancing Goal: NONE
TAF policy specification: NONE
Edition:
Preferred instances: BHU_1
Available instances: BHU_2
$ srvctl modify service -h
Modifies the configuration for the service.
Usage: srvctl modify service -d <db_unique_name> -s <service_name> -n -i "<preferred_list>" [-a "<available_list>"] [-f]
-d <db_unique_name> Unique name for the database
-s <service> Service name
-n Modify service configuration
-i "<preferred_list>" Comma separated list of preferred instances
-a "<available_list>" Comma separated list of available instances
-f Disconnect all sessions during stop or relocate service operations
To modify service from one to another node
$ srvctl modify service -d BHU_b -s bhurac.com -n -i BHU_2 -a BHU_1 –f
To verify whether the service has moved from one node to another permanently
$srvctl config service -d BHU_b -s bhurac.com
Service name: bhurac.com
Service is enabled
Server pool: BHU_B_rac.com
Cardinality: 1
Disconnect: false
Service role: PRIMARY
Management policy: AUTOMATIC
DTP transaction: false
AQ HA notifications: false
Failover type: NONE
Failover method: NONE
TAF failover retries: 0
TAF failover delay: 0
Connection Load Balancing Goal: LONG
Runtime Load Balancing Goal: NONE
TAF policy specification: NONE
Edition:
Preferred instances: BHU_2
Available instances: BHU_1