首页 > 其他分享 >The Network Adapter could not establish the connection

The Network Adapter could not establish the connection

时间:2023-04-14 12:04:59浏览次数:37  
标签:could SID LIST 数据库 ora92 connection ADDRESS oracle Adapter


1、oracle配置

oracle9i2中把C:\oracle\ora92\network\admin 目录下的listener.ora 和tnsnames.ora

(注意:连接远程计算机中oracle数据库的配置中的host不可修改。)

File:   C:\oracle\ora92\network\admin\listener.ora

LISTENER   = 
     (DESCRIPTION_LIST   = 
         (DESCRIPTION   = 
             (ADDRESS_LIST   = 
                 (ADDRESS   =   (PROTOCOL   =   IPC)(KEY   =   EXTPROC0)) 
             ) 
             (ADDRESS_LIST   = 
                 (ADDRESS   =   (PROTOCOL   =   TCP)(HOST   =   127.0.0.1 )(PORT   =   1521)) 
             ) 
         ) 
     ) 

 SID_LIST_LISTENER   = 
     (SID_LIST   = 
         (SID_DESC   = 
             (SID_NAME   =   PLSExtProc) 
             (ORACLE_HOME   =   C:\oracle\ora92) 
             (PROGRAM   =   extproc) 
         ) 
         (SID_DESC   = 
             (GLOBAL_DBNAME   =   tfpc) 
             (ORACLE_HOME   =   C:\oracle\ora92) 
             (SID_NAME   =   tfpc) 
         ) 
     )


**********************
File:   C:\oracle\ora92\network\admin\tnsnames.ora

TFPC   = 
     (DESCRIPTION   = 
         (ADDRESS_LIST   = 
             (ADDRESS   =   (PROTOCOL   =   TCP)(HOST   =   127.0.0.1 )(PORT   =   1521)) 
         ) 
         (CONNECT_DATA   = 
             (SERVER   =   DEDICATED) 
             (SERVICE_NAME   =   tfpc) 
         ) 
     ) 

 INST1_HTTP   = 
     (DESCRIPTION   = 
         (ADDRESS_LIST   = 
             (ADDRESS   =   (PROTOCOL   =   TCP)(HOST   =   127.0.0.1 )(PORT   =   1521)) 
         ) 
         (CONNECT_DATA   = 
             (SERVER   =   SHARED) 
             (SERVICE_NAME   =   MODOSE) 
             (PRESENTATION   =   http://HRService) 
         ) 
     ) 

 EXTPROC_CONNECTION_DATA   = 
     (DESCRIPTION   = 
         (ADDRESS_LIST   = 
             (ADDRESS   =   (PROTOCOL   =   IPC)(KEY   =   EXTPROC0)) 
         ) 
         (CONNECT_DATA   = 
             (SID   =   PLSExtProc) 
             (PRESENTATION   =   RO) 
         ) 
     )

2、IP错误
在设置URL时错误,例如:jdbc:oracle:thin:@192.168.0.36:1521:sharp
数据库服务器不正确:ping 服务器IP是否正确。不正确,将URL更改为正确
端口号错误:一般不会错误。
进行一下操作:在DOS上键入sqlplus,检查oracle是否开启
一却正常,执行下面第3步。

 

3、防火墙
如果机器上安装有放火墙,可能是服务器端口号屏蔽而造成的。关闭防火墙后,尝试重新连接。
仍然不行,执行第4步。

 

4、数据库监听未启动 修改PC上注册表中的ImagePath值
下面以现在主流的数据库ORACLE为例,重新手动启动数据库监听:
3.1:开始 → 运行→ 输入CMD→  进入DOS命令提示界面
d:>lsnrctl
LSNRCTL> status
或者
LSNRCTL> start
如果是类似图片中的信息

The Network Adapter could not establish the connection_TCP

恭喜,你的问题已经查找出来,是数据库监听器没未启动而造成的。

以下是手动启动数据库的方法:
在运行处执行regedit进入注册表到
开始 →运行→ regedit
按下面路径
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\OracleOraHome90TNSListener
找到OracleOraHome90TNSListener(我用的是Oracle9i 其他的版本的应该是OracleOraHomexxxTNSListener)

The Network Adapter could not establish the connection_oracle_02

 

找到之后你会发现ImagePath关键值不存在了,创建它:(存在的话,点击修改,修改方法在下文有介绍)
右键单击,弹出菜单选择新键(N)→字符串值(S)

 

The Network Adapter could not establish the connection_数据库_03

 

将其命名为ImagePath
选中ImagePath点右键,选中修改:

 

The Network Adapter could not establish the connection_TCP_04

 

在值中输入你的Oracle安装目录\ora90(其他版本对应的是oraxxx目录)\bin\tnslsnr

 

The Network Adapter could not establish the connection_oracle_05

 

确定后退出注册表:
再在DOS命令下键入start
如果出现下面画面,恭喜你,监听器启动成功:

 

The Network Adapter could not establish the connection_数据库_06

 

关闭DOS,启动你的程序进行测试,应该恢复正常了。

标签:could,SID,LIST,数据库,ora92,connection,ADDRESS,oracle,Adapter
From: https://blog.51cto.com/u_16070335/6189847

相关文章