This discussion is archived
2 Replies Latest reply: Nov 1, 2012 7:57 AM by user564785 RSS

Is applicaiton aware of oracle failover to standby?

user564785 Newbie
Currently Being Moderated
When you manually fail over from prod to standby, how do client application know to point to the standby database?
  • 1. Re: Is applicaiton aware of oracle failover to standby?
    mseberg Guru
    Currently Being Moderated
    Hello;

    Generally this is handled with tnsnames.ora and a trigger. So to answer your question, No, not without help.
    ernie =
     (DESCRIPTION =
        (ADDRESS_LIST =
           (ADDRESS = (PROTOCOL = TCP)(HOST = primary.host)(PORT = 1521))
           (ADDRESS = (PROTOCOL = TCP)(HOST = standby.host)(PORT = 1521))
           )
           (CONNECT_DATA =
           (SERVICE_NAME = ernie)
        )
     )
    and then
    CREATE TRIGGER CHECK_ERNIE_START 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('ernie');
     ELSE
     DBMS_SERVICE.STOP_SERVICE('ernie');
     END IF;
    END;
    /
    For additional information :

    see DBMS_SERVICE.CREATE_SERVICE

    http://docs.oracle.com/cd/E11882_01/appdev.112/e10577/d_serv.htm

    How to fail over a client transparently in a dataguard switchover/failover scenario

    http://www.usn-it.de/index.php/2007/06/28/how-to-fail-over-a-client-transparently-in-a-dataguard-switchoverfailover-scenario/

    Best Regards

    mseberg
  • 2. Re: Is applicaiton aware of oracle failover to standby?
    user564785 Newbie
    Currently Being Moderated
    Thank you

Legend

  • Correct Answers - 10 points
  • Helpful Answers - 5 points