1

I am currently working on a duplicated infrastructure like this :

We have two data server, with two database on each.

  • Server 1
    • Oracle instance 1
    • Oracle instance mirror 1
  • Server 2
    • Oracle instance 2
    • Oracle instance mirror 2

I cannot change the instance name on the database.

DWH_connection =
  (DESCRIPTION =
    (ADDRESS_LIST =
      (ADDRESS = (PROTOCOL = TCP)(HOST = Server1)(PORT = 1521)
      (ADDRESS = (PROTOCOL = TCP)(HOST = Server2)(PORT = 1521)
    )
    (CONNECT_DATA =
      (SERVICE_NAME = Oracleinstance1)
      (SERVER = DEDICATED)
    )
  )

Here is what I know we can do, but I am stuck and can't find any docs. Maybe I am bad at searching, but can't find a way.

I would like to get the Server 1 - Oracle instance 1 with the same alias as Server 2 - Oracle instance 2. So in case Server 1 is not up, our application will go the Server 2. So this is what I would like to have:

DWH_connection =
  (DESCRIPTION =
    (ADDRESS_LIST =
      (ADDRESS = (PROTOCOL = TCP)(HOST = Server1)(PORT = 1521)
      (ADDRESS = (PROTOCOL = TCP)(HOST = Server2)(PORT = 1521)
    )
    (CONNECT_DATA =
      (SERVICE_NAME = Oracleinstance1)
      (SERVICE_NAME = Oracleinstance2)
      (SERVER = DEDICATED)
    )
  )
2
  • Stuck with what? What is the problem? Does the above connection string not work for you? You can create services with the same name on both servers. Use srvctl add service if you use Oracle Restart, or DBMS_SERVICE if you do not have Oracle Restart. Dec 16, 2016 at 11:15
  • I edited to show the problem more efficiently. I do not have the right to modify the database server. All I have acess to, is our Oracle client installation. This is why I am looking for a client side solution. Otherwise i'll lose a lot of time.
    – Aks
    Dec 16, 2016 at 12:38

1 Answer 1

3

You need different DESCRIPTION sections to have different SERVICE_NAME in the CONNECT_DATA section.

DWH_connection =
  (DESCRIPTION_LIST =
    (LOAD_BALANCE=OFF)
    (DESCRIPTION =
      (ADDRESS = (PROTOCOL = TCP)(HOST = Server1)(PORT = 1521))
      (CONNECT_DATA =
        (SERVICE_NAME = Oracleinstance1)
        (SERVER = DEDICATED)
      )
    )
    (DESCRIPTION =
      (ADDRESS = (PROTOCOL = TCP)(HOST = Server2)(PORT = 1521))
      (CONNECT_DATA =
        (SERVICE_NAME = Oracleinstance2)
        (SERVER = DEDICATED)
      )
    )
  )

The default value of LOAD_BALANCE is ON, but in your case, connections should go to the first server, and go to the second one only if that fails, so LOAD_BALANCE=OFF is needed, otherwise connections would be distributed between the 2 servers.

2
  • Owh. I didn't got it when I was reading the documentation. Thanks for pointing it out !
    – Aks
    Dec 16, 2016 at 13:25
  • Just 1 small remark. If your Server1 is down then it will take a longer time to connect since it waits for the timeout on Server1 before it goes to Server2. It can be that a user will complain on that.
    – Marco
    Dec 16, 2016 at 13:36

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.