ORA-12505,TNS:listener 当前不知道连接描述符中给定的 SID?

ORA-12505, TNS:listener does not currently know of SID given in connect descriptor?

当我尝试通过 SQL Developer 或我的 java 应用程序连接到 oracle 时,出现以下错误,尽管我能够连接 来自 SQL PLUS(命令行工具)

    Listener refused the connection with the following error :

    ORA-12505, TNS:listener does not currently know 
    of SID given in connect descriptor

每当我重新启动系统时,我都会遇到这个问题。虽然在系统重启后 10 次中有 1 次,我能够连接成功。

我可以看到包括 OracleOraDb11g_home1TNSListener 在内的所有 oracle 服务都在服务部分。仅供参考 我的 SID 名称是 orcl

ORA-12505, TNS:listener does not currently know of SID given in connect descriptor 通过 Luke 回答后 看起来在重启时 oracle 数据库比 OracleOraDb11g_home1TNSListener 更早启动。所以它不能 向听众注册。

我认为解决方案应该是先建立监听器然后启动数据库。 如何配置在重启后一段时间后启动数据库?

I face this problem whenever i do system restart. Though 1 out of 10 time after system restart , i am able to connect successfully.

可能的原因是系统重启后SERVICES没有启动。检查它的方式取决于 operating system.

例如,在 Windows OS 中,您可以转到 services.msc 并查看 TNS 服务是否启动和 运行。

要检查侦听器是否已启动,以及数据库是否已注册,请检查lsnrctl status。另外,请记住,listener 需要在系统重新启动后的某个时间。对监听器进行任何更改后也是如此,您必须等待一段时间。