sqldevelpoer第一次使用出现错误的处理

Oracle 连接出现Listener refused the connection with the following error:ORA-12505的解决

问题说明

之前在虚拟机里的CentOs上安装了Oracle 11g ,由于一直采用的是物理机win 10 系统中安装sql developer直接连接Oracle的方式进行操作,所以虚拟机采用的是NAT方式的静态IP。今天突然想用另一台macbook中的sql developer 连接Oracle,于是就将虚拟机的联网方式改为了Bridge(桥接),并且重新配置了静态IP,启动Oracle监听后,sql develoer 连接时出现了Oracle Listener refused the connection with the following error:ORA-12505,TNS:listener does not currently know of SID given in connect descriptor的错误。

分析

参考网上的说法,这个问题是数据库监听的配置文件中sid不正确,进入数据库安装目录下,找到tnsnames.ora文件,例如我的路径是/home/Oracle_11g/product/11.2.0/dbhome_1/network/admin/tnsnames.ora。

[Oracle@dpc admin]$ cat tnsnames.ora

# tnsnames.ora Network Configuration File: /home/Oracle_11g/product/11.2.0/dbhome_1/network/admin/tnsnames.ora

# Generated by Oracle configuration tools.

CHENDONGPO =

(DESCRIPTION =

(ADDRESS = (PROTOCOL = TCP)(HOST = dpc)(PORT = 1521))

(CONNECT_DATA =

(SERVER = DEDICATED)

(SERVICE_NAME = orcl)

)

)

 

发现SERVICE_NAME = orcl 没有问题,但是发现了(HOST = dpc)这里(dpc为我的主机名),于是想起之前安装Oracle时曾经在hosts文件中增加了dpc到原来的ip的映射。

标注用户名时看一下这个,再填写,要不然会有莫名其妙的填写错误。



作者:偷得浮生半日咸
链接:https://www.jianshu.com/p/f49fa660d0f9
来源:简书
著作权归作者所有。商业转载请联系作者获得授权,非商业转载请注明出处。
posted @ 2020-11-03 19:32  一朵小红花儿  阅读(103)  评论(0编辑  收藏  举报