【问题标题】:Can not connect to the Oracle Service无法连接到 Oracle 服务
【发布时间】:2019-08-01 10:58:26
【问题描述】:

我想连接到正在运行的“orcl”Oracle 数据库。

我对 Oracle 管理员没有太多经验。我在 Windows Server 中安装了 Oracle 12c,因为我看到机器中启动了“Oracle”、“OracleOraDB12Home1TNSListener”和“OracleServiceORCL”服务。

我在“tnsnames.ora”文件中添加了以下内容:

ORCL =
  (DESCRIPTION =
    (ADDRESS = (PROTOCOL = TCP)(HOST = localhost)(PORT = 1539))
    (CONNECT_DATA =
      (SERVER = DEDICATED)
      (SERVICE_NAME = orcl)
    )
  )

执行“tnsping orcl”命令得到“Ok”结果。

我可以使用“sqlplus / as sysdba”登录,当我使用“select name from v$database”命令查询时,我看到“orcl”数据库处于活动状态。

但是当我尝试使用 Sqldeveloper 连接到“orcl”数据库时,或者当我执行时

"sqlplus -L "system/password@(DESCRIPTION =(ADDRESS = (PROTOCOL = TCP)(HOST = localhost)(PORT = 1539))(CONNECT_DATA =(SERVER = DEDICATED)(SERVICE_NAME = orcl)))"

我遇到了以下问题:

SQL*Plus: Release 12.2.0.1.0 Production on Thu Aug 1 10:53:28 2019

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

ERROR:
ORA-12514: TNS:listener does not currently know of service requested in connect
descriptor


SP2-0751: Unable to connect to Oracle.  Exiting SQL*Plus

执行“lsnrctl status”命令时:

LSNRCTL for 64-bit Windows: Version 12.2.0.1.0 - Production on 01-AUG-2019 12:16
:04

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

Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=localhost)(PORT=1539)))
STATUS of the LISTENER
------------------------
Alias                     LISTENER
Version                   TNSLSNR for 64-bit Windows: Version 12.2.0.1.0 - Produ
ction
Start Date                01-AUG-2019 09:38:59
Uptime                    0 days 2 hr. 37 min. 5 sec
Trace Level               off
Security                  ON: Local OS Authentication
SNMP                      OFF
Listener Parameter File   C:\app\Administrator\virtual\product\12.2.0\dbhome_1\n
etwork\admin\listener.ora
Listener Log File         C:\app\Administrator\virtual\diag\tnslsnr\WIN-91FKK175
962\listener\alert\log.xml
Listening Endpoints Summary...
  (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=WIN-91FKK175962)(PORT=1539)))
  (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(PIPENAME=\\.\pipe\EXTPROC1521_1ipc)))
Services Summary...
Service "CLRExtProc" has 1 instance(s).
  Instance "CLRExtProc", status UNKNOWN, has 1 handler(s) for this service...
The command completed successfully

如何连接到 orcl 数据库?我在配置或任何地方缺少什么?

【问题讨论】:

  • 你试过sqlplus system/password@orcl吗?
  • 是的,我已经尝试并得到相同的“ORA-12514”错误。
  • 从数据库连接字符串中删除空格字符,即system/password@(DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=localhost)(PORT=1539))(CONNECT_DATA=(SERVER=DEDICATED)(SERVICE_NAME=orcl))) 可能用双引号括起来。
  • 删除空格没有帮助。同样的结果。 :(

标签: oracle oracle12c


【解决方案1】:

我认为你想要的只是

sqlplus [user]/[Password]@[connect identifier]

例如。你的用户是system,密码是pswd,你的例子中的连接标识符是'ORCL'

所以你的 sqlplus 命令是:

sqlplus system/pswd@orcl

如果你的数据库安装在你的本地机器上,那么它也应该可以连接到本地主机而不是服务

sqlplus system/pswd@localhost

【讨论】:

  • 是的,我已经尝试过并得到相同的“ORA-12514”错误。即使它是活动数据库,“orcl”看起来也有问题。我检查了来自 v$database 和 v$thread 系统表的查询。您还有其他建议吗?
  • 尝试连接本地主机
  • 当我尝试使用 localhost 时,我点击了这个:ORA-12541: TNS:no listener
  • 检查监听器状态并在您的问题中添加结果:lsnrctl status
  • 将“lsnrctl status”结果添加到问题中。
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2019-12-07
  • 1970-01-01
  • 2020-01-24
  • 1970-01-01
  • 2018-12-20
  • 1970-01-01
相关资源
最近更新 更多