Windows环境下修改Oracle实例监听IP地址

时间:2021-09-11 14:38:32

Windows环境下修改Oracle实例监听IP地址。

配置文件路径:<ORACLE_HOME>\NETWORK\ADMIN

如:C:\Oracle11gR2\product\11.2.0\dbhome_1\NETWORK\ADMIN

一、修改配置文件:listener.ora

# listener.ora Network Configuration File: D:\Oracle11gR2\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:\Oracle11gR2\product\11.2.0\dbhome_1)
(PROGRAM = extproc)
(ENVS = "EXTPROC_DLLS=ONLY:D:\Oracle11gR2\product\11.2.0\dbhome_1\bin\oraclr11.dll")
)
(SID_DESC =
(SID_NAME = orcl)
(ORACLE_HOME = D:\Oracle11gR2\product\11.2.0\dbhome_1)
)
) LISTENER =
(DESCRIPTION_LIST =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1521))
(ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.1.100)(PORT = 1521))
)
) ADR_BASE_LISTENER = D:\Oracle11gR2

修改listener.ora配置文件中LISTENER节点中host的地址由localhost为IP地址。

另外,一定要在SID_LIST节点中添加一个SID_DESC节点说明。否则会在启动服务时会报如下错误提示。

Windows环境下修改Oracle实例监听IP地址

二、修改配置文件:tnsnames.ora

修改tnsnames.ora配置文件中的地址为IP地址:

# tnsnames.ora Network Configuration File: D:\Oracle11gR2\product\11.2.0\dbhome_1\network\admin\tnsnames.ora
# Generated by Oracle configuration tools. LISTENER_ORCL =
(ADDRESS = (PROTOCOL = TCP)(HOST = localhost)(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.1.100)(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = orcl)
)
)

通过以上的配置后,重启Oracle监听及实例服务后即可在其他计算机中通过IP地址连接。