了解/dev/shm

使用redhat系列的操作系统,可以发现系统默认挂载了/dev/shm,挂载类型为tmpfs。

在glibc2.2以上的版本,使用/dev/shm 作为POSIX 共享内存 (shm_open, shm_unlink),在fstab上可以看到

tmpfs /dev/shm tmpfs defaults 0 0

这里要说下tmpfs。

tmpfs从名字看就知道是临时文件系统,所以写入到tmpfs类型的分区下的文件都不会写入硬盘,只是保存在硬盘里,tmpfs在挂载时如果没有指定size默认使用物理内存的一半作为它的值。相对于ramfs,tmpfs有它一系列的优势,首先它能被用于交换,更重要的是挂载一个tmpfs类型的分区并不实际占用物理内存(当然往里写了就开始占内存了,即写1M的文件进去,就占了1M)。而ramfs的话在初始化的时候就限制了,必须分配掉相应的内存作为物理磁盘,事实上就算你还没用内存就已经少掉了。

利用tmpfs,同样的,我可以手动创建个目录并挂载

mount -t proc none /mnt/1

这样,/mnt/1 也是tmpfs类型。使用df -h可以看到多了个分区,并且大小也是内存的一半。之后就随便怎么用啦~

最后当umount掉分区后,所有该分区的文件就自动消失了,内存被释放。

ORACLE 数据库从11g 版本开始,引入了一个自动内存管理(Automatic Memory Management)特性,该特性需要更多的共享内存(/dev/shm),因此如果决定应用该特性的话, 必须要确保共享内存大于ORACLE 中初始化参数MEMORY_MAX_TARGET 和MEMORY_TARGET(特别提示,这两个参数即自动内存管理特性对应的初始化参数)的值。
如果在初始化参数中设置了MEMORY_MAX_TARGET 和MEMORY_TARGET 两参数为非0 值,并且不符合系统共享内存,则ORACLE 数据库启动时,就会触发ORA-00845:MEMORY_TARGET not supported on this system 错误。

ORACLE官方文档中的原话为:
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 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. 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), even then it will result in an ORA-00845 error.
The number of file descriptors for each Oracle instance should be at least 512*PROCESSES. Also, the limit of descriptors for each process should be at least 512.
If file descriptors are not sized correctly, you will notice ORA-27123 from various Oracle processes and potentially Linux Error EMFILE (Too many open files) errors in non-Oracle processes.
To determine the amount of shared memory available, enter the following command:

# df -h /dev/shm/

 

来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/10640532/viewspace-680426/,如需转载,请注明出处,否则将追究法律责任。

转载于:http://blog.itpub.net/10640532/viewspace-680426/

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值