我安装了Oracle 11g r2,有2个数据库(se3和mydb,都有db_domain .orcl,即mydb.orcl和se3.orcl)运行就好了直到昨天。但突然间我得到了ORA-12514错误(TNS:监听器不知道连接描述符中请求的服务)..
我的tnsnames.ora文件:
# tnsnames.ora Network Configuration File: G:\oracledb\product\11.2.0\dbhome_1\network\admin\tnsnames.ora
# Generated by Oracle configuration tools.
LISTENER_MYDB =
(ADDRESS = (PROTOCOL = TCP)(HOST = localhost)(PORT = 1521))
ORACLR_CONNECTION_DATA =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1521))
)
(CONNECT_DATA =
(SID = CLRExtProc)
(PRESENTATION = RO)
)
)
MYDB =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = localhost)(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = mydb.orcl)
)
)
SE3 =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = localhost)(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = se3.orcl)
)
)
LISTENER_SE3 =
(ADDRESS = (PROTOCOL = TCP)(HOST = localhost)(PORT = 1521))
LISTENER.ORA FILE:
# listener.ora Network Configuration File: G:\oracledb\product\11.2.0\dbhome_1\network\admin\listener.ora
# Generated by Oracle configuration tools.
SID_LIST_LISTENER =
(SID_LIST =
(SID_DESC =
(SID_NAME = CLRExtProc)
(ORACLE_HOME = G:\oracledb\product\11.2.0\dbhome_1)
(PROGRAM = extproc)
(ENVS = "EXTPROC_DLLS=ONLY:G:\oracledb\product\11.2.0\dbhome_1\bin\oraclr11.dll")
)
)
LISTENER =
(DESCRIPTION_LIST =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1521))
(ADDRESS = (PROTOCOL = TCP)(HOST = localhost)(PORT = 1521))
)
)
ADR_BASE_LISTENER = G:\oracledb
我能够“tnsping mydb / se3”很好..试图更改tnsnames.ora和listener.ora文件(现已恢复)但无法通过sqlplus或sqldeveloper / visual studio连接到其中任何一个.. plz帮帮我..谢谢!
答案 0 :(得分:0)
基于您自己的评论“我能够设置ORACLE_SID但无法通过sqlplus连接... ORA-01034 - Oracle不可用”很可能是您的数据库实例已关闭。从理论上讲,可以在进程中运行基础Windows服务OracleServiceMYDB和相应的oracle.exe,但数据库实例已关闭。最好的办法是在服务器上查找包含alert_mydb.log的跟踪目录,并查看最后的条目。
如果数据库没有运行且警报日志没有显示严重错误,请按以下方式启动:
set ORACLE_SID=MYDB
set ORACLE_HOME=D:\my\oracle\home
%ORACLE_HOME%\bin\sqlplus "/ as sysdba"
ORACLE not available.
SQL> STARTUP
SQL> EXIT
lsnrctl services
最后一个命令应该显示MYDB已注册。 继续ORACLE_SID = SE3
答案 1 :(得分:0)
就我而言,尝试通过 SQL * Plus 从仅限客户端计算机连接时,我收到 ORA-12514 错误远程数据库:
C:\Temp>sqlplus username@connect_descriptor
SQL*Plus: Release 11.2.0.3.0 Production on Wed Sep 24 09:43:04 2014
Copyright (c) 1982, 2011, Oracle. All rights reserved.
Enter password:
ERROR:
ORA-12514: TNS:listener does not currently know of service requested in connect
descriptor
我发现这令人费解,因为 tnsping 成功回应:
C:\Temp>tnsping connect_descriptor
TNS Ping Utility for 32-bit Windows: Version 11.2.0.3.0 - Production on 24-SEP-2
014 09:48:04
Copyright (c) 1997, 2011, Oracle. All rights reserved.
Used parameter files:
D:\Oracle\product\11.2.0\client_1\network\admin\sqlnet.ora
Used TNSNAMES adapter to resolve the alias
Attempting to contact (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = host
.intranet.com)(PORT = 1521)) (CONNECT_DATA = (SERVER = DEDICATED) (SERVICE_NAME =
HOST13)))
OK (20 msec)
最终,我在 tnsnames.ora 文件中将我的问题追踪为错误的SERVICE_NAME
值:
CONNECT_DESCRIPTOR =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = host.intranet.com)(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = HOST13)
)
)
将HOST13
(通过普通文本编辑器)更改为SERVICE_NAME
的正确值后,我就能够连接到远程Oracle数据库。
在我的Oracle 11.2客户端计算机上,这里是 tnsnames.ora 的位置:
C:\Oracle\product\11.2.0\client_1\network\admin\tnsnames.ora