CRIAR TRIGGER E SERVIÇO PARA REALIZAR CHAVEAMENTO AUTOMATICAMENTE, DE FORMA QUE O USUARIO NÃO VEJA
begin
dbms_service.create_service('CADT','CADT');
end;
/
begin
DBMS_SERVICE.START_SERVICE('CADT');
end;
/
create trigger CADTRIGG after startup on database
declare
v_role varchar(30);
begin
select database_role into v_role from v$database;
if v_role = 'PRIMARY' then
DBMS_SERVICE.START_SERVICE('CADT');
else
DBMS_SERVICE.STOP_SERVICE('CADT');
end if;
end;
/
begin
dbms_service.modify_service
('CADT',
FAILOVER_METHOD => 'BASIC',
FAILOVER_TYPE => 'SELECT',
FAILOVER_RETRIES => 200,
FAILOVER_DELAY => 1);
end;
/