Search

Monday, June 27, 2016

Cluster resource Dependencies RAC

Cluster resource Dependencies

[grid@rhel11grac1 oraagent_oracle]$ crsctl stat res ora.sgculdb.db -p
NAME=ora.sgculdb.db
TYPE=ora.database.type
ACL=owner:oracle:rwx,pgrp:oinstall:rwx,other::r--
ACTION_FAILURE_TEMPLATE=
ACTION_SCRIPT=
ACTIVE_PLACEMENT=1
AGENT_FILENAME=%CRS_HOME%/bin/oraagent%CRS_EXE_SUFFIX%
AUTO_START=restore
CARDINALITY=2
CHECK_INTERVAL=1
CHECK_TIMEOUT=30
CLUSTER_DATABASE=true
DATABASE_TYPE=RAC
DB_UNIQUE_NAME=sgculdb
DEFAULT_TEMPLATE=PROPERTY(RESOURCE_CLASS=database) PROPERTY(DB_UNIQUE_NAME= CONCAT(PARSE(%NAME%, ., 2), %USR_ORA_DOMAIN%, .)) ELEMENT(INSTANCE_NAME= %GEN_USR_ORA_INST_NAME%) ELEMENT(DATABASE_TYPE= %DATABASE_TYPE%)
DEGREE=1
DESCRIPTION=Oracle Database resource
ENABLED=1
FAILOVER_DELAY=0
FAILURE_INTERVAL=60
FAILURE_THRESHOLD=1
GEN_AUDIT_FILE_DEST=/u01/app/oracle/admin/sgculdb/adump
GEN_START_OPTIONS=
GEN_START_OPTIONS@SERVERNAME(rhel11grac1)=open
GEN_START_OPTIONS@SERVERNAME(rhel11grac2)=open
GEN_USR_ORA_INST_NAME=
GEN_USR_ORA_INST_NAME@SERVERNAME(rhel11grac1)=sgculdb1
GEN_USR_ORA_INST_NAME@SERVERNAME(rhel11grac2)=sgculdb2
HOSTING_MEMBERS=
INSTANCE_FAILOVER=0
LOAD=1
LOGGING_LEVEL=1
MANAGEMENT_POLICY=AUTOMATIC
NLS_LANG=
NOT_RESTARTING_TEMPLATE=
OFFLINE_CHECK_INTERVAL=0
ONLINE_RELOCATION_TIMEOUT=0
ORACLE_HOME=/u01/app/oracle/product/11.2.0.3
ORACLE_HOME_OLD=
PLACEMENT=restricted
PROFILE_CHANGE_TEMPLATE=
RESTART_ATTEMPTS=2
ROLE=PRIMARY
SCRIPT_TIMEOUT=60
SERVER_POOLS=ora.sgculdb
SPFILE=+DATA_DG/sgculdb/spfilesgculdb.ora
START_DEPENDENCIES=weak(type:ora.listener.type,global:type:ora.scan_listener.type,uniform:ora.ons,global:ora.gns) hard(ora.DATA_DG.dg,ora.FRA.dg) pullup(ora.DATA_DG.dg,ora.FRA.dg)
START_TIMEOUT=600
STATE_CHANGE_TEMPLATE=
STOP_DEPENDENCIES=hard(intermediate:ora.asm,shutdown:ora.DATA_DG.dg,shutdown:ora.FRA.dg)
STOP_TIMEOUT=600
TYPE_VERSION=3.2
UPTIME_THRESHOLD=1h
USR_ORA_DB_NAME=
USR_ORA_DOMAIN=
USR_ORA_ENV=
USR_ORA_FLAGS=
USR_ORA_INST_NAME=
USR_ORA_INST_NAME@SERVERNAME(rhel11grac1)=sgculdb1
USR_ORA_INST_NAME@SERVERNAME(rhel11grac2)=sgculdb2
USR_ORA_OPEN_MODE=open
USR_ORA_OPI=false
USR_ORA_STOP_MODE=immediate
VERSION=11.2.0.3.0



Resource Dependencies (Start dependencies):-


Each resources will be having a dependencies. For the above database from the properties we could see that below
dependenices has been defined.

START_DEPENDENCIES=weak(type:ora.listener.type,global:type:ora.scan_listener.type,uniform:ora.ons,global:ora.gns) hard(ora.DATA_DG.dg,ora.FRA.dg) pullup(ora.DATA_DG.dg,ora.FRA.dg)



Pullup -->  This defines that whenever we are starting an resource it automatically starts another resource. This will effect whenever the resource which has to
   started automatically is not running.



Eg:-


For the database sgculdb we could see that the pullup dependencies is defined as  pullup(ora.DATA_DG.dg,ora.FRA.dg) , which means whenever the database sgculdb
is started it will start Data_dg and Fra diskgrop automatically if these diskgroups are not running.


Lets test this.


[oracle@rhel11grac1 dbs]$ srvctl stop database -d sgculdb

[oracle@rhel11grac1 dbs]$ srvctl status database -d sgculdb
Instance sgculdb1 is not running on node rhel11grac1
Instance sgculdb2 is not running on node rhel11grac2


[grid@rhel11grac1 oraagent_oracle]$ srvctl status diskgroup -g data_dg
Disk Group data_dg is running on rhel11grac2,rhel11grac1

[grid@rhel11grac1 oraagent_oracle]$ srvctl status diskgroup -g fra
Disk Group fra is running on rhel11grac2,rhel11grac1

[grid@rhel11grac1 oraagent_oracle]$ srvctl stop diskgroup -g data_dg

[grid@rhel11grac1 oraagent_oracle]$ srvctl stop diskgroup -g fra

[grid@rhel11grac1 oraagent_oracle]$ srvctl status diskgroup -g data_dg
Disk Group data_dg is not running

[grid@rhel11grac1 oraagent_oracle]$ srvctl status diskgroup -g fra
Disk Group fra is not running



-- We have stoped the database and the diskgroups.


Lets start the database without starting the diskgroups. Since the database has pullup dependency on data_dg and fra diskgroup
it should automatically start when the db is started.


[oracle@rhel11grac1 dbs]$ srvctl start database -d sgculdb

[oracle@rhel11grac1 dbs]$ srvctl status database -d sgculdb
Instance sgculdb1 is running on node rhel11grac1
Instance sgculdb2 is running on node rhel11grac2


[grid@rhel11grac1 oraagent_oracle]$ srvctl status diskgroup -g data_dg
Disk Group data_dg is running on rhel11grac2,rhel11grac1

[grid@rhel11grac1 oraagent_oracle]$ srvctl status diskgroup -g fra
Disk Group fra is running on rhel11grac2,rhel11grac1


-- Diskgroups are started.



Hard Dependency:-  This dependency defines that the resource which specified should be up and running before the start
  of the resource. Here for sgculdb the hard dependency is defined as data_dg and fra, which means
  these diskgroups should be up and running before the start of the database.

   hard(ora.DATA_DG.dg,ora.FRA.dg)

Weak Dependency :- if resource A has a weak start dependency on another resource B then when we attempt to start the resource A will also
attempt to start the resource B if resource B is not running. The result of the attempt to start the resource
B is however of no consequence to the result of starting resource A.


  weak(type:ora.listener.type,global:type:ora.scan_listener.type,uniform:ora.ons,global:ora.gns)

Eg :-    The start of resource sgculdb has a weak start dependencies on ora.listener, ora.scan_listener, ora.ons and ora.gns.


   When we attempt to start sgculdb it will try to start the ora.listener, ora.scan_listener, ora.ons if it is not running,
but if these resources didn't comeup due to any issues it will not affect the start of the database since it is weak dependency.


[oracle@rhel11grac1 dbs]$ srvctl stop instance -d sgculdb -i sgculdb1


[grid@rhel11grac1 oraagent_oracle]$ srvctl status listener -l listener -n rhel11grac1
Listener LISTENER is enabled on node(s): rhel11grac1
Listener LISTENER is running on node(s): rhel11grac1


[grid@rhel11grac1 oraagent_oracle]$ srvctl stop listener -l listener -n rhel11grac1


 
[grid@rhel11grac1 oraagent_oracle]$ srvctl status listener -l listener -n rhel11grac1
Listener LISTENER is enabled on node(s): rhel11grac1
Listener LISTENER is not running on node(s): rhel11grac1


-- Lets start the instance, it has to bring listener as well since it has weak dependency.



[oracle@rhel11grac1 dbs]$ srvctl start instance -d sgculdb -i sgculdb1

[oracle@rhel11grac1 dbs]$ srvctl status instance -d sgculdb -i sgculdb1
Instance sgculdb1 is running on node rhel11grac1

[grid@rhel11grac1 oraagent_oracle]$ srvctl status listener -l listener -n rhel11grac1
Listener LISTENER is enabled on node(s): rhel11grac1
Listener LISTENER is running on node(s): rhel11grac1


-- Listener has been bought up automatically.


Attraction Dependency :- If a resource A has attraction dependency on resource b then crs prefers to place the resource A on the server
in which resource B runs.



Stop dependency.

STOP_DEPENDENCIES=hard(intermediate:ora.asm,shutdown:ora.DATA_DG.dg,shutdown:ora.FRA.dg)


If a resource A has a hard stop dependency on resource B then resource A must be stopped when B stops running.


Eg.  Here the database sgculdb has hard stop dependency on resource DATA_DG and FRA diskgroup, hence the resource sgculdb should be stoped
    running before stoping resource DATA_DG and FRA diskgroup.


If we try to attemp to stop this diskgroup resource then it will trhrow eror if sgculdb is up and running.


[grid@rhel11grac1 oraagent_oracle]$ srvctl stop diskgroup -g fra
PRCR-1065 : Failed to stop resource ora.FRA.dg
CRS-5017: The resource action "ora.FRA.dg stop" encountered the following error:
ORA-15032: not all alterations performed
ORA-15027: active use of diskgroup "FRA" precludes its dismount
. For details refer to "(:CLSN00108:)" in "/u01/grid/product/11.2.0.4/log/rhel11grac2/agent/crsd/oraagent_grid//oraagent_grid.log".

CRS-2675: Stop of 'ora.FRA.dg' on 'rhel11grac2' failed
CRS-5017: The resource action "ora.FRA.dg stop" encountered the following error:
ORA-15032: not all alterations performed
ORA-15027: active use of diskgroup "FRA" precludes its dismount
. For details refer to "(:CLSN00108:)" in "/u01/grid/product/11.2.0.4/log/rhel11grac1/agent/crsd/oraagent_grid//oraagent_grid.log".

CRS-2675: Stop of 'ora.FRA.dg' on 'rhel11grac1' failed