Thursday, 6 June 2019

Configure TAF PRECONNECT Configuration on Client-side

 Configure TAF PRECONNECT Configuration on Client-side

tnsnames.ora

prectaf1 =
 (DESCRIPTION=
   (ADDRESS=(PROTOCOL=tcp)(HOST=192.168.56.81)(PORT=1531))
   (CONNECT_DATA=
        (SERVICE_NAME=rac)
        (FAILOVER_MODE=
               (BACKUP=prectaf2)
               (TYPE=select)
               (METHOD=preconnect)))
  )

prectaf2 =
 (DESCRIPTION=
   (ADDRESS=(PROTOCOL=tcp)(HOST=192.168.56.82)(PORT=1531))
   (CONNECT_DATA=
        (SERVICE_NAME=rac)
        (FAILOVER_MODE=
               (BACKUP=prectaf1)
               (TYPE=select)
               (METHOD=preconnect)))
  )


col username format a10 
col service_name format a20 
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
---------- ---------- -------------------- ------------- ---------- ---
         1 SYS        rac                  SELECT        PRECONNECT NO


C:\Users\varunyadav>tnsping prectaf1

TNS Ping Utility for 64-bit Windows: Version 12.1.0.2.0 - Production on 05-JUN-2019 20:05:38

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

Used parameter files:
C:\app\client\varunyadav\product\12.1.0\client_1\network\admin\sqlnet.ora


Used TNSNAMES adapter to resolve the alias
Attempting to contact (DESCRIPTION= (ADDRESS=(PROTOCOL=tcp)(HOST=192.168.56.81)(PORT=1531)) (CONNECT_DATA= (SERVICE_NAME=rac) (FAILOVER_MODE= (BACKUP=prectaf2) (TYPE=select) (METHOD=preconnect))))
OK (0 msec)

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

SQL*Plus: Release 12.1.0.2.0 Production on Wed Jun 5 20:04:36 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 SYS_CONTEXT('USERENV','INSTANCE_NAME') FROM DUAL;

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

SQL>col username format a10 
col service_name format a20 
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
---------- ---------- -------------------- ------------- ---------- ---
         1 SYS        rac                  SELECT        PRECONNECT NO

SELECT A.OBJECT_NAME FROM ALL_OBJECTS A UNION ALL SELECT B.OBJECT_NAME FROM ALL_OBJECTS B;

[oracle@srv1 ~]$ pkill -9 -f ora_pmon_rac1

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

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

SQL>


[oracle@srv1 ~]$ sqlplus / as sysdba

SQL*Plus: Release 12.1.0.2.0 Production on Wed Jun 5 20:10:28 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 SYS_CONTEXT('USERENV','INSTANCE_NAME') FROM DUAL;

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

col username format a10 
col service_name format a20 
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        PRECONNECT YES

No comments:

Post a Comment