java.sql.SQLException: Listener refused the connection with the following error:
ORA-12505, TNS:listener does not currently know of SID given in connect descriptor
数据库搭建在linux centos上,tomcat也部署在上面,取名为服务器A
SQL> select INSTANCE_NAME from v$instance;
INSTANCE_NAME
—————-
orcl
hibernate配置文件:
<property name=”connection.url”>jdbc:oracle:thin:@localhost:1521:orcl</property>
每次把数据库监听stop再 start以后,在我的本机使用浏览器访问服务器A的 web页面就会报 ORA-12505,的错误。
但 如果在我本机 使用plsql登录一下服务器的数据库后,web页面就可以正常访问了。觉得这是一个很奇怪的问题。
还发现一个问题,在本机使用plsql登录服务器的oracle后,监听的状态会发生变化.
未登录前
The listener supports no services
The command completed successfully
登录过后
Service “orcl” has 1 instance(s).
Instance “orcl”, status READY, has 1 handler(s) for this service…
Service “orclXDB” has 1 instance(s).
Instance “orcl”, status READY, has 1 handler(s) for this service…
The command completed successfully
高人来指点