首页 > Linux操作系统 > Linux操作系统 > Why Does Oracle Create So Many Open File Descriptors in /dev/shm

Why Does Oracle Create So Many Open File Descriptors in /dev/shm

原创 Linux操作系统 作者:spider0283 时间:2011-12-21 11:33:35 0 删除 编辑
ID 1321306.1
修改时间 19-OCT-2011     类型 HOWTO     状态 REVIEWED 

In this Document

Applies to:

Oracle Server - Enterprise Edition - Version: to - Release: 11.1 to 11.2
Linux x86
Linux x86-64


Oracle is creating hundreds of thousands open file descriptors in /dev/shm (open files)

$ lsof -n | grep /dev/shm | wc -l

But there are only just hundreds of files in  /dev/shm

$ ls -l /dev/shm/* | wc -l

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

2. Is this a known issue? ( any notes/documents/bug reports/fixes exist).

3. Or is this expected behavior. of oracle?


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

A) Before starting the 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 - 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
UNIX> lsof -n | grep /dev/shm | wc -l

Number of files in /dev/shm
There are 203 files  ( 4 MB size, which is the granule size)
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 database, 24 background processes were created
UNIX> ps -ef | grep -i | wc -l

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

Please note that there are no connections to the database yet. Oracle is not leaking file descriptors.

For each instance running on the server, each Oracle background process will open files under /dev/shm for the suitable instance. Those files will be opened as long as the database is running. No connections are required

In a dedicated server environment, a dedicated process is created for each database connection.
Each dedicated process needs to connect to /dev/shm shared memory segments, so opens  MEMORY_TARGET/ file descriptors.  In addition, it generates file descriptors for each datafile.

These file descriptors persist until the connections are terminated.

2) That is the expected behavior. and it is also documented in the Reference Manual

Oracle Database Administrator's Reference
11g Release 1 (11.1) for Linux and UNIX-Based Operating Systems
Part Number B32009-09

Appendix C
Administering Oracle Database on Linux

C.6 Allocating Shared Resources

"The number of file descriptors for each Oracle instance are increased by 512*PROCESSES. Therefore, the maximum number of file descriptors should be at least this value, plus some more for the operating system requirements. For example, if the cat /proc/sys/fs/file-max command returns 32768 and PROCESSES are 100, you can set it to 6815744 or higher as root, to have 51200 available for Oracle."



NOTE:787780.1 - Open Files/Open File Descriptors
NOTE:947152.1 - How to determine granule size

显示相关信息 相关内容

  • Oracle Database Products > Oracle Database > Oracle Database > Oracle Server - Enterprise Edition


来自 “ ITPUB博客 ” ,链接:,如需转载,请注明出处,否则将追究法律责任。

请登录后发表评论 登录


  • 博文量
  • 访问量