解决Oracle数据库报错ORA-27104: system-defined limits for shared memory was misconfigured

时间:2024-04-07 16:49:23

解决Oracle数据库报错ORA-27104: system-defined limits for shared memory was misconfigured

问题现象

测试环境申请了新得机器后,Oracle数据库直接克隆了其他机器,但完成后使用Navicat连接报错:
解决Oracle数据库报错ORA-27104: system-defined limits for shared memory was misconfigured
XShell连接后,登录报错没有实例,关闭数据库和启动数据库都有如下报错:
解决Oracle数据库报错ORA-27104: system-defined limits for shared memory was misconfigured

摸索过程

在网上搜了很久之后,看到很多人提到alert.log日志,但是我找不到该日志。百度后参考ORACLEBASE/diag/rdbms/ORACLE_BASE/diag/rdbms/ORACLE_SID/$ORACLE_SID
解决Oracle数据库报错ORA-27104: system-defined limits for shared memory was misconfigured

最终在/u01/app/oracle/diag/rdbms/orcl/orcl/alert找到了类似的日志,日志中发现如下报错:
解决Oracle数据库报错ORA-27104: system-defined limits for shared memory was misconfigured

根据错误,可以判断出来是sga相关的配置太大了。

解决方法

参考:
http://blog.itpub.net/30150152/viewspace-1449898/
https://www.cnblogs.com/mikevictor07/p/3615558.html
由于数据库无法启动,只能调编辑参数文件:
我的spfile文件目录是:
/u01/app/oracle/product/19.0.0/dbhome_1/dbs
因此执行的是:
create pfile=’/u01/app/oracle/product/19.0.0/dbhome_1/dbs/init20200506.ora’ from spfile;
过程如下:
[[email protected] dbs]$ sqlplus / as sysdba

SQL*Plus: Release 19.0.0.0.0 - Production on Thu May 7 02:19:18 2020
Version 19.3.0.0.0

Copyright © 1982, 2019, Oracle. All rights reserved.

Connected to an idle instance.

SQL> create pfile=’/u01/app/oracle/product/19.0.0/dbhome_1/dbs/init20200506.ora’ from spfile;

File created.

SQL> !vi /u01/app/oracle/product/19.0.0/dbhome_1/dbs/init20200506.ora

SQL> startup pfile=’/u01/app/oracle/product/19.0.0/dbhome_1/dbs/init20200506.ora’;
ORACLE instance started.

Total System Global Area 3221222464 bytes
Fixed Size 8901696 bytes
Variable Size 654311424 bytes
Database Buffers 2550136832 bytes
Redo Buffers 7872512 bytes
Database mounted.
ORA-01157: cannot identify/lock data file 10 - see DBWR trace file
ORA-01110: data file 10: ‘/u01/app/oracle/oradata/ORCL/zpzdata.dbf’

SQL>
此处启动我报的错误已经与原始错误无关了(该错误解决办法见其他博客),已经可以启动数据库了!
但是,如果此时关闭数据库再重新启动,还必须要使用pfile文件执行才不会报原来的错误,如果直接执行startup默认是执行的spfile文件启动,因此还需要将已修改的pfile文件覆盖到spfile文件:
create spfile from pfile=’/u01/app/oracle/product/19.0.0/dbhome_1/dbs/init20200506.ora’;
过程如下:
SQL> shutdown immediate;
Database closed.
Database dismounted.
ORACLE instance shut down.
SQL> startup;
ORA-27104: system-defined limits for shared memory was misconfigured
SQL> startup pfile=’/u01/app/oracle/product/19.0.0/dbhome_1/dbs/init20200506.ora’;
ORACLE instance started.

Total System Global Area 3221222464 bytes
Fixed Size 8901696 bytes
Variable Size 654311424 bytes
Database Buffers 2550136832 bytes
Redo Buffers 7872512 bytes
Database mounted.
Database opened.
SQL> create spfile from pfile=’/u01/app/oracle/product/19.0.0/dbhome_1/dbs/init20200506.ora’;

File created.

SQL> shutdown immediate;
Database closed.
Database dismounted.
ORACLE instance shut down.
SQL> startup;
ORACLE instance started.

Total System Global Area 3221222464 bytes
Fixed Size 8901696 bytes
Variable Size 654311424 bytes
Database Buffers 2550136832 bytes
Redo Buffers 7872512 bytes
Database mounted.
Database opened.
SQL> exit
搞定!撒花!