RAC Attack - Oracle Cluster Database at Home/Service Failover
Appearance
Prev: Clusterware Testing
Services, Failover and Load Balancing (e)
- Install Instant Client
- Service Failover
- Connection Failover
- Runtime Failover
- Client Load Balancing
- Server Load Balancing
Next: RAC SQL and PLSQL
- 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. collabn1:/home/oracle[RAC1]$ srvctl add service -d RAC -s svctest -r RAC1 -a RAC2 -P BASIC collabn1:/home/oracle[RAC1]$ srvctl start service -d RAC -s svctest
-
Examine where the service is running by checking lsnrctl on both nodes and looking at the SERVICE_NAMES init parameter on both nodes.
You should never directly change the SERVICE_NAMES init parameter on a RAC database!! This parameter is maintained automatically by the clusterware.
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.vm.ardentperf.com" has 1 instance(s). Instance "RAC1", status READY, has 2 handler(s) for this service... Handler(s): "DEDICATED" established:0 refused:0 state:ready REMOTE SERVER (ADDRESS=(PROTOCOL=TCP)(HOST=collabn1.vm.ardentperf.com)(PORT=1521)) "DEDICATED" established:0 refused:0 state:ready LOCAL SERVER collabn1:/home/oracle[RAC1]$ ssh collabn2 Last login: Sun Aug 3 13:13:16 2008 from collabn1 The Oracle base for ORACLE_HOME=/u01/app/oracle/product/11.2.0/db_1 is /u01/app/oracle Set environment by typing 'oenv' - default is instance RAC1. collabn2:/home/oracle[RAC2]$ lsnrctl services collabn2:/home/oracle[RAC2]$ lsnrctl services Service "svctest.vm.ardentperf.com" has 1 instance(s). Instance "RAC1", status READY, has 1 handler(s) for this service... Handler(s): "DEDICATED" established:0 refused:0 state:ready REMOTE SERVER (ADDRESS=(PROTOCOL=TCP)(HOST=collabn1.vm.ardentperf.com)(PORT=1521)) SQL> col value format a60 SQL> select inst_id, value from gv$parameter where NAME='service_names'; INST_ID VALUE ---------- ------------------------------------------------------------ 1 svctest, RAC.vm.ardentperf.com 2 RAC.vm.ardentperf.com
- Use SHUTDOWN ABORT to kill the instance where service svctest is running. SQL> show user USER is "SYS" SQL> select instance_name from v$instance; INSTANCE_NAME ---------------- RAC1 SQL> shutdown abort; ORACLE instance shut down. SQL>
- Wait a few moments and then repeat step 2. What has happened? collabn1:/home/oracle[RAC1]$ srvctl status service -d RAC -s svctest
-
Restart the instance that you killed.
This does not initiate any instance recovery at all. Do you know why?
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]$
- Repeat step 2. Where is the service running now? collabn1:/home/oracle[RAC1]$ srvctl status service -d RAC -s svctest
- Manually failover the service. Confirm where it is now running. Note that this does not disconnect any current sessions 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