Oracle internals, debugging and undocumented features
Role-Based Database Service
November 2, 2010Posted by on
Starting with 11.2 role based services are managed by Clusterware.
For previous releases we had to use after db_role_change trigger.That is no longer required.
So in the past :
/* Create Service */
exec DBMS_SERVICE.CREATE_SERVICE(service_name =>’taf’,network_name =>’taf’,aq_ha_notifications
=>true,failover_method =>’BASIC’,failover_type =>’SELECT’,failover_retries =>180,failover_delay => 5);
and have database trigger to start service in case database role switch happens:
CREATE OR REPLACE TRIGGER set_rc_svc AFTER DB_ROLE_CHANGE ON DATABASE DECLARE
SELECT DATABASE_ROLE INTO role FROM V$DATABASE;
IF role = ‘PRIMARY’ THEN
In 11.2 we can create database service which does not require this trigger.Clusterware will handle role change:
Oracle Notification Service ( ONS) and ONS for Enterprise Manager (ONS) must be enabled
So command to create role-based service looks something like this:
srvctl add service -d test -s taf -l PRIMARY -e session -m basic -q TRUE
It will enabled when database is serving as primary database.
Similar service can be created for STANDBY database:
srvctl add service -d test -s tafstandby -l PHYSICAL_STANDBY -e session -m basic -q TRUE