|
原帖由 儿子属羊 于 2006-2-12 10:53 发表 ![]()
TAF测试是RAC测试不可缺少的部分。我这里有一篇ORACLE的文章,希望对你有所帮助!
Quickstart Guide: Setup Transparent Application Failover (TAF)
==============================================================
--------------------------------------------------------------
This quickstart guide is a walk through of a working TAF implementation
which can be used as a building block for more complex TAF configurations.
If a current TAF configuration is failing, use this quickstart guide
as baseline to get to a TAF starting point. Once this configuration works,
continue to build on it with more complex features.
IMPORTANT:
==========
1. Oracle Net Manager does not provide support for
TAF configuration parameters. Manual configuration
of TAF is required.
2. Do not set the GLOBAL_DBNAME parameter in the
SID_LIST_listener section of the listener.ora file.
A statically configured global database name disables
TAF.
3. LOAD_BALANCE and FAILOVER parameters are housed within the
DESCRIPTION section of the tnsnames.ora file
TAF - TAF with Connect Time Failover and Load Balancing
======================================================
In this configuration Oracle Net connects randomly to one of two servers
listed in the TNSNAMES.ORA file. There are two parts to this configuration:
load balancing and TAF. If the connected instance fails, subsequent
operations against the database will cause TAF to reconnect to the other
ADDRESS.
1. Prerequisites:
1. This Quickstart guide is using a "pfile" for clarity. An "spfile" can certainly be used.
2. The two databases involved may have similar or different
instance names. In either case, the two databases should have a common
SERVICE_NAMES value. For this Quickstart guide, 2 different
instances are being used (PROD1 and PROD2), but each instance is using
the same SERVICE_NAMES value (TAF.us.oracle.com)
3. A listener and database configured for instance registration on a
primary node.
4. A listener and database configured for instance registration on a
secondary node.
On both nodes, a LSNRCTL STATUS output should show that the instance
status is READY:
"Instance "PROD1", status READY, has 1 handler(s) for this service..."
5. Two terminal sessions are needed for this test.
TERMINAL #1: needed to work with the primary instance
TERMINAL #2: needed to shutdown the primary instance.
2. In TERMINAL #1, configure the tnsnames.ora file for TAF. The TNSNAMES.ORA
file will be configured to connect to two machines - the primary node and
the secondary node.
Here is the configuration file used to create this quickstart guide:
TNSNAMES.ORA
taf_test=
(description=
(failover=on)
(load_balance=on)
(address=
(protocol=tcp)
(host=hp3)
(port=20020))
(address=
(protocol=tcp)
(host=hp4)
(port=20020))
(connect_data=
(service_name=TAF.us.oracle.com)
(failover_mode=
(type=session)
(method=basic))))
NOTE: Do not proceed until it is known that both ADDRESSes are
tested and proven to be valid.
3. In TERMINAL #1, connect to Oracle using the TAF service name configured
in step 2.
4. Execute this query to show which instance and machine you are connected to:
SQL> select host_name, instance_name from v$instance;
HOST_NAME INSTANCE_NAME
-------------- ---------------
hp4 PROD1
5. Using the second terminal session (TERMINAL #2) logon to the machine
specified in step 4 and shutdown the database:
SQL> shutdown abort
6. In TERMINAL #1, reissue the query from step 4:
SQL> select host_name, instance_name from v$instance;
The result should be the hostname and instance of the alternate instance
and is a good test to know if TAF operated correctly or not.
HOST_NAME INSTANCE_NAME
-------------- ---------------
hp3 PROD2
7. TAF Verification
In TERMINAL #1, issue this TAF query to verify TAF is correctly configured:
select machine, failover_type, failover_method, failed_over, count(*)
from v$session
group by machine, failover_type, failover_method, failed_over;
MACHINE FAILOVER_TYPE FAILOVER_M FAILED_OVER COUNT(*)
--------- ------------- ---------- ----------- --------
hp3 NONE NONE NO 8
hp4 SESSION BASIC YES 1
This shows that the HP4 node is the node that failed over due to a
connection failure. HP3 reports no failover because it is the machine
currently handling the connection - it is not the machine that failed.
Configuration Files Used for this Quickstart Guide:
===================================================
On the machine "HP3"
--------------------
initPROD2.ora contains these additional parameters:
*.service_names='TAF.us.oracle.com'
*.local_listener="(address=(protocol=tcp)(host=hp3)(port=20020))"
LISTENER.ORA
listener=(address=(protocol=tcp)(host=hp3)(port=20020))
On the machine "HP4"
--------------------
initPROD1.ora contains these additional parameters:
*.service_names='TAF.us.oracle.com'
*.local_listener="(address=(protocol=tcp)(host=hp4)(port=20020))"
LISTENER.ORA
listener=(address=(protocol=tcp)(host=hp4)(port=20020))
TNSNAMES.ORA
taf_test=
(description=
(failover=on)
(load_balance=on)
(address=
(protocol=tcp)
(host=hp3)
(port=20020))
(address=
(protocol=tcp)
(host=hp4)
(port=20020))
(connect_data=
(service_name=TAF.us.oracle.com)
(failover_mode=
(type=session)
(method=basic))))
Additional Information
======================
Definitions used in this Quickstart guide
===========================================================================
FAILOVER_MODE Description
Subparameters
---------------------------------------------------------------------------
TYPE SESSION: If a connection is lost, a new session
is automatically created for the user on the
backup. SELECT statements are not recovered.
SELECT: SELECT statements are preserved and
fetches will continue on the backup after the
failure.
NONE: The default setting. An explicit setting
of NONE disables failover.
METHOD BASIC: connections are established at
failover time.
PRECONNECT: Parallel connections are made to the
primary and backup instance providing faster failover.
However, the backup instance must be able to handle
the same connection load as the primary.
==========================================================================
Other Description
Parameters
--------------------------------------------------------------------------
FAILOVER At connect time, instructs Oracle Net to failover to a
different listener if the first listener fails when set
to 'ON'.
LOAD_BALANCE When set to 'ON', instructs Oracle Net to progress through
the list of protocol addresses in a random sequence,
balancing the load on various listeners.
好文章! |
|