如何修改Oracle服务IP地址

时间:2021-07-08 07:11:28

oracle数据库所在的机器更改IP地址后,发现无法连接,
解决这个问题,需要修改一下对应的文件:
F:\app\zhaohe\product\11.2.0\dbhome_1\NETWORK\ADMIN\listener.ora
F:\app\zhaohe\product\11.2.0\dbhome_1\NETWORK\ADMIN\tnsnames.ora
把其中对应的IP地址进行修改后再重新启动oracle就可以解决问题了;
注:重启实例服务、OracleOraDb11g_home1TNSListener后,稍等1分钟后即可。

listener.ora

# listener.ora Network Configuration File: F:\app\zhaohe\product\11.2.\dbhome_1\network\admin\listener.ora
# Generated by Oracle configuration tools. SID_LIST_LISTENER =
(SID_LIST =
(SID_DESC =
(SID_NAME = CLRExtProc)
(ORACLE_HOME = F:\app\zhaohe\product\11.2.\dbhome_1)
(PROGRAM = extproc)
(ENVS = "EXTPROC_DLLS=ONLY:F:\app\zhaohe\product\11.2.0\dbhome_1\bin\oraclr11.dll")
)
) LISTENER =
(DESCRIPTION_LIST =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1521))
(ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.1.5)(PORT = ))
)
) ADR_BASE_LISTENER = F:\app\zhaohe

tnsnames.ora

# tnsnames.ora Network Configuration File: F:\app\zhaohe\product\11.2.\dbhome_1\NETWORK\ADMIN\tnsnames.ora
# Generated by Oracle configuration tools. ORACLR_CONNECTION_DATA =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1521))
)
(CONNECT_DATA =
(SID = CLRExtProc)
(PRESENTATION = RO)
)
) LISTENER_ORCL =
(ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.1.5)(PORT = )) ORCL =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.1.5)(PORT = ))
)
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = orcl)
)
)

注意:HOST位置要用机器名或机器的网络IP(如192.168.1.5)