In this Document
|
Administrator-managed Database |
Applies to:oracle database-enterprise edition-version 11.2.0.1 to 11.2.0.3 [Release 11.2]
Oracle Net services-version 11.2.0.1 to 11.2.0.3 [Release 11.2]
Information in this document applies to any platform.
Purpose
This article describes Transparent application Failover (TAF) and provides configuration details for 11gR2 (11.2) Cluster D Atabase.
Scope
This article was intended for the Oracle Cluster Administrators who would as more details about TAF. Basic understanding of Oracle Clusterware Database is assumed.
Details
Concepts & Overview
TAF allows Oracle clients to reconnect-a surviving instance in the event of a failure of the instance-which it is CO Nnected. There is 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 of were in progress.
There is 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:Connections is established when the client is logs in to the database. A Login to database would create the connection at the same time. For the to work, Clusterware actually starts the services. One main service and another shadow service.
TAF can configured at the Oracle Client side in Tnsnames.ora or at the Database Server side using the SRVCTL utility. Configuring it is preferred as it's convenient to put the "configuration in one" place i.e. the server. This article covers the configuration at the server using SRVCTL. TAF configuration is a associated with the database service.
1.Create the service with SRVCTL
SRVCTL defines services in OCR which are 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 was 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 is viewed with dba_services view . Then the Service_names database parameter are 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.
Note:
The Clusterware automatically starts/stops and manages the services in the database according to the configuration of the Service. Manually setting the Service_names parameter in RAC are not allowed as Clusterware manages setting this parameter.
Let ' s has a look at the srvctl syntax for creating service. Databases in 11gR2 can is administrator-managed or policy-managed. Certain options can used only with Certain type of database.
Srvctl Add service-d <db_unique_name>-S <service_name>
-R "<preferred_list>" [-A "<available_list>"] [-p {BASIC | NONE | Preconnect}]
-G <server_pool> [-C {UNIFORM | SINGLETON}]
[-K <net_num>]
[-L [Primary][,physical_standby][,logical_standby][,snapshot_standby]]
[-y {AUTOMATIC | MANUAL}]
[-Q {true| FALSE}]
[-X {true| FALSE}]
[-j {short| LONG}]
[-B {none| service_time| Throughput}]
[-E {none| session| SELECT}]
[-M {none| BASIC}]
[-Z <failover_retries>]
[-w <failover_delay>]
This is the description of the options, we are going to use in configuring TAF.
- R "<preferred_list>" [-A "<available_list>"] [-p {BASIC | NONE | Preconnect}]
This clause is validOnly for administrator-managed databaseWhich support Preconnect method.
- g <server_pool> [-C {UNIFORM | SINGLETON}]
This clause is validOnly for policy-managed databaseThe Where in Preconnect method is not available.
The above-the-instruct Clusterware on the 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 number of times to attempt to connect after a failover.
[-w <failover_delay>]
This defines the amount for time in seconds to wait between connect attempts.
Above four options was passed to database while starting up the service and was viewable in Dba_services view.
administrator-managed Database
Basic Method
1. Create Service
Syntax:
SRVCTL Add service-d <db_unique_name>-S <service_name>
& nbsp; -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 ten -W 2
Though This example only uses-r option, you can use both-r and-a option.
2. Start the Service
$ srvctl start service-d db112- s mysrvb
Check If the service is registered with the listener.
$lsnrctl Status Listener_scan1
. . .
. . .
Service "MYSRVB" has 2 instance (s).
Instance "db1121", status ready, have 1 handler (s) for the This service ...
Instance "db1122", status ready, have 1 handler (s) for the This service ...
. . .
. . .
3. make a connection.
The client connect string does not require any special TAF parameters. A simple Tnsnames.ora Entry as shown below would do.
MYSRVB =
(Description =
(address = (PROTOCOL=TCP) (Host=secrac-scan) (port=1521))
(Connect_data=
(SERVICE_NAME=MYSRVB)
)
)
Note:please is aware that
PRE-11GR2Clients is 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 would reflect the connection made is TAF enabled. The Failover_method and Failover_type column reflects it and this confirms the TAF configuration are correct.
Sql> Select Inst_id,username,service_name,failover_type,failover_method,failed_over from Gv$session where Username= ' SCOTT ';
inst_id USERNAME service_name failover_type failover_m FAI
------- -------- ------------ ------------- ---------- ---
1 SCOTT mysrvb SELECT BASIC NO
Note that this client has connected to the instance 1 with BASIC method and SELECT type.
preconnect Method
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
Note:
* the-e,-m option should is set to none. Omitting this option actually sets it to none.
* Use both-r and-a option for Preconnect so a shadow service would be started.
2. Start the service.
$ srvctl start service-d db112- s mysrv
Preconnect creates an additional shadow service.
$
crsctl Stat res-t
. . .
. . .
Ora.db112.mysrv.svc
1 Online Online Secrac1
Ora.db112.mysrv_preconnect.svc
1 Online Online SECRAC3
. . .
. . .
Note that the service ' Mysrv ' was 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.
The Check if the service is correctly registered with the listener.
$ LSNRCTL Status Listener_scan1
. . .
. . .
Service "Mysrv" has 1 instance (s).
Instance "db1121", status ready, have 1 handler (s) for the This service ...
Service "Mysrv_preconnect" has 1 instance (s).
Instance "db1122", status ready, have 1 handler (s) for the This service ...
. . .
. . .
3. Define TNS entry.
Preconnect requires special parameters at the client side Tnsnames.ora file. The TAF Type and the TAF method are actually specified at the client end.
Mysrv =
(Description =
(address = (PROTOCOL=TCP) (Host=secrac-scan) (port=1521))
(Connect_data=
(SERVICE_NAME=MYSRV)
(failover_mode=
(Backup=mysrv_preconnect)
(Type=select)
(Method=preconnect)
)
)
)
Mysrv_preconnect =
(Description =
(address = (PROTOCOL=TCP) (Host=secrac-scan) (port=1521))
(Connect_data= (Service_name=mysrv_preconnect))
)
Connect to the database with this TNS entry
$sqlplus scott/tiger@mysrv
Sql> Select Inst_id,username,service_name,failover_type,failover_method,failed_over from Gv$session where Username= ' SCOTT ';
inst_id USERNAME service_name failover_type failover_m FAI
------- -------- ---------------- ------------- ---------- ---
1 SCOTT mysrv SELECT preconnect NO
2 SCOTT mysrv_preconnect None None NO
Note that the client has made and connections. The first one is the active main connection with Preconnect method and SELECT type. The second one is the shadow connection and that'll be used if the connection to the first instance fails.
policy-managed Database
Basic Method
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-dDb1- SMysrvp- GMysrvpool- CUniform- eSelect- MBasic- Z10- W2
2.Start the Service
$srvctl start service-dDb1- SMysrvp
Check if the service is correctly registered with the listener
$ LSNRCTL Status Listener_scan1
. . .
. . .
Service "MYSRVP" has 2 instance (s).
Instance "Db1_1", status ready, have 1 handler (s) for the This service ...
Instance "Db1_2", status ready, have 1 handler (s) for the This service ...
. . .
. . .
3. make a connection.
The client connect string does not require any special TAF parameters. A simple Tnsnames.ora Entry as shown below would do.
MYSRVP =
(Description =
(address = (PROTOCOL=TCP) (Host=secrac-scan) (port=1521))
(Connect_data=
(SERVICE_NAME=MYSRVP)
)
)
$ sqlplus scott/tiger@mysrvp
Sql> Select Inst_id,username,service_name,failover_type,failover_method,failed_over from Gv$session where Username= ' SCOTT ';
inst_id USERNAME service_name failover_type failover_m FAI
------- -------- ------------ ------------- ---------- ---
1 SCOTT MYSRVP SELECT BASIC NO
11gR2 (11.2) RAC TAF Configuration for Admin and Policy Managed Databases (document ID 1312749.1)