From:
Defining a database Service with a stand Alone Database (document ID 1260134.1)
Applies To:Oracle database-enterprise edition-version 10.2.0.5 to 11.2.0.3 [Release 10.2 to 11.2]
information in this document applies to any platform.
GOAL
The Dbms_service package allows the creation, deletion, starting and stopping of services on both RAC and a single instanc E. Additionally it provides the ability to disconnect all sessions which connect to the instance with a service name when RAC removes the service name from the instance.
Solution
The Dbms_service package lets your create, delete, activate and deactivate services for a single instance.
-Functions:
- Dbms_service. Create_service, Example:
sql> exec dbms_service. Create_service (service_name=> ' orderentry ', network_name=> ' db11g ')
- Dbms_service. Modify_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,-
> Failover_delay = 1,-
> Clb_goal = dbms_service. Clb_goal_long);
- Dbms_service. Start_service, Example:
sql> exec dbms_service. Start_service (' OrderEntry ')
sql> Show parameter service
It Recommended to has the Local_listener (database) parameter set for the database:
If you are using the default local address of TCP/IP, Port 1521:
alter system set Local_listener = ' (address= (protocol=tcp) (Host=hostname or IP Add) (port=1521)) ' Scope=spfile;
If you are using non default local address of TCP/IP, port other than 1521:
alter system set Local_listener = ' (address= (protocol=tcp) (Host=hostname or IP Add) (port=1522)) ' Scope=spfile;
References:
Http://docs.oracle.com/cd/E11882_01/network.112/e41945/listenercfg.htm#CHDCCHIC
- Dbms_service. Stop_service, Example:
sql> exec dbms_service. Stop_service (' OrderEntry ')
- Dbms_service. Delete_service, Example:
sql> exec dbms_service. Delete_service (' OrderEntry ')
-monitoring
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 was connected to:
SELECT username, program, machine, service_name from Gv$session;
"Translated from MOS article" defines database service in Oracle stand-alone databases