oracle对/dev/shm的使用

Posted CHINA ORACLE-BASE

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了oracle对/dev/shm的使用相关的知识,希望对你有一定的参考价值。

查看共享内存打开的文件数

  1. [[email protected] ~]# lsof -n | grep /dev/shm | wc -l
  2. 34693

共享内存中总共文件数

[[email protected] ~]# ls -l /dev/shm | wc -l
495

Why is Oracle keeping hundreds of thousands Open File descriptors in /dev/shm while there are just hundreds of files ?

解释:

查看每个进程打开的文件数:

  1. [[email protected] ~]# ps -ef | grep ora_smon | grep -v grep
  2. oracle 13984 1 0 Dec07 ? 00:17:30 ora_smon_db2
  3. [[email protected] ~]# lsof | grep 13984 | grep -v grep | wc -l
  4. 456

每个进程打开的文件数大约等于/dev/shm中的文件数

查看数据库的进程数:

  1. [[email protected] ~]# ps -ef | grep -v grep | grep -i ora_ | wc -l

  2. 76

计算:进程数*每个进程打开的文件数 约= 共享内存打开的文件数(76*456 = 34656) 约等于lsof -n | grep /dev/shm 得出的数


下列文章来自(MOS:1321306.1

1) Let‘s use a test database (11.1.0.7) to demonstrate how Automatic Memory Management uses file descriptors and why there are so many Open File descriptors. 

A) Before starting the 11.1.0.7 database, /dev/shm is empty and there are no open files 

$ ls -l /dev/shm
total 0
$ lsof -n | grep /dev/shm


B)  Let‘s start the database, then check /dev/shm

UNIX> sqlplus " / as sysdba"
       SQL*Plus: Release 11.1.0.7.0 - Production on Fri May 6 14:57:28 2011
       Copyright (c) 1982, 2008, Oracle. All rights reserved.
       Connected to an idle instance.

 SQL> startup
       ORACLE instance started.
       Total System Global Area 845348864 bytes
       Fixed Size 1316656 bytes
       Variable Size 578816208 bytes
       Database Buffers 260046848 bytes
       Redo Buffers 5169152 bytes
       Database mounted.
       Database opened.

 

SQL> show parameter memory_target
NAME           TYPE        VALUE
-------------- ----------- ------
memory_target  big integer 808M



SQL> show parameter memory_max_target
  NAME              TYPE          VALUE
 ----------------- ------------- ------ 
 memory_max_target  big integer  808M



C) let‘s check /dev/shm again

UNIX> ls -l /dev/shm/* | wc -l
           203
UNIX> lsof -n | grep /dev/shm | wc -l
            4872



Number of files in /dev/shm

There are 203 files  ( 4 MB size, which is the granule size)   (内存粒度的说明见oracle内存粒度的说明
This is approximately MEMORY_TARGET/4MB 
Since MEMORY_TARGET < 1 GB,  203 x 4 MB files are created

For a larger MEMORY_TARGET,  the number of files in /dev/shm = MEMORY_TARGET/granule size

See Note 947152.1 How to determine granule size.

Number of open files descriptors

There are 4872 open files handles why ?

After starting the 11.1.0.7 database, 24 background processes were created
UNIX> ps -ef | grep -i <database name> | wc -l
24


Each background process open 203 files x 24 = 4872
UNIX> lsof -n | grep /dev/shm | wc -l
4872



总结:


ls -l /dev/shm | wc -l              open files = MEMORY_TARGET/granule size

lsof -n | grep /dev/shm | wc -l   open file descriptos = open files*进程数


























































































































以上是关于oracle对/dev/shm的使用的主要内容,如果未能解决你的问题,请参考以下文章

Linux 一键配置 Oracle 主机 /dev/shm

Linux 一键配置 Oracle 主机 /dev/shm

df 报告磁盘使用情况,但在共享内存 /dev/shm 中没有文件

amm与/dev/shm

linux下的/dev/shm/及对Oracle 的影响

翻译自mos文章/dev/shm应该设置多大Oracle 实例启动时才能不报ORA-00845