First, you connect to the cluster via racsvc and find out the node and instance
that you are connected to:
SQL> connect rjb/rjb@racsvc;
Connected.
SQL> select instance_name, host_name, failover_type,
2 failover_method, failed_over
3 from v$instance
4 cross join
5 (select failover_type, failover_method, failed_over
6 from v$session
7 where username = 'RJB');
INSTANCE_NAME HOST_NAME FAILOVER_TYPE FAILOVER_METHOD FAILED_OVER
------------- --------- ------------- --------------- -----------
rac1 oc1 SELECT BASIC NO
SQL>
You are using the columns from V$INSTANCE to give you the instance name and host name
that you are connected to and then joining this to V$SESSION and retrieving the columns related
to failover, which are only populated in a RAC environment. In this case, the session has not yet
failed over, and the failover type is BASIC, as I specified when I created the service.
Next, you will shut down instance rac1 from another session while you are still connected to
the first session:
SQL> connect system/manager@rac1
Connected.
SQL> shutdown immediate
Database closed.
Database dismounted.
ORACLE instance shut down.
SQL>
Back at your user session, you rerun the query to find out what node you are connected to:
SQL> select instance_name, host_name, failover_type,
2 failover_method, failed_over
3 from v$instance
4 cross join
5 (select failover_type, failover_method, failed_over
Chapter 10: Real Application Clusters 385
6 from v$session
7 where username = 'RJB');
INSTANCE_NAME HOST_NAME FAILOVER_TYPE FAILOVER_METHOD FAILED_OVER
------------- --------- ------------- --------------- -----------
rac3 oc3 SELECT BASIC YES
SQL>
If you were running a query at the time the instance was shut down, your query would pause
for a second or two and then continue as if nothing happened.
Pages:
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604