User`s guide

Chapter 7: Configuration 87
A client needs a connect descriptor in order to connect to an Oracle instance. The
tnsnames.ora file can define more than one database so that a backup database
can be used in a fail situation. Oracle uses the normal TCP communication
between the clients and the database.
Local database: <SID>
Remote database: <hostname>/<SID>
Remote database: <hostname>/Service name
The example below uses two hosts. These settings are needed if the database
server is set up with a standard Oracle failover mechanism. When failing over a
standby solution (not Data Guard) both servers will for a short period of time be
unavailable. To avoid disconnect problems on clients a configuration is needed to
make sure clients try to reconnect long enough to get reconnected. This can be
accomplished with a connect descriptor as shown below.
Note: Always check with the current Oracle documentation for current
recommendations regarding failover setups.
Example of a
tnsnames.ora
file for a standby failover setup:
# Generated by Oracle configuration tools.
VIZRTDB =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = SomeHost1)(PORT = 1521))
(ADDRESS = (PROTOCOL = TCP)(HOST = SomeHost2)(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = SomeName)
(FAILOVER_MODE =
(TYPE = SESSION)
(METHOD = BASIC)
(RETRIES = 180)
(DELAY = 5)
)))
Host: Preferably host, or an IP address
Service name: Database service name (e.g. VIZRTDB.tvchannel.place)
The ADDRESS_LIST property lists the server addresses. When a server is in
standby mode the database is not open and does not register the service name
with the listener. This means that if the client tries to connect to the standby
server it will be rejected and try the other server instead.
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = SomeHost1)(PORT = 1521))
(ADDRESS = (PROTOCOL = TCP)(HOST = SomeHost2)(PORT = 1521))
)
The FAILOVER_MODE property tells the Oracle client to fail over the session and
ignore any currently open cursors. The sub-parameters say that it will use basic
failover (not preconnect) and at failover time will retry 180 times waiting 5
seconds between each retry (15 minutes). This should be enough time for the
switch to happen.
(FAILOVER_MODE =
(TYPE = SESSION) (METHOD = BASIC) (RETRIES = 180) (DELAY = 5)