Forum Stats

  • 3,827,358 Users
  • 2,260,762 Discussions
  • 7,897,215 Comments

Discussions

Failover does not recover connections with server

982811
982811 Member Posts: 4
Hello,

How do I configure failover for that connections to the database be re-established when the server is available again?

Url connection:

<connection-url>jdbc:oracle:thin:@(DESCRIPTION=(ADDRESS_LIST=(LOAD_BALANCE=OFF)(FAILOVER=ON)(ADDRESS=(PROTOCOL=TCP)(HOST=node1.myorg.org)(PORT=1550))(ADDRESS=(PROTOCOL=TCP)(HOST=node2.myorg.org)(PORT=1550)))(CONNECT_DATA=(SERVER=DEDICATED)(SERVICE_NAME=opit)(FAILOVER_MODE=(TYPE=none)(METHOD=basic))))</connection-url>

When node 1 becomes unavailable, the node 2 is being used. But when node 1 becomes available again it is not used, only node 2.

My strategy is to define node 2 always as secondary, should be used only if the node is unavailable

I'm using Oracle 11g RAC and JDBC Driver 10.2.0.2.

Regards,
Rodolfo

Edited by: 979808 on 3/Jan/2013 13:35
Tagged:

Best Answer

  • Joe Weinstein-Oracle
    Joe Weinstein-Oracle Member Posts: 516
    Answer ✓
    You can search, but I think all you need to know is that at the driver level, failover is a connect-time
    action, such that when (and only when) you ask the driver for a connection, it will try the first
    node on the list, and if that fails, it will try the next one etc. After that, you're on your own.

Answers

  • Are you saying that if you try to make new JDBC connections after node 1 is back up,
    that all the new connections you get are still to node 2? Or is is that when node 1 goes
    down, all replacement connections are (understandably) to node 2, but that once
    node 1 comes back up, you still have a population of connections only to node 2?
  • 982811
    982811 Member Posts: 4
    The second option!

    I'm saying exactly that. When node 1 back up all connections remain on node 2.

    I want to re-use node 1. Is it possible?
  • Well, no software is going to take perfectly good connections away from you and replace them with
    new connections, just because it somehow thinks your population of connections needs rejiggering.
    In order to rebalance your population of connections you would have to be closing them and making
    new ones, with as frequent a turnover as you want reactivity to the changing DBMS conditions.
    Or you could use some sophisticated load-balancing connection pooling like WebLogic offers.
  • 982811
    982811 Member Posts: 4
    Ok! Got it!

    I'll enable load balancing to force that will create new connections with node 1 as it becomes available.

    Do you know any documentation that can explain me the parameter FAILOVER_MODE?

    There are other types (none, select ...)? There are other methods (basic. ..)?
  • Joe Weinstein-Oracle
    Joe Weinstein-Oracle Member Posts: 516
    Answer ✓
    You can search, but I think all you need to know is that at the driver level, failover is a connect-time
    action, such that when (and only when) you ask the driver for a connection, it will try the first
    node on the list, and if that fails, it will try the next one etc. After that, you're on your own.
  • 982811
    982811 Member Posts: 4
    edited Jan 4, 2013 3:07PM
    In other words driver's failover is very simple. I'll have to use a more sophisticated datasource to resolve this problem.

    Am I right?

    Edited by: 979808 on 4/Jan/2013 12:07
  • it is as I described.
  • UCP load balancing does this as well.
  • >
    Do you know any documentation that can explain me the parameter FAILOVER_MODE?
    >
    The Oracle documentation: Oracle® Database Net Services Reference
    http://docs.oracle.com/cd/E14072_01/network.112/e10835/tnsnames.htm#i497813

    Make sure you read both FAILOVER_MODE parameter and FAILOVER parameter so you don't get them confused.
This discussion has been closed.