I'm facing a stupid problem, but after some time searching online and experimenting, I'm starting to lose hope.
I've got two Oracle DBs which are configured to be replicas, thanks to Dataguard.
I'm using a JDBC TNS URL to connect to my DBs, such as :
jdbc:oracle:thin:@ (DESCRIPTION_LIST= (FAILOVER=on) (LOAD_BALANCE=off) (DESCRIPTION= (ADDRESS= (PROTOCOL=TCP) (HOST=DB1) primary (PORT=1521)) (CONNECT_DATA= (SERVER=DEDICATED) (SID=MySID)) ) (DESCRIPTION= (ADDRESS= (PROTOCOL=TCP) (HOST=DB2) secondary (PORT=1521)) (CONNECT_DATA= (SERVER=DEDICATED) (SID=MySID)) ) )
When I perform a switchover, the roles are exchanged : DB1 becomes secondary and DB2 becomes primary. DB1 is in mount status.
So far, so good.
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 :
ORA-01033: ORACLE initialization or shutdown in progress
If I kill the listener, then the failover works and I got a connection from DB2.
But the whole point of dataguard is to perform automatic failover.
But if I'm forced to kill the listener :
- It's not what I was expecting :)
- The switchback may not work, as it's using listeners to do so
If anyone has a clue as for a correct configuration, I'm interested !
Thanks in advance.