jueves, 1 de agosto de 2013

Oracle 11 RAC Services, creating and managing services


Services

Services are used to manage the workload in an Oracle RAC environment. Services are designed to group a workload, so users meetings the same requeriments can be grouped by using the same service.
For example, in an Oracle Rac environment could be defined a service for users who execute small and short transactions, other service for users executing long running transactions, and so on...

Service could be defined for both admin-managed and policy-managed databases.
There are restrictions creating services on policy-managed databases, services there are assigned to a server pool and can be defined as a Singleton or Uniform service.
A Singleton service runs only on one database instance on its server pool, and the user does not have the control over wich instance will serve the service.
A Uniform service runs on all database instances in its server pool.
The administrator-managed database runs the service assigning it in the preferred instances, if the preferred instance fails the service will run on the available instance.


Managing Services.

Database Services.

This sql statement show information about services from v$services view.

SQL> select name, network_name, creation_date, goal, dtp, aq_ha_notification,clb_goal from v$services;

NAME     NETWORK_NAME    CREATION_ GOAL   D AQ_ CLB_G
-------------------- ------------------------------ --------- ------------ - --- -----
servicetest     servicetest    22-JUL-13 NONE   N NO  LONG
RACDBXDB     RACDBXDB    07-JUL-13 NONE   N NO  LONG
RACDB.test     RACDB.test    07-JUL-13 NONE   N NO  LONG
SYS$BACKGROUND    07-JUL-13 NONE   N NO  SHORT
SYS$USERS    07-JUL-13 NONE   N NO  SHORT

With srvctl utility we can obtain information about a configured service.

[oracle@racnode1 ~]$ srvctl config service -d RACDB
Service name: servicetest
Service is enabled
Server pool: racdb_servicetest
Cardinality: 1
Disconnect: false
Service role: PRIMARY
Management policy: AUTOMATIC
DTP transaction: false
AQ HA notifications: false
Failover type: NONE
Failover method: NONE
TAF failover retries: 0
TAF failover delay: 0
Connection Load Balancing Goal: LONG
Runtime Load Balancing Goal: NONE
TAF policy specification: BASIC
Preferred instances: RACDB1
Available instances: RACDB2

Preferred an available instances.

Preferred instances for a service are instances in wich the service will be started, available instances are backup instances, if a preferred instance fails, the service will be started on these instances.

Management Policy.

Oracle 11 allows specifying the management policy, manual or automatic, occasionally the DBA may want to start the database services manually, with srvct utility change the management policy to MANUAL to accomplish this goal.

Changing Service goal.

Service goal consist in a classification per service, this parameter could be SHORT or LONG due to the session life.

[oracle@racnode1 ~]$ srvctl modify service -s SERVICE_NAME -d RACDB -j SHORT


[oracle@racnode1 ~]$ srvctl config service -d RACDB
Service name: servicetest
Service is enabled
Server pool: racdb_servicetest
Cardinality: 1
Disconnect: false
Service role: PRIMARY
Management policy: AUTOMATIC
DTP transaction: false
AQ HA notifications: false
Failover type: NONE
Failover method: NONE
TAF failover retries: 0
TAF failover delay: 0
Connection Load Balancing Goal: SHORT
Runtime Load Balancing Goal: NONE
TAF policy specification: BASIC
Preferred instances: RACDB1
Available instances: RACDB2

Connection Load Balancing Goal has changed from LONG to short.

Changing DTP (Distributed Transaction Processing).

By default all services running distributed transactions will be distributed along all rac instances, this option can be disabled or enabled.

[oracle@racnode1 ~]$ srvctl modify service -s servicetest -d RACDB -x TRUE
[oracle@racnode1 ~]$ srvctl config service -d RACDB
Service name: servicetest
Service is enabled
Server pool: racdb_servicetest
Cardinality: 1
Disconnect: false
Service role: PRIMARY
Management policy: AUTOMATIC
DTP transaction: true
AQ HA notifications: false
Failover type: NONE
Failover method: NONE
TAF failover retries: 0
TAF failover delay: 0
Connection Load Balancing Goal: SHORT
Runtime Load Balancing Goal: NONE
TAF policy specification: BASIC
Preferred instances: RACDB1
Available instances: RACDB2
[oracle@racnode1 ~]$ srvctl modify service -s servicetest -d RACDB -x FALSE
[oracle@racnode1 ~]$ srvctl config service -d RACDB
Service name: servicetest
Service is enabled
Server pool: racdb_servicetest
Cardinality: 1
Disconnect: false
Service role: PRIMARY
Management policy: AUTOMATIC
DTP transaction: false
AQ HA notifications: false
Failover type: NONE
Failover method: NONE
TAF failover retries: 0
TAF failover delay: 0
Connection Load Balancing Goal: SHORT
Runtime Load Balancing Goal: NONE
TAF policy specification: BASIC
Preferred instances: RACDB1
Available instances: RACDB2

Changing TAF (Transparent Application Failover).

Established sessions on a database are reallocated on other database instance in case of a source instance failure.
There are three policies: NONE, BASIC and PRECONNECT.
None: No TAF policy applied.
Basic: Restarts the failed query on the new database instance upon failover.
Preconnect: The same as the Basic method but in this case Oracle anticipates connection failure creating a shadow connection on the other instance, which is always available on the available instance, to improve the failover time.

[oracle@racnode1 ~]$ srvctl modify service -s servicetest -d RACDB -P BASIC

Creating new services.

The following command creates a service called TEST that defines RACDB1 as the preferred instance, RACDB2 as available instance, and BASIC TAF policy, also configures the service to start automatically using automatic management policy.

[oracle@racnode1 ~]$ srvctl add service -d racdb -s TEST -r RACDB1 -a RACDB2 -P basic -y AUTOMATIC
[oracle@racnode1 ~]$ srvctl config service -d RACDB -s TEST
Service name: TEST
Service is enabled
Server pool: racdb_TEST
Cardinality: 1
Disconnect: false
Service role: PRIMARY
Management policy: AUTOMATIC
DTP transaction: false
AQ HA notifications: false
Failover type: NONE
Failover method: NONE
TAF failover retries: 0
TAF failover delay: 0
Connection Load Balancing Goal: LONG
Runtime Load Balancing Goal: NONE
TAF policy specification: BASIC
Preferred instances: RACDB1
Available instances: RACDB2

Starting, Stoping and disabling the service.

[oracle@racnode1 ~]$ srvctl start service -d RACDB -s TEST

[oracle@racnode1 ~]$ srvctl status service -d RACDB
Service servicetest is running on instance(s) RACDB1
Service TEST is running on instance(s) RACDB1

[oracle@racnode1 ~]$ srvctl stop service -d RACDB -s TEST

[oracle@racnode1 ~]$ srvctl status service -d RACDB
Service servicetest is running on instance(s) RACDB1
Service TEST is not running.

[oracle@racnode1 ~]$ srvctl disable service -d RACDB -s TEST

[oracle@racnode1 ~]$ srvctl config service -d RACDB -s TEST
Service name: TEST
Service is disabled
Server pool: racdb_TEST
Cardinality: 1
Disconnect: false
Service role: PRIMARY
Management policy: AUTOMATIC
DTP transaction: false
AQ HA notifications: false
Failover type: NONE
Failover method: NONE
TAF failover retries: 0
TAF failover delay: 0
Connection Load Balancing Goal: LONG
Runtime Load Balancing Goal: NONE
TAF policy specification: BASIC
Preferred instances: RACDB1
Available instances: RACDB2


No hay comentarios:

Publicar un comentario