When you connect to Oracle remotely in a local area network, you are always prompted to reject the connection, and in the case of a firewall shutdown and the Oracle server listening port turned on, the possible error is that Oracle's listening IP address is not the default, but local 127.0.0.1.
The troubleshooting process is no longer in detail, only to share the solution that causes Oracle to reject the connection because the hostname is incorrect.
===============================
Modify the Hosts file
- Open cmd, enter hostname, note the hostname
c:\windows\system32\drivers\etc\hosts
to open a file with Notepad, add a host name
# Copyright (c) 1993-2009 Microsoft Corp.## This was a sample HOSTS file used by Microsoft TCP/IP for Windows.## This file contains the mappings for IP addresses to host names. each# Entry should is kept on a individual line. The IP address should# is placed in the first column followed by the corresponding host name.# The IP address and the host name should is separated by at least one# space.## Additionally, comments (such as these) may is 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[Host IP] [Host name]
==========================
Modifying an Oracle Listener file
1, open listener.ora
, file in the F:\app\young\product\11.2.0\dbhome_1\NETWORK\ADMIN
directory, will be inside for localhost
their own host name.
#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 originally localhost)) Adr_base_listener = F:\app\young
2, modify tnsnames.ora
, the directory above, will also be localhost
changed to host name.
# 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 originally localhostoraclr_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 original as localhost (connect_data = (SERVER = dedicated) (service_name = ORCL))
3, restart the Tnslsnr.
Open cmd and enter the following command.
startlsnrctl stat
=============================
Connect again remotely, already can connect, success.
[Oralce Supplements]oracle Modify the Listening IP address