SqlPlus 可以工作,但 SqlDeveloper 在建立连接时给出 ORA-12505 TNS 侦听器错误

问题描述 投票:0回答:1

我在 Windows Server 2019 上安装了 Oracle 19c Enterprise。安装后,我使用 SQL Plus 以“SYS as SYSDBA”帐户成功连接,并进行查询等。

但是,当尝试通过 Sql Developer 连接时,出现以下错误:

Status : Failure -Test failed: Listener refused the connection with the following error:
ORA-12505, TNS:listener does not currently know of SID given in connect descriptor

/network/admin文件夹中,我已经有了listener.ora和sqlnet.ora文件。 我使用以下配置创建了 tnsnames.ora 文件:

TEST_DB =
  (DESCRIPTION =
    (ADDRESS_LIST =
      (ADDRESS = (PROTOCOL = TCP)(HOST = localhost)(PORT = 1522))
    )
    (CONNECT_DATA =
      (SERVICE_NAME = TEST)
    )
  )

我的 listener.ora 文件如下所示:

# listener.ora Network Configuration File: C:\Users\testUser\Downloads\WINDOWS.X64_193000_db_home\NETWORK\ADMIN\listener.ora
# Generated by Oracle configuration tools.

DEFAULT_SERVICE_LISTENER = XE

SID_LIST_LISTENER =
  (SID_LIST =
    (SID_DESC =
      (SID_NAME = CLRExtProc)
      (ORACLE_HOME = C:\Users\testUser\Downloads\WINDOWS.X64_193000_db_home)
      (PROGRAM = extproc)
      (ENVS = "EXTPROC_DLLS=ONLY:C:\Users\testUser\Downloads\WINDOWS.X64_193000_db_home\bin\oraclr19.dll")
    )
  )

LISTENER =
  (DESCRIPTION_LIST =
    (DESCRIPTION =
      (ADDRESS = (PROTOCOL = TCP)(HOST = localhost)(PORT = 1522))
      (ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1522))
    )
  )

注意,

DEFAULT_SERVICE_LISTENER = XE
行是我在网上寻求帮助时手动添加的。我相信其余的都是原样。

编辑文件后,我在重新启动某些 Oracle 服务时遇到了一些问题,但稍后服务器重新启动,它们都在运行。

我检查了 lsnrctl 状态并在 cmd 中启动:

Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=localhost)(PORT=1522)))
STATUS of the LISTENER
------------------------
Alias                     LISTENER
Version                   TNSLSNR for 64-bit Windows: Version 19.0.0.0.0 - Production
Start Date                12-JUL-2024 16:04:43
Uptime                    0 days 0 hr. 5 min. 53 sec
Trace Level               off
Security                  ON: Local OS Authentication
SNMP                      OFF
Default Service           XE
Listener Parameter File   C:\Users\testUser\Downloads\WINDOWS.X64_193000_db_home\network\admin\listener.ora
Listener Log File         C:\Oracle19c\diag\tnslsnr\V-LABAPPDB2\listener\alert\log.xml
Listening Endpoints Summary...
  (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=127.0.0.1)(PORT=1522)))
  (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(PIPENAME=\\.\pipe\EXTPROC1522ipc)))
Services Summary...
Service "CLRExtProc" has 1 instance(s).
  Instance "CLRExtProc", status UNKNOWN, has 1 handler(s) for this service...
The command completed successfully

C:\Windows\system32>lsnrctl start

LSNRCTL for 64-bit Windows: Version 19.0.0.0.0 - Production on 12-JUL-2024 16:11:12

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

TNS-01106: Listener using listener name LISTENER has already been started

最后,我在 Sql Developer 连接上尝试了一堆组合。 用户名,我尝试过:“sys as sysdba”,“sys”,角色为 SYSDBA。我怀疑这是用户/ID 问题,因为测试尚未达到这一点

主机名:localhost(也尝试过专用IP) 端口:1522 SID:TEST(虽然我也尝试过TEST_DB)

tnsping test_db 给出:

Used parameter files:
C:\Users\testUser\Downloads\WINDOWS.X64_193000_db_home\network\admin\sqlnet.ora


Used TNSNAMES adapter to resolve the alias
Attempting to contact (DESCRIPTION = (ADDRESS_LIST = (ADDRESS = (PROTOCOL = TCP)(HOST = localhost)(PORT = 1522))) (CONNECT_DATA = (SERVICE_NAME = LCM)))
OK (0 msec)

我认为应该是 tnsping localhost 1522 但这不起作用。在 tnsping localhost 上它会尝试默认端口 1521。

不知道从这里去哪里......

oracle oracle-sqldeveloper listener oracle19c
1个回答
0
投票

这个问题已经在这里回答过N次了...总之SQL*Plus使用操作系统身份验证而不是SQLDeveloper:数据库参数REMOTE_LOGIN_PASSWORDFILE必须设置为独占并且密码文件必须存在(在$ORACLE_HOME/dbs/orapw中),创建一个- 使用 orapwd - 如果没有。

© www.soinside.com 2019 - 2024. All rights reserved.