一、说明
出现ORA-01034和ORA-27101的原因是多方面的:主要是oracle当前的服务不可用,shared memory realm does not exist,是因为oracle没有启动或没有正常启动,共享内存并没有分配给当前实例.所以,通过设置实例名,再用操作系统身份验证的方式,启动数据库。这样数据库就正常启动了,就不会报ORA-01034和ORA-27101两个启动异常了。
还有就是可能是登录数据库后,不正常的退出,比如直接关掉窗口,而这时数据库里有未完成的动作,再次登录时就会提示“insufficient privileges”的报错,SQL>shutdown immediate; SQL>startup;就恢复正常了。
最后可能你虚拟机的共享内存问题,看下数据库的配置文件是否对应了512M内存?还是你设置的大了,本身给的不足?
二、解决方法
1、启动监听
先看oracle的监听和oracle的服务是否都启动了。
启动oracle监听:cmd命令行窗口下,输入lsnrctl start,回车即启动监听。
[root@scorl ~]# lsnrctl start
LSNRCTL for Linux: Version 11.2.0.3.0 - Production on 26-FEB-2020 12:22:48
Copyright (c) 1991, 2011, Oracle. All rights reserved.
Starting /Database/oraapp/oracle/product/11.2.0/dbhome_1/bin/tnslsnr: please wait...
TNSLSNR for Linux: Version 11.2.0.3.0 - Production
System parameter file is /Database/oraapp/oracle/product/11.2.0/dbhome_1/network/admin/listener.ora
Log messages written to /Database/oraapp/oracle/diag/tnslsnr/scorl/listener/alert/log.xml
Listening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC1521)))
Listening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=scorl.dyedu.cn)(PORT=1521)))
Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=EXTPROC1521)))
STATUS of the LISTENER
------------------------
Alias LISTENER
Version TNSLSNR for Linux: Version 11.2.0.3.0 - Production
Start Date 26-FEB-2020 12:22:48
Uptime 0 days 0 hr. 0 min. 30 sec
Trace Level off
Security ON: Local OS Authentication
SNMP OFF
Listener Parameter File /Database/oraapp/oracle/product/11.2.0/dbhome_1/network/admin/listener.ora
Listener Log File /Database/oraapp/oracle/diag/tnslsnr/scorl/listener/alert/log.xml
Listening Endpoints Summary...
(DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC1521)))
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=scorl.dyedu.cn)(PORT=1521)))
Services Summary...
Service "scorl.dyedu.cn" has 1 instance(s).
Instance "scorl", status UNKNOWN, has 1 handler(s) for this service...
The command completed successfully
2、设置sid(正常没必要设置)
查看oracle的sid叫什么,比如创建数据库的时候,实例名叫“orcl”,那么先手工设置一下oralce的sid,cmd命令窗口中,set ORACLE_SID=orcl
3、重启Oracle
[root@scoreorl ~]# su - oracle
[oracle@scoreorl ~]$ sqlplus /nolog
SQL*Plus: Release 11.2.0.3.0 Production on Mon Dec 25 21:43:18 2017
Copyright (c) 1982, 2011, Oracle. All rights reserved.
SQL> connect / as sysdba
Connected.
SQL>
SQL> startup
ORACLE instance started.
Total System Global Area 9620525056 bytes
Fixed Size 2236488 bytes
Variable Size 4831842232 bytes
Database Buffers 4764729344 bytes
Redo Buffers 21716992 bytes
Database mounted.
Database opened.
再输入startup,回车.这步是启动oracle服务。如果startup启动被告知已经启动了,可以先输入shutdown immediate;等shutdown结束之后,再输入startup。
过几秒钟等命令运行完成,就能连接了。这个时候,可以输入"select * from user_tables;"测试一下,看是否有查询结果。
参考:https://jingyan.baidu.com/article/5552ef47c73eef518ffbc908.html