Tuesday, 2 June 2020

RAC - Relocate RAC service from Available to Preferred Instance Example

Scenario Preview:

We have created service PRETAF on 2 node RAC. Now at present service is running on available instance which is RAC2 . We want service  to be available on preferred instance which is (RAC1)  
Command to relocate service back to preferred instance.

OUTPUT:

srv1:~ # ps -ef |grep pmon
grid      3113     1  0 13:20 ?        00:00:00 asm_pmon_+ASM1
grid      9429     1  0 13:23 ?        00:00:00 mdb_pmon_-MGMTDB
oracle   17409     1  0 13:26 ?        00:00:00 ora_pmon_RAC1
root     23087  2892  0 13:41 pts/0    00:00:00 grep --color=auto pmon
srv1:~ # . oranev
-bash: oranev: No such file or directory
srv1:~ # . oraenv
ORACLE_SID = [root] ? +ASM1
The Oracle base has been set to /u01/app/grid


  • Cluster service check, We can see below PRETAF service is running on srv2
srv1:~ # crsctl status resource -t
--------------------------------------------------------------------------------
Name           Target  State        Server                   State details
--------------------------------------------------------------------------------
Local Resources
--------------------------------------------------------------------------------
ora.CRS.dg
               ONLINE  ONLINE       srv1                     STABLE
               ONLINE  ONLINE       srv2                     STABLE
ora.DATA.dg
               ONLINE  ONLINE       srv1                     STABLE
               ONLINE  ONLINE       srv2                     STABLE
ora.FRA.dg
               ONLINE  ONLINE       srv1                     STABLE
               ONLINE  ONLINE       srv2                     STABLE
ora.LISTENER.lsnr
               ONLINE  ONLINE       srv1                     STABLE
               ONLINE  ONLINE       srv2                     STABLE
ora.asm
               ONLINE  ONLINE       srv1                     Started,STABLE
               ONLINE  ONLINE       srv2                     Started,STABLE
ora.net1.network
               ONLINE  ONLINE       srv1                     STABLE
               ONLINE  ONLINE       srv2                     STABLE
ora.ons
               ONLINE  ONLINE       srv1                     STABLE
               ONLINE  ONLINE       srv2                     STABLE
--------------------------------------------------------------------------------
Cluster Resources
--------------------------------------------------------------------------------
ora.LISTENER_SCAN1.lsnr
      1        ONLINE  ONLINE       srv1                     STABLE
ora.LISTENER_SCAN2.lsnr
      1        ONLINE  ONLINE       srv2                     STABLE
ora.LISTENER_SCAN3.lsnr
      1        ONLINE  ONLINE       srv2                     STABLE
ora.MGMTLSNR
      1        ONLINE  ONLINE       srv1                     169.254.52.81 192.16
                                                             8.10.1,STABLE
ora.cvu
      1        ONLINE  ONLINE       srv2                     STABLE
ora.mgmtdb
      1        ONLINE  ONLINE       srv1                     Open,STABLE
ora.oc4j
      1        ONLINE  ONLINE       srv2                     STABLE
ora.rac.db
      1        ONLINE  ONLINE       srv1                     Open,STABLE
      2        ONLINE  ONLINE       srv2                     Open,STABLE
ora.rac.pretaf.svc
      1        ONLINE  ONLINE       srv2                     STABLE
ora.rac.pretaf_preconnect.svc
      1        ONLINE  ONLINE       srv1                     STABLE
ora.scan1.vip
      1        ONLINE  ONLINE       srv1                     STABLE
ora.scan2.vip
      1        ONLINE  ONLINE       srv2                     STABLE
ora.scan3.vip
      1        ONLINE  ONLINE       srv2                     STABLE
ora.srv1.vip
      1        ONLINE  ONLINE       srv1                     STABLE
ora.srv2.vip
      1        ONLINE  ONLINE       srv2                     STABLE
--------------------------------------------------------------------------------


  • Pretaf service status 
srv1:~ # srvctl status service -s pretaf -db rac

Service pretaf is running on instance(s) RAC2

  • Config status of pretaf service 
srv1:~ # srvctl config service -s pretaf -db rac
Service name: pretaf
Server pool:
Cardinality: 1
Disconnect: false
Service role: PRIMARY
Management policy: AUTOMATIC
DTP transaction: false
AQ HA notifications: false
Global: false
Commit Outcome: false
Failover type:
Failover method:
TAF failover retries:
TAF failover delay:
Connection Load Balancing Goal: LONG
Runtime Load Balancing Goal: NONE
TAF policy specification: PRECONNECT
Edition:
Pluggable database name:
Maximum lag time: ANY
SQL Translation Profile:
Retention: 86400 seconds
Replay Initiation Time: 300 seconds
Session State Consistency:
GSM Flags: 0
Service is enabled
Preferred instances: RAC1
Available instances: RAC2

  • Relocate service back to RAC1 preferred instance.
srv1:~ # srvctl relocate service -db rac -service pretaf -oldinst RAC2 -newinst RAC1

  • status of pretaf service 
srv1:~ # srvctl status service -db rac -s pretaf
Service pretaf is running on instance(s) RAC1
  • Config status of pretaf service
srv1:~ # srvctl config service -s pretaf -db rac
Service name: pretaf
Server pool:
Cardinality: 1
Disconnect: false
Service role: PRIMARY
Management policy: AUTOMATIC
DTP transaction: false
AQ HA notifications: false
Global: false
Commit Outcome: false
Failover type:
Failover method:
TAF failover retries:
TAF failover delay:
Connection Load Balancing Goal: LONG
Runtime Load Balancing Goal: NONE
TAF policy specification: PRECONNECT
Edition:
Pluggable database name:
Maximum lag time: ANY
SQL Translation Profile:
Retention: 86400 seconds
Replay Initiation Time: 300 seconds
Session State Consistency:
GSM Flags: 0
Service is enabled
Preferred instances: RAC1
Available instances: RAC2
srv1:~ #

Example : 

srv1:~ # srvctl status service -s pretaf -d rac
Service pretaf is running on instance(s) rac1
srv1:~ # srvctl status service -s pretaf_preconnect -d rac
Service pretaf_preconnect is running on instance(s) rac2
srv1:~ # srvctl status database -d rac
Instance rac1 is running on node srv1
Instance rac2 is running on node srv2

srv1:~ # srvctl stop instance -i rac1 -d rac
PRCD-1315 : failed to stop instances for database rac
PRCR-1014 : Failed to stop resource 
PRCR-1065 : Failed to stop resource 
CRS-2529: Unable to act on '' because that would require stopping or relocating '', but the force option was not specified
srv1:~ #

srv2:~ # srvctl relocate service -db rac -service pretaf -oldinst rac2 -newinst rac1
srv2:~ # srvctl status service -s pretaf -d rac
Service pretaf is running on instance(s) rac1
srv2:~ # srvctl status service -s pretaf_preconnect -d rac
Service pretaf_preconnect is running on instance(s) rac2
srv2:~ #

No comments:

Post a Comment