需要为第二个NIC添加Oracle侦听器

时间:2014-09-07 03:32:18

标签: oracle oracle11g

我目前正在Windows 2012环境中运行Oracle 11g。

我最近添加了另一个NIC以允许故障转移,但是我不确定如何处理我的listener.ora文件和我的tnsnames.ora文件。有人可以提供指导吗?作为参考,我使用的当前IP是192.168.0.52,我要添加的第二个NIC的IP的IP为192.168.0.53。

以下是我的listener.ora文件:

# listener.ora Network Configuration File: D:\app\Administrator\product\11.2.0\dbhome_1\network\admin\listener.ora
# Generated by Oracle configuration tools.

SID_LIST_LISTENER =
  (SID_LIST =
    (SID_DESC =
      (SID_NAME = CLRExtProc)
      (ORACLE_HOME = D:\app\Administrator\product\11.2.0\dbhome_1)
      (PROGRAM = extproc)
      (ENVS = "EXTPROC_DLLS=ONLY:D:\app\Administrator\product\11.2.0\dbhome_1\bin\oraclr11.dll")
    )
  )

LISTENER =
  (DESCRIPTION_LIST =
    (DESCRIPTION =
      (ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1521))
      (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.0.52)(PORT = 1521))
    )
  )

ADR_BASE_LISTENER = D:\app\Administrator

以下是我的tnsnames.ora文件:

# tnsnames.ora Network Configuration File: D:\app\Administrator\product\11.2.0\dbhome_1\network\admin\tnsnames.ora
# Generated by Oracle configuration tools.

LISTENER_ORCL =
  (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.0.52)(PORT = 1521))


ORACLR_CONNECTION_DATA =
  (DESCRIPTION =
    (ADDRESS_LIST =
      (ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1521))
    )
    (CONNECT_DATA =
      (SID = CLRExtProc)
      (PRESENTATION = RO)
    )
  )

ORCL =
  (DESCRIPTION =
    (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.0.52)(PORT = 1521))
    (CONNECT_DATA =
      (SERVER = DEDICATED)
      (SERVICE_NAME = orcl)
    )
  )

感谢您的帮助!

1 个答案:

答案 0 :(得分:0)

好吧,您可以在ADDRESS中指定多个listener.ora条目:

LISTENER =
  (DESCRIPTION_LIST =
    (DESCRIPTION =
      (ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1521))
      (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.0.52)(PORT = 1521))
      (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.0.53)(PORT = 1521))
    )
  )

tnsnames.ora

ORCL =
  (DESCRIPTION =
    (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.0.52)(PORT = 1521))
    (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.0.53)(PORT = 1521))
    (CONNECT_DATA =
      (SERVER = DEDICATED)
      (SERVICE_NAME = orcl)
    )
  )

当我为侦听器指定多个地址时,它会侦听列出的所有接口。当tnsnames中至少有一个地址可以连接时 - 它会连接。我有11g可用于在客户端和服务器端进行测试。我查看了文档(Multiple Address Lists in tnsnames.ora),并指出可以在(FAILOVER=on)中明确指定参数tnsnames.ora