Configuring Oracle Net Services
For Transparent Application Failover, you must configure Oracle Net Services by editing the tnsnames.ora and sqlnet.ora files on the Oracle database server.
Procedure
Example
The information in the following files is an example of how you can configure Transparent
Application
Failover:sqlnet.ora:
SQLNET.AUTHENTICATION_SERVICES= (NONE)
NAMES.DIRECTORY_PATH= (TNSNAMES)
tnsnames.ora:
PRODONE =
(DESCRIPTION_LIST =
(FAILOVER = true)
(LOAD_BALANCE = false)
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = YourFirstHost)(PORT = 1521))
)
(CONNECT_DATA =
(SERVER = dedicated)
(FAILOVER_MODE =
(BACKUP = PRODTWO)
(TYPE = select)
(METHOD = basic)
(RETRIES = 20)
(DELAY = 3)
)
(SERVICE_NAME = ORCL)
)
)
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = YourSecondHost)(PORT = 1521))
)
(CONNECT_DATA =
(SERVICE_NAME = ORCL)
)
)
)
PRODTWO =
(DESCRIPTION_LIST =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = YourSecondHost)(PORT = 1521))
)
(CONNECT_DATA =
(SERVICE_NAME = ORCL)
)
)
)
Note:
- When you use Transparent Application Failover, if the connected instance fails or is shutdown, the adapter can automatically reconnect to a database. Transparent Application Failover enables the application to transparently reconnect to a specified secondary instance. This reconnection process creates a new connection that is identical to the original connection.
- In the tnsnames.ora file, PRODONE is the example net service alias that defines both Transparent Application Failover and Connect Time Failover (CTF). The first description in the DESCRIPTION_LIST defines Transparent Application Failover. The second description in the DESCRIPTION_LIST defines Connect Time Failover.
- The Transparent Application Failover description indicates that if an established connection to YourFirstHost fails, then the connection fails over to YourSecondHost via the PRODTWO net service alias. The Connect Time Failover description indicates that if YourFirstHost is down before the initial connection, then the connection fails over to YourSecondHost.
- The select type is a feature of Transparent Application Failover. Use select to indicate that if the first connection fails while it is processing a SELECT statement, then the statement runs again when a new connection is established. The cursor moves to the correct position so the client can continue fetching rows without interruption.