DBMS SERVICE

From Oracle FAQ
Jump to: navigation, search

DBMS_SERVICE is a PL/SQL package that can be used to define and manage database services for a single instance. To define a RAC service (multi-instance) see srvctl.

Please note that services can also be defined from the DBCA GUI.

History[edit]

This package was introduced with Oracle 10g Release 1. Starting with 10g release 2 one can also set-up a service with TAF fail-over settings.

Functions[edit]

dbms_service.CREATE_SERVICE[edit]

SQL> exec dbms_service.CREATE_SERVICE(SERVICE_NAME=>'orderentry', NETWORK_NAME=>'db11g')

dbms_service.MODIFY_SERVICE[edit]

Modify an existing service. Example:

SQL> exec DBMS_SERVICE.MODIFY_SERVICE( -
>         service_name => 'o11gr1', -
>         goal => DBMS_SERVICE.GOAL_THROUGHPUT, -
>         failover_method => DBMS_SERVICE.FAILOVER_METHOD_BASIC, -
>         failover_type => DBMS_SERVICE.FAILOVER_TYPE_SELECT, -
>         failover_retries => 10, -
>         failover_delay => 1, -
>         clb_goal => DBMS_SERVICE.CLB_GOAL_LONG);
PL/SQL procedure successfully completed.

dbms_service.START_SERVICE[edit]

SQL> exec dbms_service.START_SERVICE('orderentry')
SQL> show parameter service

dbms_service.STOP_SERVICE[edit]

SQL> exec dbms_service.STOP_SERVICE('orderentry')

dbms_service.DELETE_SERVICE[edit]

SQL> exec dbms_service.DELETE_SERVICE('orderentry')

Monitor[edit]

Use the following dictionary views to monitor services:

  • dba_services - All defined services
  • gv$active_services - All active (started) services

To see what service a session is connected to:

SELECT username, program, machine, service_name FROM gv$session;