我想连接到正在运行的“ 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”命令会得到“确定”结果。
我可以使用“ sqlplus / as sysdba”登录,并且当我使用“从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数据库?我在配置中或其他地方缺少什么?
答案 0 :(得分:0)
我认为您想要的只是
sqlplus [user]/[Password]@[connect identifier]
例如您的用户为system
,密码为pswd
,示例中的连接标识符为'ORCL'
因此您的sqlplus命令将是:
sqlplus system/pswd@orcl
如果您的数据库已安装在本地计算机上,那么也可以只连接到本地主机而不是服务
sqlplus system/pswd@localhost