Thursday, 6 June 2019

Configure TAF Basic Configuration on Client-side


Configure TAF Basic Configuration on Client-side


As per below command FAILOVER_METHOD is none \


SQL> select failover_method from dba_services where name='rac';

FAILOVER_METHOD
----------------------------------------------------------------


Add value below on TNSNAMES.ORA file

ctaf =
 (DESCRIPTION =(FAILOVER=ON) (LOAD_BALANCE=ON)
    (ADDRESS=(PROTOCOL=TCP)(HOST=192.168.56.81)(PORT=1531))
    (ADDRESS=(PROTOCOL=TCP)(HOST=192.168.56.82)(PORT=1531))
  (CONNECT_DATA =
  (SERVICE_NAME = rac)
  (FAILOVER_MODE = (TYPE=select)
  (METHOD= basic )
  (RETRIES=10)
  (DELAY=10)))
  )

C:\Users\varunyadav>sqlplus sys/system123@ctaf as sysdba

SQL*Plus: Release 12.1.0.2.0 Production on Wed Jun 5 18:00:58 2019

Copyright (c) 1982, 2014, Oracle.  All rights reserved.


Connected to:
Oracle Database 12c Enterprise Edition Release 12.1.0.2.0 - 64bit Production
With the Partitioning, Real Application Clusters, Automatic Storage Management, OLAP,
Advanced Analytics and Real Application Testing options

SQL> SELECT INSTANCE_NAME FROM V$INSTANCE;

INSTANCE_NAME
----------------
rac1

SQL> col username format a10
SQL> col service_name format a20
SQL> SELECT INST_ID, USERNAME, SERVICE_NAME, FAILOVER_TYPE, FAILOVER_METHOD, FAILED_OVER FROM GV$SESSION;

   INST_ID USERNAME   SERVICE_NAME         FAILOVER_TYPE FAILOVER_M FAI
---------- ---------- -------------------- ------------- ---------- ---
        
         2 SYS        rac                            SELECT        BASIC      NO



BEFORE KILL SID

SQL> SELECT SYS_CONTEXT('USERENV','INSTANCE_NAME') FROM DUAL;

SYS_CONTEXT('USERENV','INSTANCE_NAME')
--------------------------------------------------------------------------------
rac1


Example  for testing
SQL>
SELECT A.OBJECT_NAME FROM ALL_OBJECTS A UNION ALL SELECT B.OBJECT_NAME FROM ALL_OBJECTS B;




In the admin window, crash rac1 instance. 

pkill -9 -f ora_pmon_rac1


AFTER  KILL SID

SQL> SELECT SYS_CONTEXT('USERENV','INSTANCE_NAME') FROM DUAL;

SYS_CONTEXT('USERENV','INSTANCE_NAME')
--------------------------------------------------------------------------------
rac2

SQL>



SQL> col username format a10
SQL> col service_name format a20
SQL> SELECT INST_ID, USERNAME, SERVICE_NAME, FAILOVER_TYPE, FAILOVER_METHOD, FAILED_OVER FROM GV$SESSION;

   INST_ID USERNAME   SERVICE_NAME         FAILOVER_TYPE FAILOVER_M FAI
---------- ---------- -------------------- ------------- ---------- ---
     
         2 SYS        rac                  SELECT        BASIC      YES

No comments:

Post a Comment