解决oracle11g的ORA-12505问题
今天在使用SQL Developer的时候连不上去,报ORA-12505错误,但是SQLPLUS可以连接。
检查服务名,是OracleServiceORCL,那SID应当就是orcl,但是使用该SID仍然无法连接。
查阅资料后解决方法如下:
1. 打开数据库实例的目录(我的是C:\app\Administrator\product\11.2.0\dbhome_1\NETWORK\ADMIN)
找到listener.ora文件(listener监听器进程的配置文件),使用文本编辑器打开。
内容如下:
[plain] view plaincopy
- # listener.ora Network Configuration File: C:\app\Administrator\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 = C:\app\Administrator\product\11.2.0\dbhome_1)
- (PROGRAM = extproc)
- (ENVS = "EXTPROC_DLLS=ONLY:C:\app\Administrator\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 = C:\app\Administrator
2. 添加SID信息(红色字体部分)
[plain] view plaincopy
- # listener.ora Network Configuration File: C:\app\Administrator\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 = C:\app\Administrator\product\11.2.0\dbhome_1)
- (PROGRAM = extproc)
- (ENVS = "EXTPROC_DLLS=ONLY:C:\app\Administrator\product\11.2.0\dbhome_1\bin\oraclr11.dll")
- )
- <span style="color:#ff0000;">(SID_DESC =
- (GLOBAL_DBNAME = orcl)
- (ORACLE_HOME = C:\app\Administrator\product\11.2.0\dbhome_1)
- (SID_NAME = orcl)
- )
- </span> )
- LISTENER =
- (DESCRIPTION_LIST =
- (DESCRIPTION =
- (ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1521))
- (ADDRESS = (PROTOCOL = TCP)(HOST = localhost)(PORT = 1521))
- )
- )
- ADR_BASE_LISTENER = C:\app\Administrator
3. 重新启动 OracleServiceORCL 和 OracleOraDb11g_home1TNSListener 服务。最后试一试,连接成功!
附:
PL/SQL DEVELOPER 和 SQLPLUS 采用 service_name 进行连接
而应用程序是按照 sid_name 进行连接,所以出现 PL/SQL DEVELOPER和SQLPLUS 能够连接而应用程序却无法连接的问题。
使用 SELECT INSTANCE_NAME FROM V$INSTANCE 语句,就可以查看当前数据库实例的sid_name了。
http://blog.csdn.net/mdifferent/article/details/7887832