如何解决Oracle SQL中的12505错误?

pw9qyyiw  于 2023-10-16  发布在  Oracle
关注(0)|答案(1)|浏览(122)

我是一名编程专业的学生,刚开始学习数据库和SQL。当我尝试连接到SQL Developer中的数据库时,它说
ORA-12505,TNS:侦听器当前不知道连接描述符中给出的SID。
我试着把它安装在家里的PC塔上,一切都很好,只是不适合我的笔记本电脑。甚至老师也说他帮不了我,因为他不知道该怎么做,所以我在这里尝试,因为我真的不知道该怎么做。
我多次尝试卸载et重新安装数据库,并确保每个Oracle服务都在运行。我的SID设置为XE。我的连接设置为基本。主机是'localhost',端口是'1521',SID是'xe'
下面是tnsnames.ora文件

XE =
  (DESCRIPTION =
    (ADDRESS = (PROTOCOL = TCP)(HOST = DESKTOP-62JIG0N)(PORT = 1521))
    (CONNECT_DATA =
      (SERVER = DEDICATED)
      (SERVICE_NAME = XE)
    )
  )

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

ORACLR_CONNECTION_DATA = 
  (DESCRIPTION = 
    (ADDRESS_LIST = 
      (ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1)) 
    ) 
    (CONNECT_DATA = 
      (SID = CLRExtProc) 
      (PRESENTATION = RO) 
    ) 
  )

这里是输出的lsnrctl状态在CMD

STATUS of the LISTENER
------------------------
Alias                     LISTENER
Version                   TNSLSNR for 64-bit Windows: Version 11.2.0.2.0 - Production
Start Date                03-F╔VR.-2020 12:04:38
Uptime                    0 days 4 hr. 53 min. 38 sec
Trace Level               off
Security                  ON: Local OS Authentication
SNMP                      OFF
Default Service           XE
Listener Parameter File   C:\oraclexe\app\oracle\product\11.2.0\server\network\admin\listener.ora
Listener Log File         C:\oraclexe\app\oracle\diag\tnslsnr\DESKTOP-62JIG0N\listener\alert\log.xml
Listening Endpoints Summary...
  (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(PIPENAME=\\.\pipe\EXTPROC1ipc)))
  (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=DESKTOP-62JIG0N)(PORT=1521)))
Services Summary...
Service "CLRExtProc" has 1 instance(s).
  Instance "CLRExtProc", status UNKNOWN, has 1 handler(s) for this service...
Service "PLSExtProc" has 1 instance(s).
  Instance "PLSExtProc", status UNKNOWN, has 1 handler(s) for this service...

下面是listener.ora文件

SID_LIST_LISTENER =
  (SID_LIST =
    (SID_DESC =
      (SID_NAME = PLSExtProc)
      (ORACLE_HOME = C:\oraclexe\app\oracle\product\11.2.0\server)
      (PROGRAM = extproc)
    )
    (SID_DESC =
      (SID_NAME = CLRExtProc)
      (ORACLE_HOME = C:\oraclexe\app\oracle\product\11.2.0\server)
      (PROGRAM = extproc)
    )
  )

LISTENER =
  (DESCRIPTION_LIST =
    (DESCRIPTION =
      (ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1))
      (ADDRESS = (PROTOCOL = TCP)(HOST = DESKTOP-62JIG0N)(PORT = 1521))
    )
  )

DEFAULT_SERVICE_LISTENER = (XE)
ygya80vv

ygya80vv1#

SQL Dev连接属性的“连接”类型是什么?(基本的?TNS?)在错误消息(“NS:listener does not currently know of SID”)与tnsnames指示通过服务名而不是SID连接之间存在差异。这将表明您的SQL Dev连接类型为“basic”。.它根本不使用tnsnames.ora。由于您使用的是“基本”连接,因此需要向我们显示所使用的值。另外,由于是侦听器抱怨他不知道您请求的SID,因此您需要向我们显示命令'lsnrctl status'的输出,以便我们可以看到侦听器 * 确实 * 知道什么。
这确实是一个非常基本的问题,所以你的老师不知道如何解决这个问题,这让我对他是否有资格教授任何涉及甲骨文的东西产生了很多疑问。

相关问题