In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-03-28 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >
Share
Shulou(Shulou.com)05/31 Report--
This article mainly introduces "which kinds of Failover of Oracle RAC are divided into". In daily operation, I believe that many people have doubts about which kinds of Oracle RAC Failover are divided into. The editor consulted all kinds of materials and sorted out simple and easy-to-use operation methods. I hope it will be helpful to answer the doubts of "which kinds of Oracle RAC Failover are divided into?" Next, please follow the editor to study!
OracleRAC has both HA (HighAvailiablity) and LB (LoadBalance). The basis of its high availability is Failover (failover). It means that the failure of any node in the cluster will not affect the use of users, and the users connected to the failed node will be automatically transferred to the healthy node.
The Failover of Oracle10gRAC can be divided into three types:
1.Client-SideConnecttimeFailover
2.TAF
3.Service-SideTAF
Note: GLOBAL_NAME cannot be set in the listener.ora file because this parameter disables Connect-time Failover and Transparent Application Failover.
I. Client-Side Connect Time Failover
The meaning of Client-Side Connect Time Failover: if multiple addresses are configured in the client tnsname, when the user initiates a connection request, the user will first try to connect to the first address in the address table. If the connection attempt fails, it will continue to try to use the second address until the connection is successful or all the addresses have been traversed.
The characteristic of this Failover: it works only when the connection is established, that is, this Failover method senses the node failure only when the connection is initiated, and if the node does not respond, it automatically tries the next address in the address list. Once the connection is established, the failure of the node will not be dealt with, the performance from the client is that the session is disconnected, and the user program must re-establish the connection.
The way to enable this Failover is to add a FAILOVER=ON entry to the client's tnsnames.ora, which is ON by default, so even if you don't add this entry, the client will get this Failover capability.
Example:
RAC=
(DESCRIPTION=
(ADDRESS= (PROTOCOL=TCP) (HOST=rac1-vip) (PORT=1521))
(ADDRESS= (PROTOCOL=TCP) (HOST=rac2-vip) (PORT=1521))
(LOAD_BALANCE=YES)
(
CONNECT_DATA=
(SERVER=DEDICATED)
(SERVICE_NAME=RAC)
)
)
Note: rac1-vip,rac2-vip needs to be added to the hosts file, otherwise it may not be parsed.
II. TAF (Transparent Application Failover)
For the configuration of this piece, please see: 10g & 11g Configuration of TAF (Transparent Application Failover) and Load Balancing [ID 453293.1]
Nowadays, most popular application systems (such as weblogic,Jboss) establish several long connections to the database at startup and reuse these connections throughout the life cycle of the application. The way Client-Side Connet Time Failover works is that it doesn't help much with the usability of the application.
So only a new Failover mechanism, TAF, has been introduced from the Oracle8.1.5 version. The so-called TAF means that after the connection is established, if an instance fails during the operation of the application system, the users connected to this instance will be automatically migrated to other healthy instances. For the application, the migration process is transparent and does not require user intervention, of course, if the transparency is guided, because the user's uncommitted transactions are rolled back. Compared to the interruption of the user program with Client-Side Connect Time Failover, throwing a connection error, and the user must restart the application, TAF has made great progress in improving HA.
The configuration of TAF is also simple, as long as you add the FAILOVER_MODE configuration item to the client's tnsnames.ora. This entry has four subitems to define.
1.METHOD: users define when to create a connection to their instance. There are two optional values, BASIC and PRECONNECT.
BASIC: a connection to another instance is created only when a node failure is perceived.
PRECONNECT: connections to all instances are established at the same time when the connection is initially established, and can be switched to other links immediately in the event of a failure.
Comparison of the two methods: BASIC mode will have time delay in Failover. Although PRECONNECT mode has no time delay, establishing multiple redundant connections will consume more resources. The two are the difference between time for resources and resources for time.
2.TYPE: used to define how to handle completed SQL statements in the event of a failure, there are two types: session and select.
Both methods automatically roll back uncommitted transactions. The difference lies in the processing of select statements. For select mode, the select statements that the user is executing will be transferred to the new instance, and the subsequent result sets will be returned on the new node, while the recordsets that have already been returned will be discarded. Suppose the user is executing a query on node 1, and there are 100 records in the entire result set, and now 10 records have been returned from node 1, when node 1 goes down and the user connection is transferred to node 2. If it is in session mode, the query statement needs to be re-executed; in select mode, the remaining 90-day records will continue to be returned from node 2, while the 10 records already returned from node 1 will not be returned to the user repeatedly. As far as the user is concerned, the switch will not be felt.
Obviously in order to implement the select approach, Oracle must save more content for each session, including cursors, user context, etc., and the need for more resources is also a resource-for-time solution.
3.DELAY and RETRIES: these two parameters represent the interval between retries and the number of retries, respectively.
Example:
RAC=
(DESCRIPTION=
(ADDRESS= (PROTOCOL=TCP) (HOST=rac1-vip) (PORT=1521))
(ADDRESS= (PROTOCOL=TCP) (HOST=rac2-vip) (PORT=1521))
(LOAD_BALANCE=YES)
(
CONNECT_DATA=
(SERVER=DEDICATED)
(SERVICE_NAME=RAC)
(
FAILOVER_MODE=
(TYPE=session)
(METHOD=basic)
(RETRIES=180)
(DELAY=5)
)
)
)
III. Service-Side TAF
For more information on Service-Side TAF configuration, please see How To Configure Server Side Transparent Application Failover [ID 460982.1]
Service-SideTAF can be seen as a variant of TAF. First, Service-SideTAF is also TAF, which has all the characteristics of TAF. Secondly, this TAF is configured on the server, unlike TAF on the client.
Client-SideTAF is configured by modifying the tnsnames.ora file on the client side. If many clients use this database, then every smile adjustment needs to change all the computers, which is both inefficient and error-prone. Service-Side TAF saves the configuration of FAIL_MODE in the database by combining Service, and saves all the TAF configuration in the data dictionary, thus saving the configuration work of the client. Now the TNS file of the client does not need any configuration options of TAF.
In terms of configuration parameters, Service-Side TAF has an additional concept of Instance Role (instance role) compared to TAF. The so-called instance role is that when there are multiple Instance participating in a Service, you can configure which Instance to use first to provide services to users. There are two optional roles for users.
PREFERRED: the preferred instance, and the instance with this role will be preferred to provide services.
AVAILABLE: backup instance. Users will first connect to the Instance of PREFFERRED. When the Instance of PREFERRED is not available, it will be transferred to the Instance of AVAILBALE.
Service must be configured to use Server-Side TAF. Service can be created when the database is created or modified after the database is created, either using the dbca configuration wizard or from the command line.
3.1Configuring Service with DBCA
1)。 Run DBCA and select ORACLE RACApplication Clusters database
2)。 Select Services Management in the second interface
3)。 A list of RAC databases appears in the third interface, in which the user can select the database to configure Service
4)。 In the Serice configuration interface, click Add to create a new Service and enter the service name. Define the instance role in the Instance list box, select that service1 as the Preferred (preferred instance) and Service2 as the availiable (backup instance). TAFPolicy has three options: None,Basic,Pre-connect. We choose Basic. Finally, click Finish to complete the Service configuration.
5) after the Service configuration is finished, the service starts automatically.
3.2 configure Service with the srvctl command
Configuring Service on the command line is useful for remote maintenance. First, let's take a look at the relevant orders.
1) create a service
# Srvctl add service-d-s-r "preferred-instance-list"-a "available-instance-list"-P
TAF-Policy can be selected: basic and preconnect.
For example: srvctl add service-d RAC-s Service2-r "RAC1,RAC2"-a "RAC3,RAC4"-P basic
Note: in srvctl add service, only perferred creates services. That is, register an ora.raw.dmm.Raw1.Srv service in OCR.
2) View configuration information
# srvctl config service-d database_name [- s service_name] [- a]
If "- s service-name" is not specified here, all Service configurations, including preferred and availableinstance. Using the-an option, TAF-related information is also displayed.
3) whether to run service automatically
When the database starts, all Service is started automatically. Sometimes it is necessary to disable this feature for maintenance purposes and start it after the maintenance is complete.
# srvctl enable/disable service- d database-name-s service-name-I instance-name
4) start service
# srvctl start service-d-s-I instance-name-o start-option-cconnect-string-q
If you do not specify service-name, all service will be started, and multiple service can be started at the same time, separated by commas. -I specifies which instance to start service on.
5) stop service
# srvctl stop service-d-s-iinstance-name-cconnect-string-q-f
The-f option forcibly shuts down service and disconnects all its users.
6) View service status
# srvctl status service- d-s service-name- I instance-name-f-v
Where-f can display the instance information of the disable, and-v can display the detailed output
7) Delete service
# srvctl remove service- d database-name-s service-name-I instance-name [- f]
Note: when creating a service using srvctl, it is important to note that the TAF policy option must be configured through the dbms_service package.
Example:
Begin
Dbms_service.modify_service (Service_name ='> Service1'
Failover_method = > dbms_service.failover_method_basic
Failover_type = > dbms_service.failover_type_select
Failover_retries = > 180
Failover_delay = > 5)
End
3.3 considerations for configuring Service
1)。 The service name of the database is specified with the service_name parameter. A database can have multiple service names, but the longest service_name is 4kb. Do not modify this parameter manually.
2) you can create up to 64 service, and each database has 2 implicit service, so there are only 62 service left for the user. The configuration of these two implied service cannot be modified, and the two services cannot be started or stopped manually. The two implied service are SYS$BACKGROUND and SYS$USERS.
3) when you configure Service with dbca, dbca automatically updates OCR and starts Service. When you delete service, it stops service and updates OCR.
4) when using the srvctl tool, the command only updates the configuration in OCR, not the information in data dctionary and listener, so you also need to use the dbma_servie package to update data dictionary and manually change the listener configuration file. Therefore, it is recommended to use the DBCA tool to configure and change the service configuration
5) if the client wants to connect to the database through Service, it needs to use service_name to reference the database in the tns entry. Such as:
RAC=
(DESCRIPTION=
(ADDRESS= (PROTOCOL=TCP) (HOST=rac1-vip) (PORT=1521))
(ADDRESS= (PROTOCOL=TCP) (HOST=rac2-vip) (PORT=1521))
(LOAD_BALANCE=YES)
(
CONNECT_DATA=
(SERVER=DEDICATED)
(SERVICE_NAME=RAC)
)
)
Note: whether you use the dbca tool or the srvctl command to configure service, you cannot configure the three TYPE,DELAY,RETRIES properties of TAF, and you must use the dbms_service package to modify them.
The three TYPE,DELAY,RETRIES properties of TAF in 11g can be configured with the srvctl directory.
Note:
The service_name in the client tnsnames.ora will write the name of our service-side TAF. You can view it in the following ways:
SQL > showparameter service
NAME TYPE VALUE
Service_names string dave, dave_taf
You can then verify:
SQL > show parameter instance_name
NAME TYPE VALUE
Instance_name string rac1
SQL > select sid from v$mystat where rownum=1
SID
-
one hundred and forty six
SQL > select failover_type,failover_method,failed_over from v$session where sid=146
FAILOVER_TYPE FAILOVER_METHOD FAILED_OVER
SELECT BASIC YES
If the client does not write the name of the SERVICE-SIDE TAF, but the name of the instance, then the connection to the database is not affected, but the TAF function cannot be implemented.
IV. Srvctl command test example
1. Use the srvctl command to create a dmm
[oracle@raw2bin] $srvctl add service-d raw-s dmm-r "raw1,raw2"-P basic
$crs_stat-t
Omit.
$srvctl add service-d raw-s dmm-r raw1-a raw2-P basic
Note: in srvctl add service, only perferred creates services. That is, register an ora.raw.dmm.Raw1.Srv service in OCR.
3) confirm that the service has been created successfully. Offline indicates that it has not been started yet.
$crs_stat-t
4) configure this service to start itself
$srvctl enable service-d raw-s dmm
5) start the service
$srvctl start service-d raw-s dmm
6) confirm the service status. Online indicates that it has been started
$crs_stat-t
The newly created service is automatically added to the initial session parameters:
Show parameter service
7) to modify the configuration with serviceTAF, you need to use the dbms_service.Modify_service package.
Begin
Dbms_service.modify_service (Service_name = > 'dmm'
Failover_method = > dbms_service.failover_method_basic
Failover_type = > dbms_service.failover_type_select
Failover_retries = > 180
Failover_delay = > 5)
End
/
8) confirm that the parameters are in effect
Select name,failover_method,failover_type,goal,clb_goal from dba_services
9) you can also use the srvctl command to view the configuration
$srvctl config service-d raw-s dmm-a
10) Delete Service
-- close service first:
$srvctl stop service-d raw-s dmm
$srvctl disable service-d raw-s dmm
-- then delete the service:
$srvctl remove service-d raw-s dmm
If the command is not clear, we can add the-f parameter
$srvctl remove service-d raw-s dmm-f
The information in the OCR has been deleted, but there are also the contents of the service in the data dictionary, so continue to clear the contents of the data dictionary.
First check the contents of the data dictionary:
Select name,failover_method,failover_type,goal,clb_goal from dba_services
Clear the data dictionary:
Begin
Dbms_service.delete_service (service_name = > 'dmm')
End
/
Query the data dictionary again, there is no data. Cleanup completed
Select name,failover_method,failover_type,goal,clb_goal from dba_services
At this point, the study of "which kinds of Failover of Oracle RAC are divided into" is over. I hope to be able to solve your doubts. The collocation of theory and practice can better help you learn, go and try it! If you want to continue to learn more related knowledge, please continue to follow the website, the editor will continue to work hard to bring you more practical articles!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un