[ 2013-12-05 ]

Gestión de servicios de base de datos (creación, modificación y borrado)

Para verificar que servicios están corriendo para una base de datos:

[oracle@server01 ~]$ srvctl status service -d ORCL

No nos devuelve nada, no hay servicios corriendo en la base ORCL.

Creamos un nuevo servicio:

[oracle@server01 ~]$ srvctl add service -d ORCL -s SRVTST -r ORCL1,ORCL2 -P BASIC -e SELECT -m BASIC

(ver más abajo las opción que podemos utilizar en la creación)
En este ejemplo usamos:
-d  Base de datos
-s  Nombre del servicio
-r  Instancias disponibles
-P, -e y -m Caracteristicas del tipo de conexión.

Verificamos la configuración del nuevo servicio:

[oracle@server01 ~]$ srvctl config service -d ORCL
Service name: SRVTST
Service is enabled
Server pool: ORCL_SRVTST
Cardinality: 2
Disconnect: false
Service role: PRIMARY
Management policy: AUTOMATIC
DTP transaction: false
AQ HA notifications: false
Failover type: SELECT
Failover method: BASIC
TAF failover retries: 0
TAF failover delay: 0
Connection Load Balancing Goal: LONG
Runtime Load Balancing Goal: NONE
TAF policy specification: BASIC
Edition:
Preferred instances: ORCL1,ORCL2
Available instances:

Verificamos ahora el status del servicio, vemos que no esta corriendo:

[oracle@server01 ~]$ srvctl status service -d ORCL
Service SRVTST is not running.

Levantamos el servicio creado:

[oracle@server01 ~]$ srvctl start service -d ORCL

Validamos que esta levantado:

[oracle@server01 ~]$ srvctl status service -d ORCL
Service SRVTST is running on instance(s) ORCL1,ORCL2

Podemos ver también el servicio corriendo con crsctl:

[grid@server01 ~]$ crsctl stat res -t

--------------------------------------------------------------------------------

Cluster Resources
--------------------------------------------------------------------------------

...


ora.orcl.db

      1        ONLINE  ONLINE       server01            Open
      2        ONLINE  ONLINE       server02            Open
ora.orcl.srvtst.svc
      1        ONLINE  ONLINE       server01
      2        ONLINE  ONLINE       server02
...


Ahora podemos modificar el servicio, por ejemplo para que corra sobre una sola instancia:

[oracle@server01 ~]$ srvctl modify  service -d ORCL -s SRVTST -n  -i ORCL1

[oracle@server01 ~]$ srvctl config  service -d ORCL -s SRVTST

Service name: SRVTST
Service is enabled
Server pool: ORCL_SRVTST
Cardinality: 1
Disconnect: false
Service role: PRIMARY
Management policy: AUTOMATIC
DTP transaction: false
AQ HA notifications: false
Failover type: SELECT
Failover method: BASIC
TAF failover retries: 0
TAF failover delay: 0
Connection Load Balancing Goal: LONG
Runtime Load Balancing Goal: NONE
TAF policy specification: BASIC
Edition:
Preferred instances: ORCL1
Available instances:

Vemos que ahora quedó corriendo en la instancia indicada. En el otro nodo el servicio fué detenido.

[oracle@server01 ~]$ srvctl status  service -d ORCL -s SRVTST
Service SRVTST is running on instance(s) ORCL1

Si por ejemplo queremos levantarlo en el otro nodo:

[oracle@server01 ~]$ srvctl start  service -d ORCL -s SRVTST -i ORCL2
PRCR-1013 : Failed to start resource ora.ORCL.srvtst.svc
PRCR-1064 : Failed to start resource ora.ORCL.srvtst.svc on node ardc4srdlb002
CRS-2552: There are no available instances of resource 'ora.ORCL.srvtst.svc' to start.

Ahora lo modificamos para que pueda correr sobre ambas instancias:

[oracle@server01 ~]$ srvctl modify  service -d ORCL -s SRVTST -n  -i ORCL1,ORCL2

Lo levantamos y verificamos que ahora si es posible: 

[oracle@server01 ~]$ srvctl start  service -d ORCL -s SRVTST -i ORCL2
[oracle@server01 ~]$ srvctl status  service -d ORCL -s SRVTST
Service SRVTST is running on instance(s) ORCL1,ORCL2


Eliminación de un servicio:

Para eliminar el servicio debe estar bajo:

[oracle@server01 ~]$ srvctl remove service -s TEST -d ORCL

PRCR-1025 : Resource ora.ORCL.test.svc is still running

Lo detenemos y probamos eliminarlo nuevamente:

[oracle@server01 ~]$ srvctl stop service -s TEST -d ORCL
[oracle@server01 ~]$ srvctl remove service -s TEST -d ORCL

Ahora si fue eliminado:

[oracle@server01 ~]$ srvctl status service -d ORCL


Opciones para creación del servicio:

Adds a service configuration to the Oracle Clusterware.

Usage: srvctl add service -d <db_unique_name> -s <service_name> {-r "<preferred_list>" [-a "<available_list>"] [-P {BASIC | NONE | PRECONNECT}] | -g <pool_name> [-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>] [-t <edition>] [-f]

    -d <db_unique_name>      Unique name for the database
    -s <service>             Service name
    -r "<preferred_list>"    Comma separated list of preferred instances
    -a "<available_list>"    Comma separated list of available instances
    -g <pool_name>           Server pool name
    -c {UNIFORM | SINGLETON} Service runs on every active server in the server pool hosting this service (UNIFORM) or just one server (SINGLETON)
    -k <net_num>             network number (default number is 1)
    -P {NONE | BASIC | PRECONNECT}        TAF policy specification
    -l <role>                Role of the service (primary, physical_standby, logical_standby, snapshot_standby)
    -y <policy>              Management policy for the service (AUTOMATIC or MANUAL)
    -e <Failover type>       Failover type (NONE, SESSION, or SELECT)
    -m <Failover method>     Failover method (NONE or BASIC)
    -w <integer>             Failover delay
    -z <integer>             Failover retries
    -t <edition>             Edition (or "" for empty edition value)
    -j <clb_goal>  Connection Load Balancing Goal (SHORT or LONG). Default is LONG.
    -B <Runtime Load Balancing Goal>     Runtime Load Balancing Goal (SERVICE_TIME, THROUGHPUT, or NONE)
    -x <Distributed Transaction Processing>  Distributed Transaction Processing (TRUE or FALSE)
    -q <AQ HA notifications> AQ HA notifications (TRUE or FALSE)
Usage: srvctl add service -d <db_unique_name> -s <service_name> -u {-r "<new_pref_inst>" | -a "<new_avail_inst>"} [-f]
    -d <db_unique_name>      Unique name for the database
    -s <service>             Service name
    -u                       Add a new instance to service configuration
    -r <new_pref_inst>       Name of new preferred instance
    -a <new_avail_inst>      Name of new available instance
    -f                       Force the add operation even though a listener is not configured for a network
    -h                       Print usage


Opciones para modificación del servicio:

Modifies the configuration for the service.

Usage: srvctl modify service -d <db_unique_name> -s <service_name> -i <old_inst_name> -t <new_inst_name> [-f]

    -d <db_unique_name>      Unique name for the database
    -s <service>             Service name
    -i <old_inst>            Old instance name
    -t <new_inst>            New instance name
    -f                       Disconnect all sessions during stop or relocate service operations
Usage: srvctl modify service -d <db_unique_name> -s <service_name> -i <avail_inst_name> -r [-f]
    -d <db_unique_name>      Unique name for the database
    -s <service>             Service name
    -i <avail_inst_name>     Name of available instance
    -r                       Upgrade instance to preferred
    -f                       Disconnect all sessions during stop or relocate service operations
Usage: srvctl modify service -d <db_unique_name> -s <service_name> -n -i "<preferred_list>" [-a "<available_list>"] [-f]
    -d <db_unique_name>      Unique name for the database
    -s <service>             Service name
    -n                       Modify service configuration
    -i "<preferred_list>"    Comma separated list of preferred instances
    -a "<available_list>"    Comma separated list of available instances
    -f                       Disconnect all sessions during stop or relocate service operations
Usage: srvctl modify service -d <db_unique_name> -s <service_name> [-g <pool_name>] [-c {UNIFORM | SINGLETON}] [-P {BASIC|NONE}] [-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 <integer>] [-w <integer>] [-t <edition>]
    -d <db_unique_name>      Unique name for the database
    -s <service>             Service name
    -g <pool_name>           Server pool name
    -c {UNIFORM | SINGLETON} Service runs on every active server in the server pool hosting this service (UNIFORM) or just one server (SINGLETON)
    -P {NONE | BASIC}        TAF policy specification
    -l <role>                Role of the service (primary, physical_standby, logical_standby, snapshot_standby)
    -y <policy>              Management policy for the service (AUTOMATIC or MANUAL)
    -e <Failover type>       Failover type (NONE, SESSION, or SELECT)
    -m <Failover method>     Failover method (NONE or BASIC)
    -w <integer>             Failover delay
    -z <integer>             Failover retries
    -t <edition>             Edition (or "" for empty edition value)
    -j <clb_goal>  Connection Load Balancing Goal (SHORT or LONG). Default is LONG.
    -B <Runtime Load Balancing Goal>     Runtime Load Balancing Goal (SERVICE_TIME, THROUGHPUT, or NONE)
    -x <Distributed Transaction Processing>  Distributed Transaction Processing (TRUE or FALSE)
    -q <AQ HA notifications> AQ HA notifications (TRUE or FALSE)
    -h                       Print usage

No hay comentarios:

Publicar un comentario