|
The following is a list of several examples of TAF configurations:
·
Connect-Time Failover with Client Load Balancing
·
Retry of connections
·
Pre-established failover connections
TAF with Connect-Time Failover and Client Load Balancing
To implement TAF with connect-time failover and client load balancing for
multiple addresses, configure the tnsnames.orafiles as shown below. Oracle Net connects randomly to
one of the protocol addresses on aultlinux1 or aultlinux2. If the instance
were to fail after the connection, the TAF application fails over to the
other node's listener, reissuing any select statements in flight.
ault=
(DESCRIPTION=
(LOAD_BALANCE=on)
(FAILOVER=on)
(ADDRESS=
(PROTOCOL=tcp)
(HOST=aultlinux1)
(PORT=1521))
(ADDRESS=
(PROTOCOL=tcp)
(HOST=aultlinux2)
(PORT=1521))
(CONNECT_DATA=
(SERVICE_NAME=ault)
(FAILOVER_MODE=
(TYPE=select)
(METHOD=basic))))
Configuring TAF to Retry a Connection
With a proper configuration, TAF will automatically retry connecting if the
first connection attempt fails. The
tnsnames.orafile is configured with the retries and delay
parameters. In the example shown below, Oracle Net tries to reconnect to the
listener on the aultlinux1 server. If the failover connection fails, Oracle
Net waits 10 seconds before trying to reconnect again. Using this
tnsnames.ora file Oracle Net attempts
to reconnect up to 10 times.
ault=
(DESCRIPTION=
(ADDRESS=
(PROTOCOL=tcp)
(HOST=aultlinux1)
(PORT=1521))
(CONNECT_DATA=
(SERVICE_NAME=ault)
(FAILOVER_MODE=
(TYPE=select)
(METHOD=basic)
(RETRIES=10)
(DELAY=10))))
TAF can be configured to create pre-established connections to a second
instance. The initial and backup connections are explicitly specified. In
the example below, clients that use net service name ault1 to connect to the
listener on aultlinux1 are also pre-connected to aultlinux2. If the
aultlinux1 fails after the connection, Oracle Net automatically fails over
to aultlinux2, reissuing any select statements in progress. In this
reciprocal setup, Oracle Net pre-connects to aultlinux1 for those clients
that use ault2 to connect to the listener on aultlinux2.
ault1 =
(DESCRIPTION=
(ADDRESS=
(PROTOCOL=tcp)
(HOST=aultlinux1)
(PORT=1521))
(CONNECT_DATA=
(SERVICE_NAME=ault)
(INSTANCE_NAME=ault1)
(FAILOVER_MODE=
(BACKUP=ault2)
(TYPE=select)
(METHOD=preconnect))))
ault2=
(DESCRIPTION=
(ADDRESS=
(PROTOCOL=tcp)
(HOST=ault2)
(PORT=1521))
(CONNECT_DATA=
(SERVICE_NAME=ault)
(INSTANCE_NAME=ault2)
(FAILOVER_MODE=
(BACKUP=ault1)
(TYPE=select)
(METHOD=preconnect))))
The v$sessionview contains the
failover_type, failover_method,
and failed_over columns. These
columns are used to monitor connected clients and the TAF status. An example
select against this view is shown below.
SELECT MACHINE, FAILOVER_TYPE, FAILOVER_METHOD, FAILED_OVER, COUNT(*)
FROM V$SESSION
GROUP BY MACHINE, FAILOVER_TYPE, FAILOVER_METHOD, FAILED_OVER;
The output before failover of the aultlinux1 server resembles the following:
MACHINE FAILOVER_TYPE FAILOVER_M FAI COUNT(*)
-------------- ------------- ---------- --- ----------
aultlinux1 NONE NONE NO 11
aultlinux2 select PRECONNECT NO 1
The output after a failover from the aultlinux1 server is:
MACHINE FAILOVER_TYPE FAILOVER_M FAI COUNT(*)
---------------- ------------- ---------- --- --------
aultlinux2 NONE NONE NO 10
aultlinux2 select PRECONNECT YES 1
 |
If you like Oracle tuning, check out my latest book
"Oracle
Tuning: The Definitive Reference".
It's 980 pages of hard-core tuning insights, tips and
scripts, and you can buy it direct from the publisher for 30%-off. |
|