操作系统 | CentOS release 6.5 64-bit |
数据库版本 | Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - 64bit Production |
启动数据库的时候,遇到ORA-00845: MEMORY_TARGET not supported on this system这个错误。根据Oracle官网解释
Starting with Oracle Database 11g, the Automatic Memory Management feature requires more shared memory (/dev/shm)and file descriptors. The size of the shared memory should be at least the greater of MEMORY_MAX_TARGET and MEMORY_TARGET for each Oracle instance on the computer. If MEMORY_MAX_TARGET or MEMORY_TARGET is set to a non zero value, and an incorrect size is assigned to the shared memory, it will result in an ORA-00845 error at startup.
有两种解决方案:
1. Reduce the value for the memory_target parameter
2. Increase the temporary memory allocation on the server.
我先检查了我本地/dev/shm的大小:
df -h /dev/shm
然后发现才2G,于是我试图调大到4G,执行如下命令
mount -t tmpfs shmfs -o size=4g /dev/shm
然后为了确保系统重启后也能生效,我又修改了/etc/fstab这个文件,改成如下
然后Oracle DB启动成功,也能正常访问。但是我启动Jboss连接该数据库,得到了如下错误
ORA-27102: out of memory
Linux-x86_64 Error: 12: Cannot allocate memory
然后在网上搜了一堆解决方案,都没有解决该错误,然后试图调小memory_target和MEMORY_MAX_TARGET参数值的大小,
alter system set memory_max_target=1024m scope=spfile;
alter system set memory_target=1024m scope=spfile;
--查看sga和memory参数,看修改是否正确
show parameter sga;
show parameter memory;
然后重启数据库,再重启jboss,成功解决该问题。
shutdown immediate;
startup;