Oracle修改監聽IP地址

oracle 11g斷網安裝時,沒有檢測net的功能,因此安裝完後,netstat -an 發現自動監聽的是127.0.0.1:1521,這樣安裝完成後,其餘的主機根本沒法鏈接,是什麼緣由呢?html

 

排錯後發現,是主機名的問題:windows

1 在cmd中,輸入hostname 發現主機名oracle

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

源文件爲:spa

 

# 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 主機名

 

 

 

在最後一行加入code

本機IP    主機名

保存便可server

使用lsnrctl stat查看監聽狀態
此時監聽的仍是 127.0.0.1:1521這個IP
 
 
修改監聽文件 listener.ora 文件在 D:\app\Administrator\product\11.2.0\dbhome_1\network\admin 目錄下,註釋部分的主機名原爲Localhost
# 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
 
# 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)
 
成功!
相關文章
相關標籤/搜索