时间:2021-07-01 10:21:17 帮助过:8人阅读
In this Document
Purpose |
Scope |
Details |
Concepts & Overview |
Administrator-managed Database |
Basic Method |
Preconnect Method |
Policy-managed Database |
Basic Method |
This article describes Transparent Application Failover (TAF) and provides configuration details for 11gR2(11.2) cluster database.
This article is intended for Oracle Cluster Administrators who would like more details about TAF. Basic understanding of Oracle Clusterware Database is assumed.
TAF allows Oracle clients to reconnect to a surviving instance in the event of a failure of the instance to which it is connected. There are two types of TAF available, SESSION and SELECT.
SESSION: Session Failover re-creates the connections and sessions to the surviving instance.
SELECT: In addition to recreating the session, Select Failover also replays the queries that were in progress.
There are two methods in which TAF estabilishes the failover connection, BASIC and PRECONNECT.
BASIC: The second connection is re-established only after the first connection to the instance failed.
PRECONNECT: Two connections are established when the client logs in to the database. A login to database will create two connection at the same time. For this to work, clusterware actually starts two services. One main service and another shadow
service.
TAF can be configured at the Oracle Client side in tnsnames.ora or at the Database Server side using the SRVCTL utility. Configuring it at the server is preferred as it is convenient to put the configuration in one place i.e. on the server. This article covers
the configuration at the server using SRVCTL. TAF configuration is associated with the database service.
1. Create the service with SRVCTL
SRVCTL defines services in OCR which is accessible across nodes. The service configuration details can be viewed with the SRVCTL config service command.
2. Start the Service with SRVCTL
When the service is started with SRVCTL, it actually creates a service in the database. The service name and the configuration details of the service created at the database can be viewed with DBA_SERVICES view. Then the SERVICE_NAMES database parameter is
set, which allows PMON to register this service with the listener. Once the new service is registered, remote client connections can established through the listener.
Let‘s have a look at the srvctl syntax for creating service. Databases in 11gR2 can be Administrator-managed or Policy-managed. Certain options can be used only with certain type of database.
Here is the description of the options that we are going to use in configuring TAF.
-r "<preferred_list>" [-a "<available_list>"] [-P {BASIC | NONE | PRECONNECT}]
This clause is valid only for Administrator-managed database which support PRECONNECT method.
-g <server_pool> [-c {UNIFORM | SINGLETON}]
This clause is valid only for Policy-managed database where in PRECONNECT method is not available.
The above two options instruct clusterware on how to handle this service.
[-e {NONE|SESSION|SELECT}]
This defines the type of TAF whether SESSION or SELECT.
[-m {NONE|BASIC}]
This defines the method of TAF.
[-z <failover_retries>]
This defines the the number of times to attempt to connect after a failover.
[-w <failover_delay>]
This defines the amount of time in seconds to wait between connect attempts.
Above four options are passed to database while starting up the service and is viewable in DBA_SERVICES view.
1. Create Service
Syntax:
srvctl add service -d <db_unique_name> -s <service_name>
-r "<preferred_list>" [-a "<available_list>"] [-P {BASIC | NONE | PRECONNECT}]
[-e {NONE|SESSION|SELECT}]
[-m {NONE|BASIC}]
[-z <failover_retries>]
[-w <failover_delay>]
Example:
$ srvctl add service -d db112 -s mysrvb
-r db1121,db1122 -P basic -e select -m
basic -z 10 -w 2
2. Start the service
$ srvctl start service -d db112 -s mysrvb
Check if the service is registered with the listener.
3. Make a connection.
The client connect string does not require any special TAF parameters. A simple tnsnames.ora entry as shown below will do.
Note: Please be aware that pre-11gR2 clients are not fully compatible with SCAN and require a special TNS connect string. See the following Oracle Documentation: http://www.oracle.com/technetwork/database/clustering/overview/scan-129069.pdf
$ sqlplus scott/tiger@mysrvb
Once connected GV$SESSION view will reflect the connection made is TAF enabled. The FAILOVER_METHOD and FAILOVER_TYPE column reflects it and this confirms the TAF configuration is correct.
Note that this client has connected to the instance 1 with BASIC method and SELECT type.
1. Create service
Syntax:
srvctl add service -d <db_unique_name> -s <service_name>
-r "<preferred_list>" [-a "<available_list>"] [-P {BASIC | NONE | PRECONNECT}]
[-e {NONE|SESSION|SELECT}]
[-m {NONE|BASIC}]
Example:
$ srvctl add service -d db112 -s mysrv
-r db1121 -a db1122 -P preconnect
2. Start the service.
$ srvctl start service -d db112 -s mysrv
Preconnect creates an additional shadow service.
Note that the service ‘mysrv‘ is started on the preferred instance. And the shadow service
‘mysrv_preconnect‘ is started on the available instance. The shadow service is always defined as
<servicename>_preconnect.
Check if the service is correctly registered with the listener.
3. Define TNS entry.
Preconnect requires special parameters at the client side tnsnames.ora file. The TAF Type and the TAF method is actually specified at the client end.
Connect to the database with this tns entry
$sqlplus scott/tiger@mysrv
Note that the client has made two connections. The first one is the active main connection with PRECONNECT method and SELECT type. The second one is the shadow connection that will be used if the connection to the first instance fails.
1. Create the service
Syntax:
srvctl add service -d <db_unique_name> -s <service_name>
-g <server_pool> [-c {UNIFORM | SINGLETON}]
[-e {NONE|SESSION|SELECT}]
[-m {NONE|BASIC}]
[-z <failover_retries>]
[-w <failover_delay>]
Example:
$ srvctl add service -d db1 -s mysrvp
-g mysrvpool -c uniform -e select -m basic
-z 10 -w 2
2. Start the service
$ srvctl start service -d db1 -s mysrvp
Check if the service is correctly registered with the listener
3. Make a connection.
The client connect string does not require any special TAF parameters. A simple tnsnames.ora entry as shown below will do.
$ sqlplus scott/tiger@mysrvp
11gR2(11.2) RAC TAF Configuration for Admin and Policy Managed Databases (文档 ID 1312749.1)
标签:shadow cluster pre oop string rem -- ram cond