Starting with 11gR2, with the advent of the new Grid Infrastructure software, we have the ability to set up services in our databases that can now automatically be tied to the specific role that a database is playing in our Data Guard configuration. Data Guard Broker must be configured and running to use this new feature.
This can be used for both RAC and single instance databases, just so long as Grid Infrastructure had been installed. The services would have to be set up using SRVCTL rather than DBMS_SERVICE.
The great advantage to this for administrators is to simplify the management of client connections to our databases. We can now have clients connect to primary databases, logical standby databases, physical standby databases and snapshot databases. The challenge is to ensure that a client always connects to the "right" database. By connecting via services, and linking the service to only run in a database playing a specific role, we can simplify connection headaches.
The basic syntax for adding a service would be:
SRVCTL ADD SERVICE -d <db unique name> -s <service name> -l <PRIMARY | PHYSICAL STANDBY | LOGICAL STANDBY | SNAPSHOT STANDBY -y AUTOMATIC | MANUAL
The options for -l indicate which role the database must be in for the service to be running. -y indicates whether the service should be started automatically when the database instance starts in the specified role.
However, if the database is already running, you would have to manually start the service using:
SRVCTL START SERVICE -d <db unique name> -s <service name>