前往小程序,Get更优阅读体验!
立即前往
首页
学习
活动
专区
工具
TVP
发布
社区首页 >专栏 >Oracle修改监听IP地址

Oracle修改监听IP地址

作者头像
用户1154259
发布2018-01-17 18:20:30
3.2K0
发布2018-01-17 18:20:30
举报

oracle 11g断网安装时,没有检测net的功能,所以安装完后,netstat -an 发现自动监听的是127.0.0.1:1521,这样安装完成后,其他的主机根本无法连接,是什么原因呢?

排错后发现,是主机名的问题:

1 在cmd中,输入hostname 发现主机名

2 在文件夹:c:\windows\system32\drivers\etc  修改hosts文件:

源文件为:

代码语言:javascript
复制
# 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       主机名

在最后一行加入

代码语言:javascript
复制
 本机IP    主机名

保存即可

使用lsnrctl stat查看监听状态

此时监听的还是 127.0.0.1:1521这个IP

修改监听文件 listener.ora 文件在 D:\app\Administrator\product\11.2.0\dbhome_1\network\admin 目录下,注释部分的主机名原为Localhost

代码语言:javascript
复制
# 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 = WIN-ASA0GB1AV61)(PORT = 1521))//WIN-ASA0GB1AV61原为localhost
) ) ADR_BASE_LISTENER = D:\app\Administrator

把其中的localhost换成自己的主机名

再修改主机名文件 tnsnames.ora

代码语言:javascript
复制
# 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 = WIN-ASA0GB1AV61)(PORT = 1521))//WIN..原为localhost
 
 
ORACLR_CONNECTION_DATA =
  (DESCRIPTION =
    (ADDRESS_LIST =
      (ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1521))
    )
    (CONNECT_DATA =
      (SID = CLRExtProc)
      (PRESENTATION = RO)
    )
  )
 
ORCL =
  (DESCRIPTION =
    (ADDRESS = (PROTOCOL = TCP)(HOST = WIN-ASA0GB1AV61)(PORT = 1521))//WIN..原为localhost
    (CONNECT_DATA =
      (SERVER = DEDICATED)
      (SERVICE_NAME = orcl)
    )
  )

同样把localhost换成自己的主机名

再用lsnrctl.ora检测,发现监听IP地址变为:192.168.1.251:1521 0.0.0.0 (192.168.1.251为本主机IP)

成功!

本文参与 腾讯云自媒体同步曝光计划,分享自作者个人站点/博客。
原始发表:2013-09-18 ,如有侵权请联系 cloudcommunity@tencent.com 删除

本文分享自 作者个人站点/博客 前往查看

如有侵权,请联系 cloudcommunity@tencent.com 删除。

本文参与 腾讯云自媒体同步曝光计划  ,欢迎热爱写作的你一起参与!

评论
登录后参与评论
0 条评论
热度
最新
推荐阅读
领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档