昨天用ORACLE数据库还好好的,早上到公司连接数据库就出现如标题的错误,搜索的很多资料才解决问题,现在将解决过程完成的描述出来,以供以后查用。
首先分析出现这样的问题,肯定归结为监听器的错误
1、首先找到目录:D:\app\Administrator\product\11.2.0\dbhome_1\NETWORK\ADMIN下面的listener.ora文件,打开以后,如下:
# listener.ora Network Configuration File: D:\app\Administrator\product\11.2.0\dbhome_1\NETWORK\ADMIN\listener.ora
# Generated by Oracle configuration tools.
JCMS_LISTENER =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.22.177)(PORT = 1521))
)
SID_LIST_JCMS_LISTENER =
(SID_LIST =
(SID_DESC =
(SID_NAME = CLRExtProc)
(ORACLE_HOME = D:\app\Administrator\product\11.2.0\dbhome_1)
(PROGRAM = extproc)
(ENVS = "EXTPROC_DLLS=ONLY:D:\app\Administrator\product\11.2.0\dbhome_1\bin\oraclr11.dll")
)
)
2、修改后的listener.ora文件内容如下:
# listener.ora Network Configuration File: D:\app\Administrator\product\11.2.0\dbhome_1\NETWORK\ADMIN\listener.ora
# Generated by Oracle configuration tools.
JCMS_LISTENER =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.22.177)(PORT = 1521))
)
SID_LIST_JCMS_LISTENER =
(SID_LIST =
(SID_DESC =
(GLOBAL_DBNAME = JCMS)
(ORACLE_HOME = D:\app\Administrator\product\11.2.0\dbhome_1)
(SID_NAME = JCMS)
)
(SID_DESC =
(SID_NAME = CLRExtProc)
(ORACLE_HOME = D:\app\Administrator\product\11.2.0\dbhome_1)
(PROGRAM = extproc)
(ENVS = "EXTPROC_DLLS=ONLY:D:\app\Administrator\product\11.2.0\dbhome_1\bin\oraclr11.dll")
)
)
3、其中红色部分为最新添加的,确定要监听的数据库实例
4、保存listener.ora文件,关闭,然后重启监听程序,命令如下:
lsnrctl stop //关闭监听
lsnrctl //启动监听
5、然后再去连接数据库,会出现两三个新的错误,如下:
ORA-27101: shared memory realm does not exist
6、打开目录:D:\app\Administrator\admin\jcms\pfile,会发现类似init.ora.10172006113057的文件,找到日期最晚的一个。
7、打开命令行窗口:
sqlplus /nolog
create spfile from pfile='D:\app\Administrator\admin\jcms\pfile\init.ora.1017200611305';
startup // 启动数据库。
8、再次连接数据库,恢复正常。