将 Oracle SQL Developer 连接到数据库时可能会遇到的错误:

将 Oracle SQL Developer 连接到数据库时可能会遇到的错误:

我已经成功设置了我的数据库,并且可以通过我的网站 wxplorer 进行一些查询

http://localhost:8080/apex/f?p=4500:1003:1042268341573744::NO:::

但是,当我下载带有 jdk 包的 4.1.5 Sql Developer 时,当我单击“新建连接”时,我输入:连接名称:MYONLINEEDU_XE 用户名:MYONLINEEDU 密码:admin123

当我单击“连接”时,出现错误:

状态:失败 - 测试失败:监听器拒绝连接,错误如下:ORA-12505,TNS:监听器目前不知道连接描述符中给出的 SID

在我的路径 C:\app\Stefan\product\11.2.0\dbhome_1\NETWORK\ADMIN 上这是我的 tnsnames(我添加了 orcl 设置):

 # tnsnames.ora Network Configuration File:       C:\app\Stefan\product\11.2.0\dbhome_1\network\admin\tnsnames.ora
 # Generated by Oracle configuration tools.

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

ORCL = 
(DESCRIPTION = 
  (ADDRESS = (PROTOCOL = TCP)(HOST = localhost)(PORT = 1521)
(CONNECT_DATA = 
(SERVER = DEDICATED)
(SERVICE NAME = orcl)
)
)

我甚至尝试启动 LSNRCTL 服务,但它已经启动了。

LSNRCTL> services
Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=EXTPROC1)))
Services Summary...
Service "CLRExtProc" has 1 instance(s).
Instance "CLRExtProc", status UNKNOWN, has 1 handler(s) for this service...
Handler(s):
  "DEDICATED" established:0 refused:0
     LOCAL SERVER
Service "PLSExtProc" has 1 instance(s).
Instance "PLSExtProc", status UNKNOWN, has 1 handler(s) for this service...
Handler(s):
  "DEDICATED" established:0 refused:0
     LOCAL SERVER
Service "XEXDB" has 1 instance(s).
Instance "xe", status READY, has 1 handler(s) for this service...
Handler(s):
  "D000" established:16 refused:0 current:0 max:1022 state:ready
     DISPATCHER <machine: STEFAN-PC, pid: 2664>
     (ADDRESS=(PROTOCOL=tcp)(HOST=STEFAN-PC)(PORT=18879))
Service "orcl" has 1 instance(s).
Instance "orcl", status READY, has 1 handler(s) for this service...
Handler(s):
  "DEDICATED" established:71 refused:0 state:ready
     LOCAL SERVER
Service "orclXDB" has 1 instance(s).
Instance "orcl", status READY, has 1 handler(s) for this service...
Handler(s):
  "D000" established:0 refused:0 current:0 max:1022 state:ready
     DISPATCHER <machine: STEFAN-PC, pid: 5228>
     (ADDRESS=(PROTOCOL=tcp)(HOST=STEFAN-PC)(PORT=1547))
Service "xe" has 1 instance(s).
Instance "xe", status READY, has 1 handler(s) for this service...
Handler(s):
  "DEDICATED" established:0 refused:0 state:ready
     LOCAL SERVER
The command completed successfully

另外在我的 system32/hosts 中我添加了 127.0.0.1 localhost

如何消除此错误并连接到我的数据库?

谢谢!

答案1

将 Oracle SQL Developer 连接到数据库时可能会遇到的错误:

  • 无效的用户名/密码 - 确保您使用用于uname/pwd访问数据库的slqplus

  • 字符串索引超出范围 - 您是否尝试连接错误的端口?可能是 22?检查监听端口/转发端口

  • 侦听器拒绝连接。未知 SID。- 确保您使用的是正确的系统 ID。

通过 SSH 进入远程数据库并切换到数据库用户。检查 Oracle SID:

echo $ORACLE_SID

启动 Oracle SQL Developer

单击绿色的“+”注册,弹出新的连接菜单。

Connection Name:    XYZ_Oracle
Username:           Oracle_db_username
Password:           pwd_for_db_username

Connection type:    Basic
Role:               Default
Hostname:           XXX.XX.XX.XX (Remote IP)
Port:               1521 (the forwarded port)
SID:                the Odarcle SID of the particular DB you want to access aka db name

Test

Connect

相关内容