Oracle数据库服务正在运行,但无法连接

时间:2018-11-05 12:03:38

标签: oracle oracle-sqldeveloper

我遇到以下麻烦。我在笔记本电脑中创建了三种不同的数据库架构,每种都有不同的服务。

我每次启用和停用我想使用的服务。但是创建第三个架构后,我一直面临一个问题。

Task Manager - Services

当我激活OracleServiceIANBG时,可以通过该实例中的SQL开发人员正确连接。当我停用它并激活其他两个实例之一时,我在SQL开发人员中创建的相应连接给我以下错误:

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

SQL Developer snapshot

有人可以解释为什么会发生这种情况以及如何解决它吗?

2 个答案:

答案 0 :(得分:0)

On your cmd line check lsnrctl and see what services are running.

>lsnrctl status

LSNRCTL for Linux: Version 18.0.0.0.0 - Production on 13-NOV-2018 14:15:59

Copyright (c) 1991, 2018, Oracle.  All rights reserved.

Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=EXTPROC1)))
STATUS of the LISTENER
------------------------
Alias                     LISTENER
Version                   TNSLSNR for Linux: Version 18.0.0.0.0 - Production
Start Date                13-NOV-2018 14:15:36
Uptime                    0 days 0 hr. 0 min. 23 sec
Trace Level               off
Security                  ON: Local OS Authentication
SNMP                      OFF
Listener Parameter File   /opt/oracle/product/18c/dbhome_1/network/admin/listener.ora
Listener Log File         /opt/oracle/diag/tnslsnr/c132613c345e/listener/alert/log.xml
Listening Endpoints Summary...
  (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC1)))
  (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=0.0.0.0)(PORT=1521)))
Services Summary...
Service "64a52f53a7683286e053cda9e80aed76" has 1 instance(s).
  Instance "orcl", status READY, has 1 handler(s) for this service...
Service "758e766d38d80b9de053020011acb4c6" has 1 instance(s).
  Instance "orcl", status READY, has 1 handler(s) for this service...
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...
Service "xe" has 1 instance(s).
  Instance "orcl", status READY, has 1 handler(s) for this service...
The command completed successfully

If the expected services are not listed, they can be registered with an alter system register command.

sqlplus  / as sysdba

SQL*Plus: Release 18.0.0.0.0 - Production on Tue Nov 13 14:17:28 2018
Version 18.3.0.0.0

Copyright (c) 1982, 2018, Oracle.  All rights reserved.


Connected to:
Oracle Database 18c Enterprise Edition Release 18.0.0.0.0 - Production
Version 18.3.0.0.0

SQL> alter system register;

System altered.

SQL>

答案 1 :(得分:0)

只需输入./sqlplus命令。

它应该提示输入用户名:

用户名:“ sys as sysdba”使用整个短语 密码:{安装时输入密码}

然后它应该连接

但是如果您想连接到实例:例如oraclxdba

您应该使用外部SQL管理工具对吗?那么您只需使用相同的用户名和密码指定您要连接的SID