oracle数据库共享内存报错解决
压测时系统后台日志报错:
Cause: java.sql.SQLException: ORA-04031: unable to allocate 32 bytes of shared memory ("shared pool","SELECT id,notice_id,mp3_fil...","sql area","kglhin: temp")
; ORA-04031: unable to allocate 32 bytes of shared memory ("shared pool","SELECT id,notice_id,mp3_fil...","sql area","kglhin: temp")
; nested exception is java.sql.SQLException: ORA-04031: unable to allocate 32 bytes of shared memory ("shared pool","SELECT id,notice_id,mp3_fil...","sql area","kglhin: temp")
at org.springframework.jdbc.support.SQLStateSQLExceptionTranslator.doTranslate(SQLStateSQLExceptionTranslator.java:113)
原因分析:
数据库共享内存不够导致
解决方法:加大数据库共享内存
command命令窗口查询共享内存大小
show parameters shared_pool_size
修改大小
ALTER SYSTEM SET SHARED_POOL_SIZE='256M' SCOPE=BOTH;
执行时报错:
修改完后重启数据库,数据库启动不起来报错:
ORA-00371: not enough shared pool memory, should be atleast 62198988 bytes
解决方法:
1)先从pfile启动
SQL> startup pfile='/u01/app/oracle/product/10.2.0/db_1/dbs/initTSH1.ora';
2)从spfile创建新的pfile文件,(后面创建spfile时需要用到此文件)
SQL> create spfile='/u01/app/oracle/product/10.2.0/db_1/dbs/spfileTSH1.ora' from pfile='/u01/app/oracle/product/10.2.0/db_1/dbs/initTSH1.ora';
3)pfile创建好之后,可以将里面的shared_pool_size修改为你需要的大小。
直接文本打开initTSH1.ora,修改该文件里面的共享内存大小
4)关闭数据库,从新建的pfile文件启动
SQL> shutdown immediate
SQL> startup pfile='/u01/app/oracle/product/10.2.0/db_1/dbs/initTSH1.ora'
5)从修改之后的pfile文件创建spfile.
SQL> create spfile='/u01/app/oracle/product/10.2.0/db_1/dbs/spfileTSH1.ora' from pfile='/u01/app/oracle/product/10.2.0/db_1/dbs/initTSH1.ora';
File created.
6)关闭重启,问题解决
SQL> shutdown immediate
SQL> startup
附录:undo_management参数修改
alter system set undo_management='AUTO' scope=spfile;
改完后重启数据库