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)
    )
  )
有帮助吗?

解决方案

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.

许可以下: CC-BY-SA归因
不隶属于 dba.stackexchange
scroll top