11gR2 (11.2) rac taf Configuration for Admin and Policy Managed Databases (Document ID 1312749.1)

Source: Internet
Author: User
Tags oracle documentation taf

In this Document

  Purpose
  Scope
  Details
  Concepts & Overview
  Administrator-managed Database
  Basic Method
  Preconnect Method
  Policy-managed Database
  Basic Method

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 database.

Scope


This article is intended for Oracle Cluster Administrators who wowould like more details about TAF. Basic understanding of Oracle Clusterware Database is assumed.

Details

 

Concepts & Overview


TAF allows Oracle clients to reconnect to a specified ving 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 specified ving 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. grouping 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 between SS 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.

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 is not allowed as clusterware manages setting this parameter.



Let's have a look atSrvctlSyntax for creating service. Databases in 11gR2 can be Administrator-managed or Policy-managed. Certain options can be 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>]


Here is the description of the options that we are going to use in processing ing 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 databaseWhere 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 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.


Administrator-managed Database

 

Basic 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}]
[-Z <failover_retries>]
[-W <failover_delay>]


Example:
$Srvctl add service-dDb112-SMysrvb-RDb1121, db1122-PBasic-ESelect-MBasic-Z10-W2

Though this example only uses-r option, you can use both-r and-a option.



2.Start the service
$Srvctl start service-dDb112-SMysrvb

Check if the service is registered with the listener.

$ Lsnrctl status LISTENER_SCAN1
...
...
Service "mysrvb" has 2 instance (s ).
Instance "db1121", status READY, has 1 handler (s) for this service...
Instance "db1122", status READY, has 1 handler (s) for 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 will do.

Mysrvb =
(Description =
(Address = (protocol = tcp) (host = secrac-scan) (port = 1521 ))
(Connect_data =
(Service_name = mysrvb)
)
)

 

Note: Please be aware that Pre-11gR2Clients 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



$SqlplusScott/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.

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-dDb112-SMysrv-RDb1121-Db1122-PPreconnect

NOTE:
* The-e,-m option shoshould be set to none. Omitting this option actually sets it to none.
* Use both-r and-a option for preconnect so that a shadow service will be started.



2.Start the service.

$Srvctl start service-dDb112-SMysrv

Preconnect creates an additional shadow service.

$ Crsctl stat res-t
...
...
Ora. db112.mysrv. svc
1 ONLINE secrac1
Ora. db112.mysrv _ preconnect. svc
1 ONLINE secrac3
...
...



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<Servicename> _ preconnect.


Check if the service is correctly registered with the listener.

$ Lsnrctl status listener_scan1
...
...
Service "mysrv" has 1 instance (s ).
Instance "db1121", status READY, has 1 handler (s) for this service...
Service "mysrv_preconnect" has 1 instance (s ).
Instance "db1122", status READY, has 1 handler (s) for this service...
...
...





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.

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

$SqlplusScott/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 NO


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.


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, has 1 handler (s) for this service...
Instance "db1_2", status READY, has 1 handler (s) for 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 will do.

Mysrvp =
(Description =
(Address = (protocol = tcp) (host = secrac-scan) (port = 1521 ))
(Connect_data =
(Service_name = mysrvp)
)
)


$SqlplusScott/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

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.