RAC Attack - Oracle Cluster Database at Home/RAC Attack 12c/Service Failover

From Wikibooks, open books for an open world
< RAC Attack - Oracle Cluster Database at Home‎ | RAC Attack 12c
Jump to navigation Jump to search


  1. Login to collabn1 as the oracle user. Create a new service svctest with RAC1 as a preferred instance and RAC2 as an available instance. This means that it will normally run on the RAC1 instance but will failover to the RAC2 instance if RAC1 becomes unavailable.
  2. If you haven't created a container database, omit the -pdb parameter. collabn1:/home/oracle[RAC1]$ srvctl add service -d RAC -pdb PDB -s svctest -r RAC1 -a RAC2 -P BASIC collabn1:/home/oracle[RAC1]$ srvctl start service -d RAC -s svctest
  3. Examine where the service is running by checking lsnrctl on both nodes and looking at the SERVICE_NAMES init parameter on both nodes.
  4. collabn1:/home/oracle[RAC1]$ srvctl status service -d RAC -s svctest Service svctest is running on instance(s) RAC1 collabn1:/home/oracle[RAC1]$ lsnrctl services ... Service "svctest.racattack" has 1 instance(s). Instance "RAC1", status READY, has 1 handler(s) for this service... Handler(s): "DEDICATED" established:1 refused:0 state:ready LOCAL SERVER collabn2:/home/oracle[RAC2]$ lsnrctl services SQL> col value format a60 SQL> SQL> select name, pdb, inst_id from gv$services; NAME PDB INST_ID ---------------------------------- ------------------------------ ---------- svctest PDB 1 pdb.racattack PDB 1 pdb.racattack PDB 2
  5. Use SHUTDOWN ABORT to kill the instance where service svctest is running.
  6. SQL> show user USER is "SYS" SQL> select instance_name from v$instance; INSTANCE_NAME ---------------- RAC1 SQL> shutdown abort; ORACLE instance shut down. SQL>
  7. Wait a few moments and then repeat step 2. What has happened?
  8. collabn1:/home/oracle[RAC1]$ srvctl status service -d RAC -s svctest
  9. Restart the instance that you killed.
  10. collabn1:/home/oracle[RAC1]$ srvctl status database -d RAC
    Instance RAC1 is not running on node collabn1
    Instance RAC2 is running on node collabn2
    collabn1:/home/oracle[RAC1]$ srvctl start instance -d RAC -i RAC1
    collabn1:/home/oracle[RAC1]$ srvctl status database -d RAC
    Instance RAC1 is running on node collabn1
    Instance RAC2 is running on node collabn2
    collabn1:/home/oracle[RAC1]$
    
  11. Repeat step 2. Where is the service running now?
  12. collabn1:/home/oracle[RAC1]$ srvctl status service -d RAC -s svctest
  13. Manually failover the service. Confirm where it is now running. Note that this does not disconnect any current sessions
  14. collabn1:/home/oracle[RAC1]$ srvctl relocate service -d RAC -s svctest -i RAC2 -t RAC1 collabn1:/home/oracle[RAC1]$ srvctl status service -d RAC -s svctest