Database Reference
In-Depth Information
The following connect string is a simple example of TAF using a SCAN listener. With this connection string,
the application connects to a SCAN listener listening in port 12099. Notice that the failover_mode parameter
specifies the type as SESSION, indicating session failover mode. If the connection is severed, then the client will
retry the connection to the SCAN listener again. The SCAN listener will redirect the connection to the VIP listener of
a surviving node.
PO_TAF =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)
(HOST = rac-scan.example.com ) (PORT = 12099))
(CONNECT_DATA =
(SERVICE_NAME = PO)
(FAILOVER_MODE= (TYPE=SESSION) (METHOD=basic))
)
)
Dynamic-view v$session can be queried to verify if TAF is configured properly or not. The preceding connect
string shows that session level failover is enabled for the current connection. Killing the connection resulted in
respawning of a new connection, confirming that TAF is working as designed.
SQL> select sid, FAILOVER_TYPE, FAILOVER_METHOD, failed_over
from v$session where
sid =(select sid from v$mystat where rownum =1);
SID FAILOVER_TYPE FAILOVER_M FAI
---------- ------------- ---------- ---
8227 SESSION BASIC YES
While it is possible to set up TAF with a client connection string, TAF can be implemented more elegantly using
service attributes. The advantage of implementing TAF using service attributes is that configuration changes can be
performed on the database server side without altering the client-side connect string. The following srvctl command
shows that SESSION failover type is added to po service. Option -z specifies failover retry attempts, and the -w option
specifies delay between failover attempts. In this example, connection will be attempted five times with 60-second
delays between successive attempts.
$ srvctl add service -d orcl12 -s po -r oel6vm1 -a oel6vm2 \
-m BASIC -e SESSION -z 5 -w 60
In version 12c, adding a service requires a different syntax, and options are specified more verbally. The earlier
command is written in version 12c as follows.
$ srvctl add service -db orcl12 -service po \
-preferred oel6vm1 -available oel6vm2 \
-tafpolicy BASIC -failovermethod SESSION \
-failoverretry 5 -failoverdelay 60
It is a better practice to keep the connection string as simple as possible and modify configuration of services to
implement TAF. This strategy simplifies connection string management in an enterprise database setup.
Further, it is best to implement TAF while creating services so that you can improve availability.
 
Search WWH ::




Custom Search