oracle的修改监听IP地址方法

时间:2021-06-05 08:35:33

oracle的修改监听IP地址

参考并结合了这两篇博客
oracle的修改监听IP地址
Oracle修改监听IP地址
用很简单的方法,解决了监听问题。

下面结合并重新整理了一下
1、在cmd中,输入hostname 发现主机名
2、在文件夹:c:\windows\system32\drivers\etc 修改hosts文件:

# Copyright (c) 1993-2009 Microsoft Corp.
#
# This is a sample HOSTS file used by Microsoft TCP/IP for Windows.
#
# This file contains the mappings of IP addresses to host names. Each
# entry should be kept on an individual line. The IP address should
# be placed in the first column followed by the corresponding host name.
# The IP address and the host name should be separated by at least one
# space.
#
# Additionally, comments (such as these) may be inserted on individual
# lines or following the machine name denoted by a '#' symbol.
#
# For example:
#
# 102.54.94.97 rhino.acme.com # source server
# 38.25.63.10 x.acme.com # x client host

# localhost name resolution is handled within DNS itself.
# 127.0.0.1 localhost
# ::1 localhost
    [主机IP]          [主机名]

在最后一行加入

本机IP 主机名

3、修改oracle的监听文件

  • 打开listener.ora,在文件F:\app\young\product\11.2.0\dbhome_1\NETWORK\ADMIN目录下,里面将的localhost换速为自己的中主机名。
# listener.ora Network Configuration File: F:\app\young\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 = F:\app\young\product\11.2.0\dbhome_1)
      (PROGRAM = extproc)
      (ENVS = "EXTPROC_DLLS=ONLY:F:\app\young\product\11.2.0\dbhome_1\bin\oraclr11.dll")
    )
  )

LISTENER =
  (DESCRIPTION_LIST =
    (DESCRIPTION =
      (ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1521))
      (ADDRESS = (PROTOCOL = TCP)(HOST = Young-PC)(PORT = 1521))//Young-PC原为localhost
) ) ADR_BASE_LISTENER = F:\app\young
  • 修改tnsnames.ora,目录同上,将也。localhost更改为中主机名。
# tnsnames.ora Network Configuration File: F:\app\young\product\11.2.0\dbhome_1\network\admin\tnsnames.ora
# Generated by Oracle configuration tools.

LISTENER_ORCL =
  (ADDRESS = (PROTOCOL = TCP)(HOST = Young-PC)(PORT = 1521))//Young-PC原为localhost


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

ORCL =
  (DESCRIPTION =
    (ADDRESS = (PROTOCOL = TCP)(HOST = Young-PC)(PORT = 1521))//Young-PC原为localhost
    (CONNECT_DATA =
      (SERVER = DEDICATED)
      (SERVICE_NAME = orcl)
    )
  )
  • 重启TNSLSNR
    打开CMD,输入以下命令。
lsnrctl stop
lsnrctl start lsnrctl stat

oracle的修改监听IP地址方法
再次远程连接,用这台机器的ip已经可以连上了,成功。

Oracle错误 ora-12514 解决方法

过了两天用plsql连接的时候又报ora-12514的错误。
参考Oracle错误 ora-12514 解决方法
在listener.ora文件中的

SID_LIST_LISTENER =
  (SID_LIST =
   (SID_DESC =
      (SID_NAME = PLSExtProc)
      (ORACLE_HOME = E:\Oracle10gXEUniv\app\oracle\product\10.2.0\server)
      (PROGRAM = extproc)
    )
  )

中添加

 (SID_DESC = (SID_NAME = CLRExtProc) (ORACLE_HOME = E:\Oracle10gXEUniv\app\oracle\product\10.2.0\server) (PROGRAM = extproc) )
    (SID_DESC = (SID_NAME = XE) (ORACLE_HOME = E:\Oracle10gXEUniv\app\oracle\product\10.2.0\server) )

其中ORACLE_HOME以安装路径为准。
重启监听后连接成功。