title: Oracle : JDBC TNS URL Connection won't failover because listener still responding
body: <p>I'm facing a stupid problem, but after some time searching online and experimenting, I'm starting to lose hope. <br/>
  I've got two Oracle DBs which are configured to be replicas, thanks to Dataguard.<br/></p>
  
  <p>I'm using a JDBC TNS URL to connect to my DBs, such as :</p>
  
  <pre>
  jdbc:oracle:thin:@
    (DESCRIPTION_LIST=
      (FAILOVER=on)
      (LOAD_BALANCE=off)
      (DESCRIPTION=
        (ADDRESS=
          (PROTOCOL=TCP)
          (HOST=<b>DB1</b>) <i>primary</i>
          (PORT=1521))
          (CONNECT_DATA=
            (SERVER=DEDICATED)
            (SID=MySID))
          )
      (DESCRIPTION=
        (ADDRESS=
          (PROTOCOL=TCP)
          (HOST=<b>DB2</b>) <i>secondary</i>
          (PORT=1521))
          (CONNECT_DATA=
            (SERVER=DEDICATED)
            (SID=MySID))
          )
      )
  </pre>
  
  <p>When I perform a switchover, the roles are exchanged : DB1 becomes secondary and DB2 becomes primary. DB1 is in mount status.<br/> 
  So far, so good.<br/></p>
  
  <p>But with my connection URL, I'm expecting to get a connection from DB2, which became primary but as the DB1 listener is still up, it acts as if everything is OK and I end up with an attempt to get a connection on DB1, which leads to the following error :</p>
  
  <pre>
  ORA-01033: ORACLE initialization or shutdown in progress
  </pre>
  
  <p>If I kill the listener, then the failover works and I got  a connection from DB2.</p>
  
  <p>But the whole point of dataguard is to perform automatic failover.<br/> But if I'm forced to kill the listener :</p>
  
  <ol>
  <li>It's not what I was expecting :)</li>
  <li>The switchback may not work, as it's using listeners to do so</li>
  </ol>
  
  <p>If anyone has a clue as for a correct configuration, I'm interested !</p>
  
  <p>Thanks in advance.</p>