当系统报出ora-00845错误时,是由于oracle 11g的内存管理新特性要求更多的共享内存和文件描述符导致的。解决方法呢就是更改/dev/
这个问题是在一次测试中发现的。在虚拟机上恢复生产库的备份,服务器是24g内存,而虚拟机才分配了2g。好了,言归正传:
当系统报出ora-00845错误时,是由于oracle 11g的内存管理新特性要求更多的共享内存和文件描述符导致的。解决方法呢就是更改/dev/shm的大小,当然也可以更改memory_max_target大小,但是这个方法不好。
下面是官方手册里的说明,为了让暂时看英文还头大的朋友稍微舒服点儿,在每段后面都加上中文的简要说明。
automatic memory management
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 must be at least the greater of the memory_max_target and memory_target parameters for each oracle instance on the computer. if the memory_max_target parameter or the memory_target parameter is set to a nonzero value, and an incorrect size is assigned to the shared memory, it results in an ora-00845 error at startup. on linux systems, if the operating system /dev/shm mount size is too small for the oracle system global area (sga) and program global area (pga), it results in an ora-00845 error.
从11g开始,amm特性呢要求更多的共享内存和文件描述符。对于计算机上的每个oracle实例,它的共享内存大小必须至少比memory_max_target和max_target都大。如果你启用了amm,也就是上面的两个参数设置成了非零值,,并且设置了不正确的共享内存值,那么就会在启动时出现ora-00845的错误。
the number of file descriptors for each oracle instance must be at least 512*processes. the limit of descriptors for each process must be at least 512. if file descriptors are not sized correctly, you see an ora-27123 error from various oracle processes and potentially linux error emfile (too many open files)in non-oracle processes.
这一段是说ora-27123错误的原因,是文件描述符没有达到oracle要求的最小值。
to determine the amount of shared memory available, enter the following command:
执行下面的命令,查看系统可用共享内存值大小
# df -h /dev/shm/
note:
the memory_max_target and memory_target parameters cannot be used when the lock_sga parameter is enabled, or with hugepages on linux.
on the initialization parameters page, note the memory size (sga and pga), which sets the initialization parameter memory_target or memory_max_target. the initialization parameters cannot be greater than the shared memory file system on the operating system. for example, if the shared memory file system allocation on your system is 1 gb, but you set memory size (memory_target) to 2 gb, then the following error messages are displayed during database startup:
ora-00845: memory_target not supported on this system
ora-01078: failure in processing system parameters
这一段就是说了一个具体的例子。在参数文件中,那两个初始化参数不能比操作系统上的共享内存文件系统大。例如,你的系统上共享内存文件系统分配的值是1gb,但是你设置的memory_target到2gb了,那么00845就来了。
in addition, if you click all initialization parameters and the global database name is longer than eight characters, then the database name value (in the db_name parameter) is truncated to the first eight characters, and the db_unique_name parameter value is set to the global name.
这个不是本篇文章要说的,略过~~~
the workaround, if you encounter the ora-00845 error, is to increase the /dev/shm mountpoint size.
for example:
# mount -t tmpfs shmfs -o size=7g /dev/shm
to make this change persistent across system restarts, add an entry in /etc/fstab similar to the following:
shmfs /dev/shm tmpfs size=7g 0
上面的这一串就是告诉咱们如何增加/dev/shm的大小,并且如何永久生效