Oracle数据库在之前启动都是好好的,突然连接出现错误,报错为:ORA-12505:
百度了很多页面,找到了一个解决的方法。
打开Oracle的安装目录下的 D:\Oracle11g2\product\11.2.0\dbhome_1\NETWORK\ADMIN
在里面找到 listener.ora
原来的内容如下:
# listener.ora Network Configuration File: D:\Oracle11g2\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 = D:\Oracle11g2\product\11.2.0\dbhome_1)
(PROGRAM = extproc)
(ENVS = "EXTPROC_DLLS=ONLY:D:\Oracle11g2\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 = D:\Oracle11g2
缺少一些信息,补充后如下:
# listener.ora Network Configuration File: D:\Oracle11g2\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 = D:\Oracle11g2\product\11.2.0\dbhome_1)
(PROGRAM = extproc)
(ENVS = "EXTPROC_DLLS=ONLY:D:\Oracle11g2\product\11.2.0\dbhome_1\bin\oraclr11.dll")
)
(SID_DESC =
(GLOBAL_DBNAME = ORCLYJYLEN)
(ORACLE_HOME = D:\Oracle11g2\product\11.2.0\dbhome_1\)
(SID_NAME = ORCLYJYLEN)
)
)
LISTENER =
(DESCRIPTION_LIST =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1521))
(ADDRESS = (PROTOCOL = TCP)(HOST = localhost)(PORT = 1521))
)
)
ADR_BASE_LISTENER = D:\Oracle11g2
增加了SID_DESC部分。ORCLYJYLEN是你的数据库SID名称。
再启动数据库,又报出ORA-27101问题,
解决方法:在SQLPlus中使用sys用户登录,注意带上SYSDBA身份。然后用startup重启例程就可以了。
SQL*Plus: Release 11.2.0.1.0 Production on 星期二 10月 29 23:06:05 2019
Copyright (c) 1982, 2010, Oracle. All rights reserved.
请输入用户名: SYS AS SYSDBA
输入口令:
已连接到空闲例程。
SQL> startup
ORACLE 例程已经启动。
Total System Global Area 6831239168 bytes
Fixed Size 2188728 bytes
Variable Size 3539995208 bytes
Database Buffers 3271557120 bytes
Redo Buffers 17498112 bytes
数据库装载完毕。
数据库已经打开。
SQL>