News
Perth, Australia
+ (61) 417713124
prosolutions@gavinsoorma.com

Trigger to use with Data Guard to change service name

  • Posted by Gavin Soorma
  • On June 18, 2009
  • 0 Comments

CREATE OR REPLACE TRIGGER manage_OCIservice
after startup on database
DECLARE
role VARCHAR(30);
BEGIN
SELECT DATABASE_ROLE INTO role FROM V$DATABASE;
IF role = ‘PRIMARY’ THEN
DBMS_SERVICE.START_SERVICE(‘apex_dg’);
ELSE
DBMS_SERVICE.STOP_SERVICE(‘apex_dg’);
END IF;
END;
/

 

0 Comments

Leave Reply

Your email address will not be published. Required fields are marked *