原文地址:http://blog.chinaunix.net/uid-25909722-id-3489826.html
1. service属性具体剖析
When you create and administer services, you are dividing the work that your database performs into manageable units.
When you create new services for your database, you should define each service's workload management characteristics. The characteristics of a service include:
A unique global name to identify the service. (全局唯一的服务名)
A Net Service name that a client uses to connect to the service.(网络服务名,在tnsnames.ora中用于客户端发起连接)
The preferred instances where you want the service to be enabled in a normal running environment.(提供service的首选实例)
The available instances where the service can be enabled if one of the preferred instances fails.(提供service的备用实例)
A service goal that determines whether connections are made to the service based on best service quality (how efficiently a single transaction completes) or best throughput (how efficiently a complete job or long-running query completes), as determined by the load balancing advisory.(load balancing advisory的使用的来进行负载均衡度量)
An indicator that determines whether the service is used for distributed transactions.(一个service是否可以进行分布式事物的标记)
An indicator that determines whether Oracle RAC high availability events are sent to OCI and ODP.NET clients that have registered to receive them through Advanced Queuing.(FAN是否可以使用AQ的标记)
The characteristics of session failovers such as whether failovers occur, whether sessions can use pre-existing connections on the failover instance, and whether failed over sessions can continue to process interrupted queries. The service definition can also define the number of times that a failed session attempts to reconnect to the service and how long it should wait between reconnection attempts. The service definition can also include a connection load balancing goal that informs the Listener how to balance connection requests across the instances that provide the service. (service中的failover相关的属性)
The method for load balancing connections for each service. This method is used by the Listener when Oracle creates connections. Connections are classified as LONG (such as connection pools and SQL*FORMS) which tells the Listener to use session based, or SHORT which tells the Listener to use CPU based. If load balancing advisory is enabled, its information will be use to balance connections otherwise CPU utilization is used.(service中的connection load balancing相关的属性)
service的具体属性如下:
The CREATE_SERVICE procedure adds a new service to the Oracle RAC database.
In the CREATE_SERVICE syntax:
service_name is the unique, global service name,
network_name is the TNS name for connections to the service,
goal sets the workload management goal directive to service quality or throughput,
dtp is the distributed transaction flag,
aq_ha_notification is the flag to send Oracle RAC high availability events to registered OCI clients, failover_method is the TAF failover method for the service,
failover_type is the TAF failover method for the service,
failover_retries is the TAF connection retry count,
failover_delay is the wait time between TAF connection retries, and
clb_goal sets the connection load balancing goal.
When using services with Oracle RAC, add the high availability properties, such as the PREFERRED and AVAILABLE placement, using Enterprise Manager, DBCA or SRVCTL.
service的这些属性可以分为几类:
1> service的两个名字,service_name和net_service_name;
2> service的LB相关的两个goal:connection load balancing和load balancing advisory
3> service的HA相关的4个failover属性;
4> service的HA相关的提供服务的实例:prefered instance和available instance;
5> dtp分布式属性;
You can create and administer services with Enterprise Manager, DBCA, and the DBMS_SERVICE PL/SQL package, and you can perform most service administration tasks with the SRVCTL utility.
2. service之DTP(distributed transaction processing)
All tightly coupled branches of a distributed transaction running on an Oracle RAC database must run on the same instance.
In addition, connection pools at the application server tier that load balance across multiple connections to an Oracle RAC database must ensure that all tightly-coupled branches of a global distributed transaction run on only one Oracle RAC instance. This is also true in distributed transaction environments using protocols such as X/Open Distributed Transaction Processing (DTP) or the Microsoft Distributed Transaction Coordinator (DTC).
To simplify the deployment of distributed transactions, you can use services to manage DTP environments. By defining the DTP property of a service, the service is guaranteed to run on one instance at a time in an Oracle RAC database. All global distributed transactions performed through the DTP service are ensured to have their tightly-coupled branches running on a single Oracle RAC instance. This preserves the integrity for distributed transactions.
To leverage all of the instances in a cluster, create one or more DTP services for each Oracle RAC instance that hosts distributed transactions. Choose one DTP service for one distributed transaction. Choose different DTP services for different distributed transactions to balance the workload among the Oracle RAC database instances.
For services that you are going to use for distributed transaction processing, create the service using Enterprise Manager, DBCA, or SRVCTL and define only one instance as the preferred instance. You can have as many AVAILABLE instances as you want.